(Originally posted on Mastodon)

I’ve started working on the system to build machines, which will be a central aspect of the game.

Recording of a game in first person view. The ground is a green grass texture, we can see hills and mountains in the distance, under a blue sky with some white clouds. The player picks parts on a toolbar on the left of the screen, to place multiple beams attached to each other, and adds some kind of a wheel, to make a weird useless contraption that topples down on the ground.

Nothing fancy so far, but I’m making progress. I still need to make wheels that actually roll, add the possibility to lock the direction, and this should already allow building a vehicle.

All in all, I feel this is easier to do with Godot than my first prototype with Unreal Engine.

Here I’m stress testing a bit the system, and already found emergent gameplay out of a single non-resizable dumb rectangular part 😉 You can build a bridge, even though you don’t have the right parts, and also that you can’t (yet) lift or otherwise move your contraption, and deleting parts is not implemented either. Which means you have to find creative ways to tilt the orientation of the thing during construction and be careful about the weight balance.

Video capture of a work-in-progress game in first person view. On a landscape with a green grass texture, under a blue sky with some clouds, the player builds a bridge over a flowing river, by placing identical rectangular parts. At some times, adding parts on one direction makes the structure tilt to a new orientation, allowing to place parts on the other side, etc. The walkway is made of multiple parallel beams, close enough that it's possible to walk on them. Some sections of the video are accelerated.

On the technical side, the system is quite simple. The beam part is a small Godot scene consisting of a rigid body with a box collider and box mesh (placeholder graphics). You can then instantiate this small scene at will. Of course I also have some code to cast a ray from the camera through the mouse cursor to find the point where the part should be placed.

To attach two parts together, I don’t use joints (would be bad for performances and physics engine stability). Instead, I merge the rigid bodies, and add all the colliders as child nodes (and also update the total mass). So, the final bridge is a single rigid body. I still have to write some more code to correctly merge multiple inertia tensors. Godot usually makes these computations for you, but it works only in the case where the matter density is the same for all colliders. Here if I was to attach a lightweight wood part to a heavy steel part, it wouldn’t compute the correct mass distribution.

Another note is that it’s not meant to work that way in the final game, such a structure should not be a dynamic rigid body. You’ll be able to choose if you want your design to be dynamic (like a vehicle) or static (for a building, a bridge, etc.) Either way, you’ll be able to use a common set of parts, to make an articulated vehicle or a hangar door, water lock, or anything you can imagine (hopefully).