Godot 4.6 · Solo project

Ocean Island Survival

This is a survival game I've been building by myself in Godot. You wash up on an island next to a wrecked boat, and you have three nights to find water, make some tools, and build a fire and a shelter before a storm hits. It started out as me trying to make a good looking ocean and it kind of grew from there.

4 kmisland, eroded in Gaea. The land and the seabed are one height map
~305ktrees and plants on the island
80sound effects, all generated by Python scripts I developed
~250automated gameplay checks I can run from the command line

Gameplay

What you actually do

You start next to the wreck in the morning. There's a tutorial and a journal that tell you what you should be worried about next, like finding water or getting a fire going before it gets dark.

  1. Grab rope from the wreck, and stones and sticks off the beach.
  2. Make a stone hatchet and chop up a fallen tree for sticks and logs.
  3. Find fresh water. You can't drink the sea, but there's a spring close by.
  4. Cut some reeds and twist them into cord, then build a fire and a lean-to before dark.
  5. Sleep until morning. Days two and three are about setting up a proper camp and getting ready for the storm on the third night.
First-person view on the beach with health, hunger, thirst, the hotbar, the clock and the current goal
The HUD. Health, hunger, thirst, the hotbar, the time and what to do next.

Environment

The ocean and the island

The ocean, the terrain and the weather all read from the same data. So waves get steeper as the seabed gets shallower, the sand gets wet where the water actually reaches, and when the storm comes in it changes the sea, the trees and how cold you are all at once.

The ocean seen from a hillside above the forest

Ocean

The waves come from an FFT simulation running in compute shaders. I started from an open source ocean addon and modified it, and the shoreline and the look of the water are my own shaders.

  • Whitecaps show up where waves are getting squeezed
  • Waves slow down and break as the water gets shallow
  • The ocean goes all the way out to the horizon and curves with the planet
  • The CPU works out the same wave height, so swimming lines up with what you see
A long sandy beach with waves washing up and a forest behind it

Terrain

I shaped the island with a Python script, eroded it in Gaea, and then baked it into one height map that everything else reads from.

  • Land and seabed in one 2048 x 2048 grid
  • 16 terrain chunks and one collision shape
  • A stream, and a small lake up on the mountain
  • Generated ground textures, wet sand and worn trails
A dark forest at night in heavy rain with cold and wet warnings on screen

Weather and time

Weather and time of day are profiles I set up on top of the Sky3D addon. One script takes the result and pushes it out to everything else.

  • 9 weather types and 4 times of day
  • A full day takes an hour in real time
  • Waves, rain on the water, wind and getting wet all come from the same place
  • The storm on night three is scripted

Survival

How the survival systems work

I tried to keep each system small, with one script in charge of each thing. For example, the HUD shows your hunger but it doesn't keep track of it. Everything drains per in-game hour, and there are four difficulty settings that scale it.

Health, hunger and thirst

Hunger and thirst go down over time, and faster if you're running around. If either one hits zero you start losing health, and you only heal if you've eaten and had water.

Staying warm and dry

The temperature depends on the time, the weather, how high up you are and which night it is. Wind makes you colder, being soaked makes it twice as bad, and a fire or shelter warms you back up.

Inventory and crafting

24 slots plus a hotbar. There are 14 recipes grouped by day, and the game checks you have the right tools and materials before it takes anything.

Gathering and tools

Stuff lying on the ground, bushes that grow back, reeds, rocks and fallen trees. A knife gets you double the fibre, and you need a hatchet to get wood.

Fire and shelter

A fire burns through its fuel, faster in the rain. You can cook on it and relight it with tinder. The lean-to warms you up while you sleep, and you can upgrade it with bedding and reinforcement.

Water, food and saving

The game knows if the water is fresh or salty at any spot. You can carry water in a water skin and cook food or make rations. Save files only store what you changed in the world.

Technical

Some of the technical stuff

  • Waves slow down as the water gets shallower (their speed depends on the square root of the depth), so they bunch up near the beach and bend around headlands. They also get taller until they hit a breaking limit.
  • Water far away uses fewer FFT cascades and cheaper normals. That stops it from flickering, and I'm not paying for detail you can't see anyway.
  • The forest is split into cells with a MultiMesh for each one. Far away trees turn into billboards, and only trees near the camera cast shadows, which ended up being the biggest performance win.
  • The pools on the stream use a small shallow water simulation in compute shaders (the virtual pipes method), so the water actually moves and doesn't lose volume over time.
  • The world is generated the same way every time, so a save only has to store what you changed. The world cache rebuilds itself when the scripts that generate it change.
  • The sound loops are built in the frequency domain so there's no seam when they repeat. The ground textures are generated too, and props like the driftwood and the wreck come from a Blender Python script.
  • Hunger, fire fuel, plants growing back and the story all run off the same game clock. When you sleep and skip ahead, everything catches up by the right amount.
  • I can run screenshot captures, performance tests and gameplay tests from the command line, plus a check that every script and shader still compiles.

Architecture

How the code is set up

There are no autoloads. OceanV2World.gd builds every system in order and connects them with configure() and bind_*() calls and signals. Items, recipes, difficulty settings and so on are just static data classes.

  • Godot 4.6.1
  • GDScript
  • GLSL compute (RenderingDevice)
  • Godot shading language
  • Sky3D (MIT)
  • Ocean FFT addon (MIT, modified)
  • Gaea
  • Blender + Python
  • Python · NumPy · Pillow

If you want more detail, docs/ARCHITECTURE.md and docs/TECHNICAL_OVERVIEW.md in the repo go through it.

Status

Where it's at right now

Playable prototype

You can play through all three nights from the main menu, with saving, settings, difficulty options and an ending screen. It's not a finished game though. I've only tested it on my own PC with an Intel Arc B580. On that, I measured 27 spots around the island at 1080p on High and got between 85 and 215 fps, with 121 fps in the middle.

The GitHub repo only has the code and docs. The addons, art, audio and terrain aren't in there, so if you want to try the game, grab the build from itch.io.

Things that still need work

  • The trees are low poly and look pretty basic up close.
  • Grass and small plants pop in as you walk around.
  • I made a simulated waterfall, but it didn't look good enough so it's turned off for now.
  • The first launch takes about 45 seconds to build the world.
  • There are no arms or animations. The hatchet is the only thing you see in your hand.
  • I haven't tested it on other GPUs or on Linux or Mac, and the developer keys are still turned on.