top of page
Search

[129] One Over, One Under

  • Writer: Conlan Walker
    Conlan Walker
  • May 16, 2024
  • 2 min read

The scene creation tool is complete, as well as a few under-the-hood engine details.


The main engine change was one that enabled the hotswapping of scene data.

Scenes are quite static things, and the only things that can modify their states are objects. Objects are anything with functionality, really, from a lever that opens a door to a sign that displays text when you get close to it, to water that kills the player if touched.


Tile data is tricky to manipulate directly as the active tiles get overwritten every time a scene is loaded, and scenes themselves are uncompressed at runtime whenever a scene is loaded.


The way around this is to have scenes that act as states. For example, you could have two copies of the same scene that include a lever object, where the only differences between the two scenes is that one of them has a closed door. The lever could be flipped, and the scene with the opened door could be loaded, making it appear as though the door was the only thing changed.


This is the function that required me to tweak how scenes were managed. But now the scenes and their associations can be hotswapped at will.




Moving on to the scene creation tool thing I made.


At the start of the week, the main things that had yet to be done is finishing the parsing of objects, creating the routines that assemble the parsed data into bytes, the routine that writes those bytes to a file, plus some extra touches like error handling for some more edge cases and whatnot.


I also came up with a way to put arbitrary data into objects, since an object's user data is

type-dependent.




Now in Tiled, I put any random junk I want into the scene...

Generate the scene descriptor file like like 2-7 milliseconds...

(I even bound the entire thing to a hotkey!)

And the engine can then read the scene descriptor file it outputs!

I'm quite happy with the resulting average size of the descriptor, as it's at least an order of magnitude smaller than the XML data Tiled outputs to.




Anyway, here's the boring code to the scene thingy:


 
 
 

Recent Posts

See All
[152] Surface Tension

I now have 2 projects going (technically), and on one of them I currently have something that is shaping up to be something resembling a...

 
 
 

Comentários


bottom of page