Nirion»Blog

Update #6

Ben
Since my last blog post I've made some progress across a number of different areas of development. My last post here was a video showing off the music I've created for the game so far, which I got some useful feedback for. If you're interested, check it out and let me know what you think!

I decided to move on after creating some music tracks for the game areas I've created so far. There's obviously still a lot more work to be done on the music, so I'll revisit it in the future. I tend to do a lot of work on one aspect of the game(programming, music, art, level design etc) for a relatively small amount of time until it's passable and then come back and iterate on it at later times. After completing a reasonably polished demo I decided it was time to move onto the second area of the game.

Lava Caverns

The next area of the game is a lava themed area that's called the Lava Caverns. It has the ruins of ancient temple like structures throughout it, but also more natural looking cave structures, and even some more advanced technology which has, in the lore of the game, recently appeared. For a couple of weeks I developed a lot of the art for this area as well as some of the gameplay mechanics that will be unique to it.

Here is some of the earlier art as I was developing it:


Some more up to date art:


Like how the mines had the minecart pushing gameplay mechanic, the lava caverns has block pushing puzzles. This was fairly easy to implement since it mostly just uses the the physics and collision detection system. Blocks can pushed around freely(not aligned to any sort of grid), can only be pushed around the "sand" like path that they're on, and can only be pushed and not pulled. Collision entities that only interact with push blocks are spawned at the sand-dirt transition tiles. This keeps the block locked on the sand so that it cannot be moved around the room freely. Personally I think the free and smooth movement of the blocks makes the puzzles a lot more fun to interact with.

There are also different types of blocks. Some that can only be pushed along a certain axis and some that are immovable.


One problem I encountered was with how to separate blocks that were pushed together and therefore can't be separated without a pull mechanic. I wanted to avoid a pulling mechanic since I don't think it would really suit the game and how the player moves around. After trying a few things I decided on having the player be able to separate the blocks by moving "in between" them:



Hopefully this is intuitive enough for someone to try if they're in this situation for the first time. I think it's pretty natural to try to separate them this way if you feel they're stuck, but I guess I'll have to see how it goes once more puzzles are designed and I can get more people testing the game.

I also spent a bit of time on drawing and programming a couple of new enemies.



Meta Programming Update

After I did this work on the new area, I decided to work on cleaning the engine up a bit. I'm not happy with how a lot of the code is right now. Quite a bit of the code started out as just the simplest solution possible to get something working, but I never got around to updating it as the game got bigger. Some of the things on my list are improving the renderer interface, improving the editor(I don't even have a search bar or any sorting, but have +100 entities!), improving debug code, fixing and expanding undo/redo for the editor and finishing some aspects of the asset system. Probably the worst offender though is the code that parses the project and generates introspection data.

This part of the code basically just scans over every C++ file in the project and looks for special macros like "PROPERTY" or "ENUM" which are used to annotate parts of the code. It then outputs data that can be used for introspection. This is used in a few places like the editor for displaying entity properties and the serialization code. The problem with the current system is that it's pretty hard to add new features or even new flags to properties since it's all very hard coded and doesn't really build a proper representation of the program structure. It just parses what it needs(crashes if it encounters anything it can't deal with) and uses a bunch of string manipulation to output some C++ code.

I've been working on a better solution for this over the last few days. Inspired by Ryan Fleury's Data Desk, I'm working on parsing a custom text format into an AST that is then manipulated before being translated into C++ code. So far this is turning out to be a huge improvement. It's much simpler to add new features and way less lines of code to implement. It's still got a long way to go, and replacing the old system in the game code will be a ton of work, but I think it'll definitely be worth the effort in the long run.

The custom format will look something like this:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
@Introspect
struct MineCartEntity
{
     MineCartType type;
     
	 @HideInEditor
     i32 nodeCount;

	 @ArrayCounter=nodeCount
	 @Spline
     v2 nodes[24];

     f32 friction;
     f32 maxSpeed;
     
	 @HideInEditor
     i32 wallSegmentCount;
 	 @ArrayCounter=wallSegmentCount
     MineCartWallSegment wallSegments[4];
     
     i32 startingNode;
     
     MineCartState state;
     
     f32 tPosition;
     f32 tVelocity;
     f32 trackLength;
     PlayingSoundReference armedSound;
};

TagData EntityDefinition
{
	@hash="MineCart"
	@type="ET_MineCart"
	@func_Default="EntityDefault_MineCart"
	@func_Update="EntityUpdate_MineCart"
	@func_OnDamage="EntityOnDamage_MineCart"
	@func_Constructor="EntityConstructor_MineCart"
	@func_OnBlock="EntityOnBlock_MineCart"
}


What's Next?

After I've finished with the metaprogramming/code generation system I'll probably move on to cleaning up some more parts of the code. I think that will keep me busy for a pretty long time. Once that's done though I'll continue working on more enemies, art, level design, puzzle mechanics and eventually get back into music composition. Thanks for reading! As always, let me know if you have any questions about the game!
about separating the blocks you may wish to add a puzzle where the only solution is to separate the blocks

Because most 2D block pushing games don't have that as a mechanic so it's not intuitive for most gamers used to other block pushing puzzles
Bok
Ben,
Yeah definitely. I think I may have already put one in as the second block puzzle you encounter. Thanks for the suggestion!