A Better Autopilot

The non-player drivers in the 4k version of Skiddy are very simple - the game was designed to be a two-player only experience, but towards the end I had decided to try to make it a complete 1 or 2 player game. As the game was mostly built by then, there wasn’t much memory left to implement a decent non-player driver, and I ended up with a fairly naive solution that while providing a reasonably entertaining competitor, is very inflexible.

In Skiddy 4k, to keep things small I used a table of waypoints that tells the car to turn to a specific direction when the x or y position exceeds a specific point. Due to the inertia of the cars, this meant having the points scaled depending on the speed of the car (a car moving faster needs to start the turn earlier to avoid the wall), requiring a lot of trial and error. It allows the cars to navigate the track but if they hit the side or the player car they have no way of getting back on course, and must continue driving in the same direction until they pass the next waypoint.

For Skiddy+, I decided to scrap the waypoint system in favour of a direction map, a 40x25 table of the best direction to drive for each 8 pixels on the track. I used Tiled to create this as I lacked a specific tool to allow me to make something which I could visualise (see the screenshot). Each cell on the direction map tells the non-player driver the best direction to turn towards, so if a car is on the edge of the track it will aim back towards the ideal driving line. This needs a bit of trial and error too, but has the advantage of allowing the collision to shunt the cars sideways, something I dropped from the 4k game.

Skiddy+ Direction Map

A work-in-progress demo is available here. This has non-player cars only, but shows the use of the direction map. I added a third driver to the game which will always be AI controlled. Each car has slightly different acceleration and deceleration values to provide some variation but all have the same top speed. 

Skiddy+ is an experiment only, so the graphics being used are placeholders - if Skiddy+ reaches the point where I want to release it they will most likely be redrawn. 

Skiddy+ non-playable demo - This demo lacks any of the testing that our games usually go through and most likely has compatibility issues!

Get Skiddy

Leave a comment

Log in with itch.io to leave a comment.