Blog

The Paths More Traveled

Posted

In working on Stop Shoving!, one of the earliest problems to solve (or at least one of the earliest ones I’ve decided to try solving) is pathing and collision behavior. The title alone should hint that simulating this will be a central mechanic of the game.

In Godot, the engine I’m currently using to develop the game, basic agent paths and collision detection are generally straightforward for RigidBody3D and CharacterBody3D nodes. A lot of the math that developers of yore had to wade through directly is almost completely hidden from a modern gamedev. But they’re designed for things like a weapon or projectile hitting a target, a mob touching the player, walls and other scene objects not letting the player simply pass through them, and so on.

They aren’t designed to fully and transparently automate what I have in mind. Randomly spawned NPCs selecting from a variety of locations they want to navigate to, some of which may be occupied presently or by the time they arrive, as well as steering clear of all the other NPCs around them doing the same thing (sometimes to the same sometimes to other locations they’ve chosen). All in a terrain that may be changing around them. Bridging that gap isn’t too much of a burden and isn’t going to require too much more than checking bounding areas around destination positions for existing occupancy and casting rays about to detect and avoid impending collisions.

But what they definitely aren’t designed for is to have some of those NPCs angrily shoving others, some of them pushing back to avoid being thrown into undesirable spots, pairs of them doing that awkward sideways dance[1] we’ve all done on the sidewalk when neither party can figure out which direction to shift to get out of the way, and so on. There’s also no confusion or indecisiveness properties I can just slide values around on, but people navigating public spaces frequently exhibit varying degrees of both those things, and the envisioned gameplay loop most certainly has those playing important roles in NPC behavior.

Who hasn’t stopped dead in their tracks in the middle of the sidewalk, thrown into a deepening spiral of ennui and wondered, “Do I really want to go to work today?” Or turned themselves around half a dozen times looking for a departures board in the main hall while half the city runs and shoves their way past. Maybe stood on the wrong side of the platform only to realize the mistake two seconds before the doors to the train we intended to board close 5 meters away.

The engine will of course support all of these things, but it’s going to take a lot of custom work with the colliders and physics engine. And so much vector manipulation. Speaking of which, enough rambling, I need to go figure out how to apply a Rudeness Coefficient to a Vector3.


  1. I believe it’s formally called the Sidewalk Salsa. At least by a few of the research papers I’ve been studying. ↩︎

Reading List

Entries are not endorsements of every statement made by writers at those sites, just a suggestion that there may be something interesting, informative, humorous, thought-provoking, and/or challenging.