## Automata + circles = win / TakkaTakka update part 4 - 15/05/2014, 01:31

So I connected the automata system in mjEngine to the circles; each circle can have its own list of automata and each automaton can implement a different behaviour.

When a circle is created, a set of automata (and the automata's parameters) are defined. This circle is then placed in a queue where it waits for its time to enter the stage.

Before the song starts, the system pre-calculates the stage entry time for all the circles based on the moment the circle should strike the goal, minus the time it takes for the circle to reach it at its base speed, plus the extra time added by each automaton's behaviour. In the case of some automata, this 'extra time' is 0 because they do not modify the circle's trajectory in a way that slows or speeds it down.

Each time a circle is updated, the circle updates all the entries in its automata list and since each automaton has access to all the circle's properties, it can modify anything it sees fit. Also because it is a list and not just one automaton, different behaviours can be combined as long as they make sense. For example, one automaton might make the circle change colour while another makes it walk in a spiral path.

The next game mechanic I'm planning to implement is a song with spiral paths. I've tried it and it makes it super difficult to track which circle is closest to the goal :D

< Back to blog

*This site doesn't use cookies, does not log IPs and does not track you in any way.*