Realizing that I would have to do it eventually, and better now than later, I finally decided to undergo a major internal reorganization in how I store my game data (units, events, etc). Before, I used a highly inefficient format that essentially required me to write my own parser and made it a pain to write and modify levels. The source for nightfall 1, for example, looked like this:
Before an earlier reorganzation it was even worse - the story text was manually split up into lines rather than it being one line and the computer splitting automatically. The problems here are obvious - extremely painful to edit, ugly, redundant. But the worst problem is that this style of data storage is contrary to how a level editor, my longest-term plan, should work - in a good level editor, you don't edit each unit's statistics individually, you create unit classes, edit class attributes and put units from those classes onto the map. Thus, I reorganized the file to look like this (just a snippet):
#story This is an example campaign for Slasha 5.0. Here you will fight as a commander of Faladare against the evil wizard Xandros and his demonic minions. You first encounter the enemy near a small hill. #setup 33.333 0 40 30 unit 0 0 10 90 1.666 Dark_Knight.png 0.093 1.333 6.666 unit 0 0 10 90 1.666 Dark_Knight.png 0.093 1.333 10 unit 0 0 10 90 1.666 Dark_Knight.png 0.093 1.333 13.333 unit 0 0 10 90 1.666 Dark_Knight.png 0.093 1.333 16.666 unit 0 0 10 90 1.666 Dark_Knight.png 0.093 1.333 20 unit 0 0 10 90 1.666 Dark_Knight.png 0.093 1.333 23.333 unit 0 0 10 90 1.666 Dark_Knight.png 0.093 1.333 26.666 unit 0 0 10 90 1.666 Dark_Knight.png 0.093 1.333 28 unit 1 1 10 90 1.666 Soldier.png 0.093 36.666 6.666 unit 1 1 10 90 1.666 Soldier.png 0.093 36.666 10 unit 1 1 10 90 1.666 Soldier.png 0.093 36.666 13.333 unit 1 1 10 90 1.666 Soldier.png 0.093 36.666 16.666 unit 1 1 10 90 1.666 Soldier.png 0.093 36.666 20 unit 1 1 10 90 1.666 Soldier.png 0.093 36.666 23.333 unit 1 1 10 90 1.666 Soldier.png 0.093 36.666 26.666 unit 1 1 10 90 1.666 Soldier.png 0.093 36.666 28
Before an earlier reorganzation it was even worse - the story text was manually split up into lines rather than it being one line and the computer splitting automatically. The problems here are obvious - extremely painful to edit, ugly, redundant. But the worst problem is that this style of data storage is contrary to how a level editor, my longest-term plan, should work - in a good level editor, you don't edit each unit's statistics individually, you create unit classes, edit class attributes and put units from those classes onto the map. Thus, I reorganized the file to look like this (just a snippet):
#setup 33.333 0 40 30
class soldier {'side':1,'aitype':1,'damage':10,'health':90,'range':1.6,'image':'Soldier.png','speed':0.093}
class darkknight {'side':0,'aitype':0,'damage':10,'health':90,'range':1.6,'image':'Dark_Knight.png','speed':0.093}
unit darkknight 1 6.666
unit darkknight 1 10
unit darkknight 1 13.333
For the class attributes, I no longer need to write a parser - it's a Javascript object already and Javascript can parse it. More reorganization is planned, but the hardest step is done - from here I can do what I need automatically with python and sed scripts.
All this means nothing to the user - it's a long term investment. Now, onto the other two parts to this update. First, foundation 1-4 are now beatable, although I have a plan in the works to make 3 more interesting. Second, there is now a feature that allows me to see the results (friendly losses, enemy losses, game time elapsed, real time elapsed) of every game you play. This is in part preparatory work for a high score table and in part so that I can balance levels better - right now, the only test subject I am getting level-specific feedback from is myself, and I have 2 years of experience playing this game and an intimate knowledge of how the AI works.
That's all for today!
No comments:
Post a Comment