Turn-based tile game dynamic item/skill/command script files

Posted by user1542 on Game Development See other posts from Game Development or by user1542
Published on 2012-06-07T05:50:50Z Indexed on 2012/06/07 10:48 UTC
Read the original article Hit count: 305

Filed under:
|
|

I want to create a mechanism that could read text script, for example some kind of custom script such as ".skill" or ".item", which maybe contain some sort of simple script like

.item
Item.Name = "Strength Gauntlet";
Character.STR += 20;

..

.skill
Skill.Name = "Poison Attack";
Skill.Description = "Steal HP and inflict poison";
Player.HP += 200;
Enemy.HP -= 200;
Enemy.Status += Status.POISON;

It may be different from this, but just want to give some idea of what I desire. However, I do not know how to dynamically parse these things and translate it into working script. For example, in battle scenerio, I should make my game read one of this ".skill" file and apply it to the current enemy, or the current player. How would I do this? Should I go for String parsing? It is like a script engine, but I prefer C# than creating new language, so how would I parse custom files into appropiate status commands?

Another problem is, I have also created a command engine which would read String input and parse it into action such as "MOVE (1,2)" would move character to tile (1,2). Each command belong to separate class, and provide generic parsing method that should be implemented by hand. This is for the reason of custom number/type of arguments per each command. However, I think this is not well designed, because I desire it to automatically parse the parameters according to specify list of types.

For example, MOVE command in "MOVE 1 2" would automatically parse the parameters into int, int and put it into X and Y. Now, this form can change, and we should be able to manually specify all type of formats. Any suggestion to this problem? Should I change from string parsing to some hardcode methods/classes?

© Game Development or respective owner

Related posts about XNA

Related posts about game-mechanics