Category Archives: Ikke kategoriseret

Fisheyes and lights

Progress on Fathoms has been slow while I’ve been working on Advesperation 2 for the Asylum Jam as well as a point+click adventure game that grew too big for the jam it was meant for.  (More on that later!)

AI

It hasn’t been completely still, though. I’ve been tinkering with the flocking AI, e.g. adding obstacle avoidance for both stationary and moving things. So now the little tadpoles can avoid the bigger fish as well as rocks. The logic for avoiding obstacles is a bit different, though, as they should only avoid what they’re about to hit, otherwise you’d never see them swim alongside the rocks. So I’ve been trying to use their direction/velocity vectors as their ‘eyes’ instead. It’s not perfect yet and for the larger fish I may need something like additional ‘eye vectors’ on either side to get more natural movement.

fish1

Lighting

The way I made the underwater lights needed an update as well. The lights were just sprites layered underneath everything else which is a fine illusion until solid objects like rocks/islands are introduced. I downloaded a plugin to render some basic 2D lightcones (or full circles) but it produced strange artefacts when overlapping. So I had to figure out how to make my own. I’ve never tried generating meshes in Unity before, but luckily it’s not nearly as hard as I thought and after about an evening’s work I ended up with this:

light1I’m not completely happy with the texture yet (overlapping lights should be similar to having a ‘screen’ blend mode), but I’d rather learn more about procedurally generating meshes before I dive into shaders as well.

 

Tadpole movement

I’m working on a new, expanded version of Fathoms with more actual gameplay and decided to begin with just making different sorts of marine life.

Hopefully when I’ve spent some time making movement and AI I’ll work out some ideas about how to tie it together into a little tablet game.

This little test shows 50 small fish/tadpoles swimming around with some simple flocking logic:
(click reset if the fish don’t spawn right away)

The method is based on this guide, needing just a bit of work to get it running with rigidbodies and such. Main difference is not worrying about velocity, each fish swims forward by adding force so the steering algorithms only return normalized vectors.

  • Alignment – determines how eager they are to swim in the same direction
  • Cohesion – how close they want to be
  • Separation – how much they avoid one another
  • Edge – how quickly they turn away from the edge
  • Flocking radius – how far they can ‘see’ each other

The music will probably be the theme for the finished game :)

Twine and Unity sitting in a tree…

I made a small adventure-like game using both Twine and the Unity Web player together. Since it took me some time I figured I might as well share how it works (it’s not terribly complicated, but I had to do a bit of trial and error).

The game itself is a weird little thing, the story didn’t make much sense, but I hope it gives a nice atmospheric little experience. The mechanics, however, seem rather solid and I hope I can use it for later projects when I want to combine lots of text with some animation/graphical interaction.

Twine + Unity sitting in a tree...
Twine + Unity sitting in a tree…

 You’re more than welcome to go give it a try

Continue reading Twine and Unity sitting in a tree…