Back to all writing

My Mafia Game Had a Beach You Could Fall Through

Game Dev Series•Part 8•7 min read•By Mikhil

There's a particular kind of humiliation reserved for somebody trying to build a mafia game: discovering that the most dangerous thing in your criminal underworld is the beach.

Not an enemy. Not the police. Not some elaborate system I spent days planning.

The beach.

In the previous Block by Block update, I'd stripped the first region down to its terrain and roads, only to discover that the rebuilt foundation still wasn't reliable. That was already frustrating. But the next few revisions turned a vague problem with the ground into something wonderfully specific.

I could see the sand. I could walk towards the sand. And at certain coastal corners, my character could fall before even reaching the bit of beach that was visibly there.

Apparently, my fictional city's shoreline had a trapdoor.

First, the ocean had to stop living underneath the city

One of the earlier terrain problems came from how the world had been assembled. The ocean was a large surface, and the land was supposed to sit above it. That sounds completely reasonable until you develop a gap in the land.

A missing piece of terrain doesn't necessarily look like an obvious missing piece of terrain. It can look like water occupying a place where a street should be. Suddenly you're not sure whether you're debugging the coast, the ground, the collision, or all three.

The next revision changed that relationship. The water geometry was cut around the land instead of continuing beneath the entire region. At the same time, the eleven proposed roads were brought into a more consistent set of surfaces, with their asphalt, curbs and sidewalks meeting without overlapping all over the intersections.

On paper, that was progress. The map's different layers were starting to agree with one another.

The coastline was still the part I couldn't trust.

Then an ordinary piece of interface code got in the way

There was another interruption before I could properly judge the world. One build had a script issue involving the little on-screen display that reports information about the region. It referenced a road-count function that wasn't actually defined in the road code.

The fix was small. The lesson was less small.

I was concentrating on ocean geometry, road surfaces and physics, yet a mismatch in an unrelated interface script could stop the scene from loading correctly. A valid coastline does not help much if you can't get into the game to stand on it.

We corrected the reference and added a targeted check for that sort of mistake. The landmass and road layout stayed as they were. I didn't want to keep redesigning geography every time another part of the project broke.

Then I got back to the problem you can't diagnose from a tidy overhead picture: what happens when a person actually walks around.

The sand was there. The floor wasn't.

A beach has at least three different identities inside a 3D game.

There's the beach you see: sand extending from the land towards the water, changing height and colour as it approaches the sea.

There's the beach you stand on: the physical surface the engine uses to stop your character falling.

And there's the boundary the game uses to decide when you've entered the ocean and should be recovered.

Those three things should tell the same story.

Mine didn't.

At certain corners, the visible sand extended farther than the boundary that the player's water-recovery logic considered safe. So simply moving towards the beach could make the game behave as though I'd already gone beyond the island. Some of the coastal faces also had the wrong orientation for the physical surface, and long shoreline segments made the transitions around corners less dependable.

From a distance, none of that announced itself. The shape of the coastline looked plausible. The terrain passed mathematical checks. The beach was visibly present.

But the character didn't care that the geometry report looked reassuring. The character needed an actual floor.

That was the moment the issue finally became clear to me. A believable world is not just what the renderer draws. It's what the player can physically believe.

If a staircase looks climbable, I should be able to climb it. If a doorway looks open, I shouldn't hit an invisible wall. If a beach looks walkable, approaching it shouldn't send me through the planet.

Fixing the beach meant making its boundaries agree

The repair in version 0.11.4 wasn't a new map, and it wasn't another attempt to make the world bigger. It was a focused change to the shoreline itself.

The coastal surfaces were rebuilt so the sand and the ground used consistently oriented geometry. Long stretches of coast were divided into smaller sections, making the slope around corners less abrupt. The visible beach and its collision surface were made to follow the same shape.

Just as importantly, the game's ocean-recovery behaviour stopped treating the end of the original land outline as the moment the player had fallen into water. The sand actually extends beyond that outline. Being on the beach should not be interpreted as drowning.

The result was a gentler transition from land to sand, then towards the submerged shoreline. It made sense both to look at and to walk across.

This was not a glamorous change. No shiny new shops. No cinematic lighting pass. No dramatic criminal empire reveal.

It was me trying to make sand work like sand.

And after testing the revised build, I could finally confirm that the particular shoreline collision issue I'd reported was fixed.

That felt considerably better than another green validation table.

The tests weren't useless. They just weren't enough.

I don't want to make this sound like automated checking was a mistake. Quite the opposite.

The coastline repair came with checks for things like missing geometric coverage, face direction, coastal corners and transitions between the visible shore and its physical representation. Those checks help catch mistakes before they become another broken build. They're useful precisely because I don't want to walk every metre of terrain after every tiny change.

But a static check answers a narrower question than a playtest.

It can tell me whether geometry has gaps under the conditions it knows how to inspect. It cannot automatically tell me whether standing in a particular place feels right, whether a slope is awkward to traverse, or whether an edge that looks safe actually behaves the way I expect.

Earlier versions had already taught me that distinction. This bug made it impossible to ignore.

My job isn't to choose between code checks and walking around in Godot. I need both. One catches structured mistakes; the other catches the uncomfortable little realities of being inside the world.

And, occasionally, one catches a beach trying to murder me.

The map is better. The city is still nowhere near finished.

I want to be precise about what this fixes.

The specific coastal fall-through problem is resolved in the tested build. The larger landmass and connected road layout have been preserved. That's a meaningful step because I can stop treating the entire region as disposable every time the terrain behaves strangely.

It does not mean the roads are finished, the streets look beautiful, or Block by Block has suddenly become a functioning criminal underworld. This version is still a stripped-back environment. Its next visual and physical passes have plenty left to prove.

But there's something satisfying about reaching the point where a fix can stay a fix. We didn't need to throw out the coastline again. We found a specific disagreement between what the world showed and what its systems believed, then repaired that disagreement without rebuilding everything around it.

For a game about a world that should react believably to the player, that's a useful place to start.

My mafia game still doesn't have much of a mafia. But at least the beach has stopped betraying me.