Automatia, update 4
Trains and stuff
Automatia, update 4
Trains and stuff

The last two weeks I’ve been working on something I’ve been talking about for years (to whomever was unlucky enough to having to listen to me talk about the potential of my game).
Block entities
I’ve been implementing block entities, which are essentially NPCs, but with several distinct differences:
- A block entity loads a room, which is a block container that can be created, edited and saved by players. Room files are self-contained and won’t easily stop working.
- Block entity rooms have working light propagation
- Block entities can be walked on by other players and NPCs. This means they can act as trains, general platforms, houses etc.
- Since block entities are NPCs they can have tracks, decision-making and be time-managed, which allows for things like trains going between train stations
- Entities can follow other entities, including tracks, allowing for NPCs as train passengers with things to do, trains with carriages, etc.
- Blocks in block entities can have some world interactions currently, like touch and tick events. There will probably be more in the future, however for now the current capabilities achieve the things I need the most.
- In order to not break my back on this, I implemented parking and unparking of block entities instead of implementing all block logic twice over to add block entity support. Parking realizes the block entity into the world, so that it can interact like with everything normally, as well as be edited. Unparking moves the blocks (including changes inside the bounds) back into the block entity.
In the future it shouldn’t be too hard to make block entities player-controllable, so that you can make a mobile home. Entities can move between worlds, including block entities and of course players.
I can’t remember the last time I did something as complicated as this, and the complexity isn’t in the entity implementation. It’s in the networking. Making a 16-entity train drive around smoothly is already hard. Then add NPC passengers with tracks and players jumping around, and it has to not be jumpy or janky. At the start I had so many issues with stuttering movement that I almost felt seasick.
There is a lot of unknowns and complexity to deal with still.
[embed]Block entities have many uses
In the last few days I’ve implemented support for building NPC tracks for block entities, where I’ve made it easy to park, unpark and rotate them. However, I don’t think it will be easy to use parking as part of routines, because when the server adjusts the routine according to game time, it‘s not going to unpark the block entity for us. So, that means that most likely I’m not going to pursue further the idea of parking trains as part of routines, which is probably for the better. I’ve slowly added more ways for block entity blocks to interact with the world anyway, and at some point a threshold will be reached where it’s good enough.
On the other hand, parking is still interesting for players. Players will want to have mobile homes they can drive around, park, modify and then unpark again. So, the feature is still very interesting for that, as well as for testing and quick iteration.
Mobile player ships
This feature is probably very close to being next. It’s currently possible to do all the things one may want to with block entities, including even persisting changes. What’s not obvious is what happens if you park it (and realize the contents), and the shut down the server. The first thing that comes to mind is to unpark the entity, which repopulates the internal room structure and then save it to disk. This is already supported and could be a quick way to get started.
Steering the ships will have to be a feature of its own. Not sure how to go about it yet.
While players can collide with the world, the ships aren’t ready to collide just yet. For one, programmed block entities have no business colliding and it’s just wasted CPU-spinning. So, world collisions is probably only enabled for some select types of block entities, like player ships.
Trains
Trains is probably the most worked on feature so far with block entities. While moving platforms is a simple and effective way to add some platforming, trains are a whole other thing. For one, how to deal with rail? Is rail even interesting? Railways are a good way to control where a train goes by making a continuous path along the terrain, and there is no ambiguity in where a train is going, or where it should sit on the terrain. But there are many other ways to make trains. Trains that move across distances but evade terrain — that’s what I’ve made thus far. It just goes above the things in the way, instead of around. Another idea I’ve had is trains that remove things in their way and effectively tunnel themselves to the destination. I think that’s an interesting idea worth checking out, because I have an easily modifiable terrain. One interesting problem with that is how to deal with sub-sea tracks, glass cages? You might say, what’s the point? The point is that I have an infinite world with editable terrain — I can do cool things like a train that never stops, and give the player a way to get back on the train. Why not? It’s my game.
Track and platform building
I’ve made an entity track builder in the script to more easily make platforms:
#include <entity_track_builder.hpp>
static void createProgrammablePlatform(NPC platform,
dvec3 posA, TrackTime timeA,
dvec3 posB, TrackTime timeB)
{
EntityTrackBuilder builder;
builder.addPoint(posA, timeA);
builder.wait(TrackTime::fromHM(0, 10));
builder.addPoint(posB, timeB);
builder.wait(TrackTime::fromHM(0, 10));
builder.addPoint(posA, timeB * 2);
builder.applyTo(platform, {
.speed = 1.0f
});
}
Which can be used like so:
NPC platform {sys_block_entity_spawn(
"mod/std/rooms/floating_island1.room",
-70.5f, 100.0f, 82.5f, 1)};
createProgrammablePlatform(platform,
{-68.5, 90.0, 105.0}, TrackTime::fromHM(0, 0),
{46.0, 120.0, 135.0}, TrackTime::fromHM(0, 30));
And that’s all that’s needed.

The tiny floating island is going in between two big islands
Other
I also scrutinized the fog shader, and made a tweak that made things like the jungle quite nice now:
[embed]A small tweak to the fog improved the jungle
There are now public builds of the game here: https://github.com/fwsGonzo/automatia-releases
Note: The game is under heavy development and a lot of foundational structures are still changing to accommodate new gameplay. This means that the database of your persisted world might be incompatible with newer versions over time, and upgrading could require a full world reset.
-gonzo
메타데이터
- post_id
- 5bea03694eae
- slug
- automatia-update-4-5bea03694eae
- url
- https://medium.com/@fwsgonzo/automatia-update-4-5bea03694eae
- canonical_url
- https://medium.com/@fwsgonzo/automatia-update-4-5bea03694eae
- author_url
- https://medium.com/@fwsgonzo
- status
- ok
- fetched_at
- 2026-06-20 20:29:01