Colonists Can Sit on Toilets

When a mechanic fixes a generator he has to walk up to some location on the generator and do something.

But what does it mean to “walk up” to a generator, and where does the colonist actually go?

These are the sorts of things that I have to deal with.

This is my story.


Access Positions

The first issue to solve is: “Where does a colonist go when he wants to interact with an object?”

Our solution is to mark specific locations on each object that a colonist can walk to. We call them “access positions”.

The medical bed has 2 access positions: one on each side. A colonist will always walk to an access position before “using” the bed.

Medical bed access points.png

Closest Access Position

Most objects have multiple access positions, like the medical bed.

It would be weird if a colonist took a longer route than was necessary to use an object. Ideally, the closest access position is always used.

Let me just show you.

Here’s a medical bed with 2 access positions and a colonist who desperately wants to go to sleep.

 The path to the closest access position is in red

The path to the closest access position is in red

I’ve drawn a path to both access positions (using colored carpet). You can see that the “blue” access position is slightly further away than the red access position, so the colonist will walk to the red one.

Internally, we generate pathfinding routes. Whenever a floor is added to a possible pathfinding route, we check to see if it matches the floor of the access position. If it does, the route has succeeded and we store that access position (we’ll need it later)

A simplified version of the code might look like this:

 
void AddFloorToRoute(Route route, Floor floor)
{
    route.Add(floor);
            
    foreach(AccessPosition accessPosition in allAccessPositions)
    {
        if(accessPosition.floor == floor)
        {
            route.foundAccessPosition = accessPosition;
            allSuccessfulRoutes.Add(route);
            break;
        }
    }
}

Access Position Rotation

Once the colonist arrives at an access position, we rotate him/her towards the object.

This sounds obvious, and it is, but it’s not an automated process. We have to manually provide rotations for every single access position.

If you scroll back up to the medical bed you’ll notice that the access positions are actually pointing at the bed. This to prevent the colonist from putting its back (or side) to the bed before getting in.

Special Access Positions

Colonists go to objects for a few different reasons. A mechanic might need to inspect a generator. A laborer might be delivering resources. Or a colonist might be sitting in a chair.

It would be weird if a box of ore was dropped off in the same location that a mechanic fixes an ore refinery. So we added unique locations that are used for different purposes

Here’s an ore refinery:

 An ore refinery has 3 access positions

An ore refinery has 3 access positions

There are 3 access positions on an ore refinery.

From top left it goes:

  1. Terminal (inspecting/fixing)

  2. Raw ore drop-off

  3. Produced metal pick-up

This adds a small extra step in pathfinding generation. We manually provide pathfinding reasons, and then we filter out invalid access positions.


By the way, the ore refinery is an example of why we can’t automatically calculate the correct rotation towards an object—it’s simply too large. From the bottom right access position, the angle towards the center of the ore refinery is probably around -30 degrees or so. This caused the colonist to look left (instead of straight) when arriving at the refinery.

Mounting Objects

Colonists can also “mount” a few different objects: chairs, beds, toilets, etc.

To “mount” means to teleport to a static position on the target object. It would be weird if a colonist slept at the bottom of a bed or appeared to “hover” above a chair.

Once again, let me just show you:

 A nerdy colonist mounts a chair in order to read his favorite book

A nerdy colonist mounts a chair in order to read his favorite book

On the left is a chair. On the right is a colonist mounting that chair.

And also once again, this seems obvious, of course a colonist should be positioned appropriately on a chair. But someone has to manually provide that mounting position. The unsung hero of game development.


Colonist can mount more than just chairs and beds. Here’s a colonist mounting a fountain and doing whatever it is that a colonist does when it mounts a fountain.

 Fountains can be mounted

Fountains can be mounted

By the way, just like with access positions, we have to provide a rotation when a colonist mounts something. In the previous image, it would have been weird if the colonist was facing the center of the fountain (because of clipping and possibly drowning)

Setting up mounting positions is also incredibly tedious, because colonists are 2D sprites that love to clip into 3D models.

FREEEEDOM

An actual unsung hero of access positions is that they give the player more freedom when placing objects.

We add seemingly redundant access positions to objects so that you can place beds against walls, beds next to other beds, and chairs next to tables. As long as 1 access position can be reached, the object can be used by a colonist

Here’s an example. The bed (non-medical) has an access position on both sides and at the bottom, for a total of 3 access positions.

 The bed can be placed against a wall and the colonist can still find it

The bed can be placed against a wall and the colonist can still find it

It’s difficult to see, but there’s a green access position poking out of the wall. A colonist will use 1 of the 2 available positions when using that bed (whichever one is closer).

We don’t want the player to worry too much about where to place objects for optimal pathfinding. Just place a bed and make sure that there’s some sort of route to them.

That’s It

That’s it for access positions and mounting, but we actually have some new art to show you (it’s been a while).

Cafeteria Chair

You already saw this in the mounting section, but Victor converted the sprite cafeteria chair into a 3D model.

Cafeteria chair old vs new.png

The sprite chair has been with us a for a long long time. I think it was the oldest art asset in the game actually.

Here’s a really old picture of the game for proof. This was taken in early 2016. Back then you actually built your station room by room. It was a simpler time.

dinner is served.png

New Toilet

We finally have a 3D toilet too. This is what the Kickstarter money goes towards. Toilets.

Toilet Model.gif

That’s Really It

Ok, that’s really it this time.

We’re getting closer to Alpha every week (and as we get closer I can spend more time writing posts and less time frantically trying to get everything working). We’re still not sure when it will be released.

It’s going to be a closed Alpha. If you aren’t already in the Alpha, you can’t get in. We honestly want to use the Alpha for testing, not for “Early Access buy the game and play right now”

In the meantime, play some other game that’s already fun and finished.

And yes, you can consider those official endorsements from 1 person in the Starmancer Development team.

Thanks for reading, everyone.

-Tyler

p.s. I just heard about a new Chucklefish partnered game, Inmost. It looks awesome and you should check it out.

gif11-1.gif