Mommy's Best Games, Inc. is an independent game developer founded in 2007. Our seventh game, currently in development, is Pig Eat Ball on which we started working in 2013. This is behind the scenes thoughts about game development and marketing.


Wednesday, October 16, 2013

Reflections and Pig Eat Ball Level Editor Progress

The Level Editor is shaping up nicely now for next game Pig Eat Ball. All written using Java and LibGDX.

This shows the basic controls and capabilities. We have some advanced placement tools in the works as well for the next update. I'm planning on possibly releasing the editor with the main game, assuming I can make it friendly enough to use.


 (Primer: Reflection is a language ability which allows for code to recognize class types *within itself*. It allows for extremely generic programming, perfect for dumping new classes into an editor and having the code sort out all the new variables and how they save and load and can be edited.)

I guess it's a keyboard with mirrors in it? Looks awesome either way.

On the code side of things, not using reflection was a bit of work, but I think because I was worried about how well-supported reflection is in Java, and because I was worried about portability to Linux, Mac, and Android, I decided to "hand-code" things.

That means, when we add a new class type, like a ball spawner, if there are specific variables that you can edit when you select the ball spawner (such as spawn type, or number of balls spawned), then all of that code has to be written by hand. That includes the Info box populating with the specific entries, the saving/loading and a bit more.

On the right is the BallSpawner selected. "SpawnType" and "SpawnCount" are special variables.

It's a pain but the usefulness in the editor is amazing. It means you can place specific objects, and modify behavior on each object in a class-specific way. Plus once you get the format down in the code, it only adds a few extra minutes to adding a new class. It's just a lot more complicated than carefree reflection code I was used to in XNA and .NET.

No comments: