Multi-tile Creatures and Vehicles

2024-09-17

In the game I'm prototyping, which is a 3D Roguelike, multi-tile creatures and multi-tile vehicles are essentially the same thing.

This post surveys how they should be implemented, particularly, how their movement should be implemented.

Goals

Move all parts together

This also means, whenever a single part cannot be moved, all parts should be prevented from moving.

Have Faced Direction

Multi-tile things are big, so their faced directions matters.

Moreover, their XY plane is not limited to just squares. So we can have 3x2 too. In this case, faced direction matters a lot.

Moves on uneven ground

So if the ground is varying on the height grid by grid, the multi-tile thing can moves on top of it.

Things on it should move together

This is more relevant for vehicles; maybe monsters too!

Optional: Different parts have different defense

Inspired by monster hunter!

Optional: Some actions are produced from some specific parts

Fire Beams, etc

Case Study

Let's consider some edge cases:

Moving on a flat plane towards a single block obstacle

The object should be blocked by the obstacle, or destroy it!

Moving on a flat plane with some small holes

The object should be able to do that, as long as the holes are not significant enough

Moving on an uphill

This basically means: compared to the first case, in which cases should the altitude of the object be increased?

Moving on an downhill

This is the reverse of the previous case

Failing onto an uneven plane

For example, 3x3 creatures fall onto a plane with an obstacle in the very center

Implementation thoughts

Let's call the tiles of these entity parts from now on.

To move, a valid candidate position requires at least one of the bottom parts stand on blocks. For 4-leg monsters, this means their 2 front legs stands on the upward hill, or 2 back legs stands on the downward hill.

Otherwise, the position is not valid, and trying moving into this position fail, i.e blocked.

Also, if the blocking obstacle is not fixed, for example creatures, based on some stats they are kicked away.

Turning around is basically the same.

For simplicity, there should is no automatic climbing.

Reference