Holiday Jam

published on

Let's flesh out some basic systems in Godot 4.1 and see what's new.

Entity - Player / NPC

Inheritance vs composition got me here, I must have changed it up a few dozen times. I ended up with a single minimal entity class to pull in stats, inventory and other shared bits then used tunable composition nodes on top. Having the character controller swappable made this work for the AI controller to do navigation and the player to pull in camera direction.

Dynamic terrain with interactive instanced foliage

I used the MeshDataTool to generate terrain privatives based off of a noise resource, then overlayed areas of interest that could be flattened and a secondary map that can be painted on to modify the base noise. On top of that I spawn an array of MultiMesh instanced foliage with a shader that takes in some global uniforms for displacing based on player location.

I ran a few tests with multi-million mesh fields without issues, but segmenting them for frustum culling really made these work well. In the end I bailed on generating the grass procedurally and painted them in with some @tool ray cast editor scripts, there are a lot of gotchas with those but they are an incredible amount of fun to use.

Ability system with targeting

Tab targeting to nearby enemies and destructible props, then activating them. Resource scripts seem similar to scriptable objects in unity and came in handy here, easy to swap out a spell projectile with something more interesting with just a few changes.

Interaction with objects

Similar to targeting but using player proximity on a different layer, crates and food can be interacted with if you are close and they define their own behavior. Food gives you mana, crates get hit for a small amount of damage and eventually break open with their randomized inventory. 

Procedural roads with dynamic navmesh

I wanted to explore more of the tool scripting flow, the road is easy to move around and sculpt and has a few triggers for snapping all points to the terrain inside the editor. Navmesh is baked dynamically on runtime and has a lower enter cost to try and force AI on to the path. It's fun to sculpt but there are some collision issues that ended up being a post-processing fix, once you get the path where you want you tap a tool button to smooth the curves and bake down the new mesh. Not as streamlined as I hoped but a fun tool to use.

Inventory with slots and drop tables

I added a basic inventory that can be shared and randomized between the player, npc and containers. 

Randomly Generated "Dungeons"

Generating room positions on a GridMap3d, running A* to connect the rooms using the nearest node, then adding mob spawners to the rooms. Navigation and world collision is bundled into the tiles. This is using the simplest version I could hack together in an evening, adding more interesting room shapes and height would be fun. Looks like I need to go down the dungeon generation rabbit hole.

Portals, Inventory and Saves

Swapping out the scene and using the threaded ResourceLoader, save files are bare bones json with objects tagged as persistent saving out their own data it feels pretty clunky, but it works. inventory is going to need some work, the script hurts to read.

Next up? 

We need some art and animation, this is some pretty bashed together crud but I ran out of time. I'll get sketching.