Lacking Structure, I Strive For Unity

On second thought, lets not chicken out and return to GameMaker simply because I was intimidated by the awkwardness of using a powerful open source API like LibGDX.  I have decided to try the middle ground of another specialized game making IDE that still has a WYSIWYG editor, but a lot more robust code support: Unity.

Half of the deciding factor was discovering Timber and Stone, a game made in Unity.  I looked for examples of GameMaker games that could handle large maps made of interactive tiles, and could not find any.  Yet, several such games were created in Unity, with Timber and Stone being a significant example to me.  It suggests to me that GameMaker just can't handle as much data as an interactive tile engine requires.
Timber and Stone, a well wrought hybrid of Dwarf Fortress and Minecraft, currently in early release.
I did think of a workaround that might work in GameMaker.  Basically, I would circumvent the limitations on the number of GameMaker objects that can be instanced (as custom interactive tile objects) by utilizing a "chunk loading" system, similar to what's seen in Minecraft and Cataclysm: Dark Days Ahead.

Under such a system, I would be perpetually deleting and recreating GameMaker objects as needed, potentially swapping their data to disk, with a goal of keeping the area utilized by the player populated with tiles at all times.  This would work well with most of GameMaker's integrated functions, which are built to be utilized with instanced GameMaker objects.

However, this "workaround" actually just manifest the other half of the deciding factor that made me decide to go to Unity.  Because GameMaker lacks custom data structures, it has a critical limitation in doing the kind of variable work involved in a "chunk loading" system, making one needlessly difficult to implement.

Data structures are basically several variables that are grouped together for easier handling by the developer.  In the case of a game with interactive tiles, it's vital to lump everything about that tile together in an easily-retrievable package.  So I am going to need some kind of data structure to keep track of all of this.

When it comes to data structures, GameMaker would appear to offer only two choices:
  • A selection of a few premade data structures with a robust selection of built-in methods.
  • Objects, which can technically become custom data structures because you can define your own variables on them, but they need to be instanced into rooms in order to hold data.
A critical limitation of GML is that neither of these choices allow you to create custom data structure methods/functions.  However, you can write your own scripts that can essentially be those methods.

GML mainly lacks in object oriented encapsulation.
Under this limitation, big data work starts to get complicated really fast:
  • Creating script files to get around the lack of object oriented encapsulation (and other limitations of GameMaker's "imitation" objects) creates a lot of file bloat and opens up the programmer to be confused about which script goes with which object.
  • Objects need to be instanced in a room to hold data but, under GameMaker's design, you cannot access instances from other rooms.  The only way to preserve the use of the object as a custom data structure is to set it persistent, which means it will follow you from room to room, but this creates a number of potential logistics problems, such as:
    • Errors related to nullified object variables that were referring to things in the previous room.
    • The potential to accidentally create redundant persistent objects by returning to rooms where they were first created.
    • If you assigned a sprite to the persistent object you were using as a data structure, you need to make sure it's moved out of the way of the players' view when going to the next room, and move it back when you return.
  • Because objects must be placed in the room to be instanced and hold data, its presence in the room will keep it in scope.  This means if you destroy whatever was using that object as a data structure, the object will hang around and take up hardware resources unless you remembered to delete it. 
In the end, GameMaker would seem to be designed to deliberately discourage its developers from creating custom data structures.  If they wanted developers to have custom data structures, they would have made a way to do in variable form.  The only thing that can be a reasonable stand-in data custom structure, GameMaker's imitation objects, are greatly limited where they can be instanced and accessed.  Further, by hard coding what functions are directly associated with these objects, they have forced developers to utilize them in specific manners.

That said, it is not that what I was trying to do was impossible in GameMaker.  The scripts do offer a lot of potential flexibility.   In all fairness, a good programmer can manually implement something like a custom data structure by just keeping all of the involved variables and functions straight in their head.  However, just because it's possible does not mean it is easy, and the way GameMaker seems built to encourage use of its built-in functions is what suggests to me that I am in the wrong to try to go outside of that.  It's probably to try to encourage good coding practice or something.

Unfortunately, I can't figure out an elegant way to do a large-scale interactive tile game with these limitations, so I guess I should move on to something that does not want to resist the scope of my project.  Unity probably can, as the C# implementation of its scripts is very much capable of supporting custom data structures.  If that does not work out, I could always try an API such as LibGDX, based on JAVA, a language all about object orientation.  For now, I've been taking a Udemy Course on Unity and, the more I dabble, the less alien it seems to me.

My Gaming Lately.

On an unrelated note, I should probably apologize for my last entry (about Elite:Dangerous) because I'm still playing a fair amount of it.

I traded my Python in for a Fer De Lance, and the specialized combat ship is preventing my min/maxing sensibilities from returning immediately to boring mining.  It is definitely a more entertaining game when I stick my neck out in space combat.

Although the most efficient way to make money would probably be to hunt the endless pirates who spawn in hazardous mine fields, I find it more entertaining to play a valiant space hero, on the lookout for distress calls.  Either way, I find myself limping back to a space station with a blown out canopy quite often, which is great for the adrenaline.

I still have a hard time recommending the game on account of how much of a content-thin grind it is, many of the newly added bulletin board missions are bugged, and it's probably still a valid critique that the capital ship encounter teaser video (not to mention the launch trailer) is far from what's being delivered in game.

Basically, this is a game I play to get away from reality, because its attention to immersion is incredible.  However, what a sad little reality it is until they can start adding more substance to it!


Popular Posts