Today I got most of the work done on that. There is a lot left to do, but as of right now:
- A new jar gets created when a user hosts a race
- When the race starts all entrants are placed into that jar in order of initiative, on the left end of the jar
- An Attractor item is placed on the right end of the jar
- The snails begin crawling toward the attractor item, their actions checked every minute just like in a normal jar. Snails can change direction and perform other actions live as this happens (and can be observed doing so)
- As a snail touches the item its time is recorded and it is returned back to its parent jar in the owner's stable
- When all snails finish and are relocated back to their owners' jars all items within the jar are deleted, and then the jar is deleted
- The race is marked as "Finished" and results are displayed.
This has taught me that my way of estimating the snail's position (between its last current position and target position) is nowhere near accurate enough. The snail that was coming in first visually actually finished 2 seconds after another snail in the race. I'll need to work on this. Here are some screenshots:
Ready:
Go!
Why did this snail turn around?!
The last racer, straggling behind:
Race results: