Now, allow me to apologize for my absence. Lots of factors contributed to me being too busy to post; day-job stuff, gamedev stuff and my laziness being the largest of those. But nevertheless, I'm back to let you know what I've been up to.
When I started Morf I didn't have a very comprehensive vision of where the game was going (as is mostly the case when I start a game) and as a result of that, lots of the code was not generic enough to suit the growing needs Terri (my artist and teammate) and I have for the game. Specifically, I'm talking about how monster abilities and items are defined.
The amount of monster types and items that need to be defined started to really become an issue. In the original engine, I would define an item something like this:
add_item(name, model, handler, targeting, value1, value2, type, position);
And every few days I needed a new parameter passed to the Item object, making the syntax bulkier and bulkier. Not to mention trying to modify any of those values when you have a list of 40 of those declarations were a massive pain. So, I took all the data and put it into a neat document and wrote a parser for it. JavaScript's Duck typing made this really easy to do. Now, I can easily define items and monsters like this:
weapon
name|steel axe
%damage|6
%durability|5
%min_lvl|5
%max_lvl|8
And the best part is, I can extend the document format and the parser would simply add the new properties to objects due to the fact that you can do this in JavaScript:
object[property] = value;
This simple fact alone has been the reason I am starting to love developing games in JavaScript more and more. But I'm rambling.
Check back next weekend and you'll be able to check Morf out for yourself!
Why use your own format and not JSON?
ReplyDeleteThis question was posed on Reddit as well so please excuse me pasting my answer from there:
Delete* I use JSON every day at my day-job so it would feel too much like work
* I like doing everything myself and feeling completely in control
* I am busy working on a JavaScript game engine (see previous point) and something like this felt like it fit in nicely.