The Transient Project

No Lazers. But there are little tiny squares!

The game can load data from “mission files”! Huzzah! It’s taken roughly 7 or 8 hours to get this far.

It has taken that long because I spent most of today working writing code that checks for possible errors in the JSON input for the mission files. However, I also spent time developing a framework for the individual objects themselves.

Each kind of object distinct enough to warrant it’s own class actually gets two classes. One is the class itself, and the other is a Factory class. The Factory class has only one method, and that method’s sole purpose is to create a an object of the first class.

This allows me to register a Factory object with the game model under a certain name. Then, while the game model is parsing the JSON input, it can call the right Factory class (with arguments from JSON) to obtain an instance.

The point of doing this was to avoid a bank of if-else-statements that I would have to continuously update in order to add new kinds of game objects. We’ll see whether it actually saves any typing in the end.

The other cool part of this game’s technical architecture is that I have stayed away from game objects that have both an update() and draw() method. The views get all their information about objects from receiving events that the game model publishes. Right now, there’s only an initialization event, but it’s a start.

Published by spirulence, on June 4th, 2012 at 8:53 am.

Filled under: Development,Space Lazers. | No Comments |

Leave a Reply