Website powered by

Cairn - Technical Breakdown - Fishes

I was lucky to work on Cairn as Technical Art Director, I thought it might be interesting to share some of its "development secrets".

This one is about a fishes and fishing gameplay in the game.

More about Cairn :
https://www.thegamebakers.com/cairn/
Reach a summit never climbed before in this survival-climber from the creators of Furi and Haven. Climb anywhere and plan your route carefully, managing pitons and resources to survive the unforgiving Mount Kami. Discover what Aava is willing to sacrifice to achieve the ascent of a lifetime.
© The Game Bakers

At some point, we decided to add fishes in Cairn (mostly for narrative purpose), but we dont want it to be a core gameplay feature and dont want to spend to much time working on it.

At some point, we decided to add fishes in Cairn (mostly for narrative purpose), but we dont want it to be a core gameplay feature and dont want to spend to much time working on it.

For fishes navigation, I wanted something simple so I go for a custom navmeshes:
- I draw a grid of points over my waterplane bounds,
- Do some raycasting and keep only valid ones.
- Connect them (each point have neighbours and parent chunk)

Each fish starts on a random point and finds a target point in point's neighbours.
It moves towards this point and when it's close enough, it finds another point forward, otherwise it looks backward.
Pretty basic.

I've added some other rules to avoid fishes being stuck on water edges over time and go out of waterplane at very high speed.
For me it was very important to simulate all these conditions quickly in editor (time duration and scale).

Here you can see that fishes can jump from one navchunk to another and if they don't jump they stay in their actual chunk.

We have fishes animations but I want rendering to be the simplest one so I go for shader animations only (water do some distortion, most of the fish motion is root motion, we dont need more details).
It's more or less sinusoidal displacement on X axis

Since all animations are done in shader, all fishes can be rendered in one draw call (via gpu instancing) : it's just 1 fish mesh, 1 fish shader, and a bunch of matrices.
No GameObjects instantiation, easier to manage.

Now maybe we can add some interaction ?
First idea was the "Loot fishing", just press A to fish.
Fishes try to avoid player, it was ok, but not interesting enough so we go for another direction : "Hand fishing".

But catch a fish by controlling character's hand is another beast !
It had to be seamlessly integrated to walk gameplay and can be triggered from anywhere. It also means "IK" and procedural animations.

First, we need to detect where player can trigger hand fishing mini-game.
We have a tweakable circle area in front of player and we check by raycasting : "Do we have enough water in front of us?"

Then, everything else is about procedural posing and playground :
- player's hand motion circle
- fish motion circle
- player's hips/spine offsets based on water depth
- etc...
Everything is tweakable at runtime to find what we really want.