With data driven frameworks a main goal, i needed something that was fast and simple to create, so I looked around and found an open source project called fastJSON. Its probably one of the fastest JSON tools i've found, and its fairly simple to use. I even built a few utilities around it to make it even more user friendly. so i can do things like:
- string json = JsonManager.load("actions.json") etc.
- JsonObject jo = JsonManager.jsonToJsonObject(json);
- EnumerableType myEnum = jo["first level","second level", ... , "nth level"].toEnum();
All sorts of fun things that make it very simple to use, but that is only part of the story.
The real meat comes down to actually implementing useful data structures and using the json to drive them.
Here is a blurb from my "actions.v" and "damage.v" json files. The object of these is to allow me and any future players to create new fun things through definitions in these files and the game will use them.
action.v outtake:[code=js:0]{ "name":"RANGED_DMG", "action_type":"DAMAGE", "impact_type":"DIRECT", "damage_def":"RANGED_DMG", "modify_type":"NONE", "modify_duration":"NONE", "creation_type":"NONE", "destroy_type":"NONE"}
damage.v outtake:[code=js:0]{ "name":"RANGED_DMG", "damage_type":"PIERCING", "damage_basis":"WEAPON", "min":0, "max":0, "skill_name":"RANGED", "stat_type":"FOCUS" }
They're fairly straight forward, but i can also do other cool things like store all my skeletal-bone information too
outtake from animation.v[code=js:0]"character_defs":[ { "name": "BAT", "skeletons": [ "BAT_NORMAL" ], "current_skeleton":"BAT_NORMAL", "current_animation":"FLY"},...{ "name": "BAT_NORMAL", "bones":[ { "name": "BAT_HEAD_NORMAL", "texture":"characters\\bat_head", "origin_x":12, "origin_y":12, "rotation":0.0, "rotation_x":4, "rotation_y":4, "time":500, "animations":[ { "name": "FLY", "animation_def":"BAT_HEAD_NORMAL_FLY" } ]},...{"animation_defs":[ { "name": "BAT_HEAD_NORMAL_FLY" "key_frames":[ {"percent":0.0, "x": 0.0,"y":0.0,"rotation":0.0}, {"percent":1.0, "x": 0.0,"y":0.0,"rotation":0.0} ]},
Yes, it gets a bit verbose, but it works. I've done similar things for map definitions and terrain definitions (not yet utilized as i'm still pondering exactly how i want it to work)
Other things i've created is a Dungeon map generator which builds many many many interconnected rooms its not populated with anything beyond the rooms yet, but its playable. I've also incorporated my 2D simple skeletal animation giving me easier animation capabilities. (you can see early experiments here). Things are simple at the moment, but i don't have to worry about my pixel art skills as much now Additionally, I've made improvements to the enemy AI to prevent them from getting routed by the player into corners, it incorporates not only my Behavior Tree capability, but also my Agent Component Bus (ACB) capability to recognize situations. the ACB turned out quite well and is very very fast (see the TCycles/frame in the video below).
Anyway, here is how things are shaping up:
Note: Alot of it is horrible programmer art, so its going to look and sound bad ;)
[edits: fixed some errors, made the json examples a bit more clear]
I just love sound effects.
Its just hilarious to me :D!