Friday, February 09, 2024

Mappy Races

Every year since the 18th Century the Epsom Derby has attracted thousands of spectators. Like many Londoners I have often taken a trip to Surrey in late May or early June to attend the Derby horse race. These horse racing trips may be what inspired me to create my horse race simulator Mappy Races. 

Mappy Races is a very simple horse race simulator which uses Leafletjs to animate two colored map markers racing around the course of the Epsom Derby. Before the races start the player has a purse of $100. The player can bet any amount on either the blue or red horse. When a race begins the two map markers follow the track of the Derby, traveling at random speeds. At the end of a race if the horse that wins matches the player's choice then the purse is increased by the amount bet. Lose and the money is taken from your purse.

Mappy Races was an idea I threw together very quickly yesterday. I actually think it could be developed to make an interesting game. I actually worked out that I could use a distanceTo function to determine which marker was closest to the end of its polyline and therefore provide a running commentary of the race (in text format). However at the moment the two polylines are not of the exact same length. This means that on occasion the commentary would say one marker is leading (because it was closest to the end of its polyline) while on the map it looked like it was behind the other marker. 

This problem could be overcome very easily by making both polylines of equal length. However I have neither the time or inclination to develop Mappy Races further. If you would like to copy the game and develop it then feel free to clone the game on its Glitch page. One simple thing you could do to improve the game would be to add more horses (or colored markers). You could also introduce different random speeds for the different markers and introduce odds for each horse. 

No comments: