↓
iaen.es Devlog Leer en español

Gotic · 3 min read

Treasure maps drawn from the real terrain in Godot 4: Captain Brea's hunt

A bottle on the beach holds a parchment with the coastline, contour lines and an X. Five chests, a compass in pieces and a parrot. The maps aren't hand-drawn: they come from the island's terrain.

#quests#procedural#world#mods#godot

Treasure maps drawn from the real terrain in Godot 4: Captain Brea's hunt

Gotic's island covers about 1.8 km², and nearly everything to do was next to the villages. I wanted an excuse to visit the places where there was nothing, and I found it in a pirate: Captain Brea's treasure.

On the shore of the starting beach there's a bottle. Inside is a map: a piece of the island drawn as parchment, with the coastline in ink, contour lines, patches of forest, a north arrow and a red X, plus a clue ("A stone standing at the top of a meadow, north of the beach where you arrived"). At each site there's a landmark (a standing stone, a cairn, a dead tree, an anchor, a wrecked boat) and freshly turned earth where you dig with R (USAR, "use", on mobile), standing still. The first four chests each hold a piece of compass and the next map. With the compass complete, a needle at the top of the screen points to the last one, on the sandbar island off Caleta, which you reach by wading.

The player in a meadow with Brea, a green and red parrot, on their left shoulder
Brea, the captain's parrot, hops onto your shoulder

Inside the last chest is Brea, a parrot that perches on your shoulder and every now and then squawks "¡Arrr!" or "¡Galletas, galletas!" ("Crackers, crackers!").

How it's built

The maps aren't drawn by hand. Since the island's height is a function of position, each map reads 260 m of the real terrain around the chest and paints it pixel by pixel. Water is blue, darker the deeper it gets; land is ochre, shaded by its slope. Contour lines come from comparing each point with its neighbours:

if floor(h / CONTOUR) != floor(right / CONTOUR) or floor(h / CONTOUR) != floor(down / CONTOUR):
	color = color.lerp(INK, 0.55)
if right < Island.SEA_LEVEL or down < Island.SEA_LEVEL:
	color = INK

If a multiple of 10 m lies between a point and the next one, a contour line goes there. If the neighbour is under the sea, that's the coastline. Some noise on top ages the paper and eats away the edges.

Two details keep it from being trivial: the X isn't in the centre of the piece (each map is offset by a few dozen metres), and the game's main map only marks the area, the centre of the piece, not the X. You have to read the parchment and recognise the coast or the hill.

I chose the five sites outside the game: on land, nearly flat for 3 m around, more than 200 m apart, away from other mods' clearings, and reachable on foot from the start (wading up to 1.2 m).

What went wrong

  • The maps caused a hitch. At 160 px they took about 230 ms on PC when you opened a chest. Now they're computed at 80 px, scaled up without smoothing (hence the pixelated look) and cached: about 70 ms the first time.
  • The first chest landed next to the firefly ruins. The site search had taken coordinates relative to Brumacosta as if they were world coordinates. The test that checks other mods' real clearings caught it, and the site moved.
  • The open chest's lid fell forward onto the ground. It rotated around the back hinge with the angle's sign flipped. A close-up screenshot showed it; now a test checks the lid's edge stays above the chest.

Measured on PC: 30 checks of its own. Mutations seen failing: digging at any chest, carrying on digging after walking away, the needle pointing backwards, a parrot that stays when the mod is switched off. Draw cost at the treasure sites: 55–182 calls.

Still unverified

The full hunt hasn't been walked with the physics: the test teleports the player to each site, and reachability comes from a route computed outside the game. The parrot has no physics; it's stuck to your shoulder. The sounds (digging, chest, parrot) were generated and measured, but nobody has listened to them. And nothing has been tested on a phone.

More from Gotic →