nilFM

hyperkaos

prototype title screen

The HyperKaos Engine is a 2D adventure/puzzle game engine originally written in C++ and then rewritten in C (with the SDL v1.2 library). It features a top-down adventure perspective reminiscent of the original Legend of Zelda (one room per screen), and a host of systems for interacting with the game world.

old prototype room

A Room consists of a background spritesheet (four 320x180 sprites in a vertical spritesheet to enable ambient animation), and arrays of entities like obstacles, people, Sigils (basically targets for magic), Warps, and of course the titular HyperKaos.

Kaos.h file

HyperKaos are event chains, and they are made up of Kaos. The Kaos API is simple. Each subclass must implement run() and destroy(), and their constructors all share the same signature, taking a string as input and parsing it for necessary data to construct the Kaos. The inheritence of the Kaos API is implemented with a void pointer in the Kaos struct and a pointer to a Kaos in the subclass struct, creating a link both ways between the base class and the subclass. When the constructor for the subclass is run, it is responsible for linking the two structs together and assigning the function pointers for run() and destroy().

prototype map data file

Map data is broken in to chunks and loaded on demand when the player enters that area of the game world. Chunk data was originally hardcoded in bufferData(), which was messy, inflexible, and very hard to debug. The new system is to have bufferData() call worldBuilder(), which reads map data from a text file in the mapdata/ directory. This is the reason for having all the Kaos subclass constructors take a single string argument. worldBuilder() checks the type of Kaos to be built and calls its constructor, passing it the args list as-is. The constructor then parses this list for the information it needs to build the Kaos. If any part of the map data file is malformed, the game exits with an error message. Most of the Kaos types defined in Kaos.h are implemented in the mapping/scripting language, but not quite all of them. I've been working on a lot of other stuff, so I haven't been able to get the engine 100% completed.

old prototype textbox intro screen -- scene demo

The Kaos API is so versatile that HyperKaos chains underlie everything from textboxes to the magic system to Scene triggers. The Scene system is simple but powerful, allowing to break out of the top-down Room context to display arbitrarily layered and moving sprites for a set time (they can be skipped if you want, like any good cutscene engine!).

save menu

The HyperKaos chains are also directly related to the save system. Each chain has an ID number which is multiplied onto the save state number when the chain is run. If its ID is 1, it doesn't have an effect on the overall state of the game. If its ID is a unique prime number, it alters the save state, making it a unique product of primes. This can be used to create branching storylines and a complexly changing world. The engine only supports one save slot for now, but you can easily copy and paste save files to bypass this.