Player Building with Blocks

Blocks Are the Future

Spent a few hours making a player driven building prototype in goblin. Previously buildings were made in more of a ‘mark and build’ system. This prototype is a gamey “blocks” style building system as seen in many popular base building titles. In other words you can snap building components together yourself instead of making blueprints for the game to follow.

While they’re called ‘blocks’ it also includes advanced interactable prefabs. The new thing here is placement and presets made easy to use in game.

Testing 'player-driven blocks' in the floating platform test area

Need to add some polish for UX, but it’s fully functional more or less. Meshes are instanced so it renders quickly and has low resource usage. Also presets are already supported for specific theming per building if desired. Personally I like the wattle and daub style the most for various design reasons. Hoping to do a video with voice over for this later.

We Got This Handled

I’ve finally resolved legacy GameObject usage from script by allowing all related API methods to use handles or pointers transparently. All existing native components and script are now handles based only. Even prototypes have made the change now.

Handles are superior to lightuserdata wrapped pointers in everyway. Handles can resolve dangling pointers, use after free, and many other common issues with little overhead. A handle is stored as a 32bit integer making it easier for script and network layers to safely pass them around for short lifetime use opposed to full on UUIDs.

Player mods and script being handles based only is important for security and stability reasons, but it also saves a lot of time. The self reflection system not only avoids crashes, but tells you where the error is in your code while running live. Often you can live fix and keep on play testing/coding.

Rapid Prototyping Component

CustomComponent is now officially part of the mod API. It’s basically a blank component focused on runtime modification to refine a design of a new component. Once you’re done prototyping it makes it easier to clean up and move to a finished Component/System, and it’s repeatable and easy to tell when something is a prototype. Used this with the player-driven building prototype.

The dawn of Block prototype at sunset

The dawn of Block prototype at sunset

If you are a modder that likes to try a new feature idea while in game this is for you. The real change here is having a known standard prototype for avoiding tech debt and learning to use the engine. Yes, it also updates to the inspector live as you would expect as you append to the instance table.

First Cup Time for a Blog Post