Super Sprint A.I.

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
Wall_Axe
Manic Miner
Posts: 492
Joined: Mon Nov 13, 2017 11:13 pm

Super Sprint A.I.

Post by Wall_Axe »

has anyone got any idea how the AI works for games like super sprint, ivan 'iron man' stewart's off road racing, overhead codemasters games like super jetski simulator?
User avatar
Ersh
Manic Miner
Posts: 480
Joined: Mon Nov 13, 2017 1:06 pm

Re: Super Sprint A.I.

Post by Ersh »

For Jet Bike Simulator they used the very same record function the game uses for replays to record gameplay for the computer. They had some clever code to get the computer back on track if it got bumped by the player.

The Oliver twins talk about it here:
https://www.youtube.com/watch?v=tDX5tqY8fSY
User avatar
Kweepa
Manic Miner
Posts: 311
Joined: Sat Feb 03, 2018 6:14 pm
Location: Albuquerque, New Mexico

Re: Super Sprint A.I.

Post by Kweepa »

That's awesome!
However, "do something clever" is not a very detailed algorithm :)
I would try a 32x24 map of direction (0-7) and speed (0-31) for each map which would fit in 768 bytes, then for each character turn towards the ideal direction, and thrust if slower than the ideal speed. You could drive around yourself and have the computer accumulate your direction and speed in each square, although that wouldn't work so well to populate the edges of the map, which should instead point towards the ideal lines.
User avatar
ZXDunny
Manic Miner
Posts: 498
Joined: Tue Nov 14, 2017 3:45 pm

Re: Super Sprint A.I.

Post by ZXDunny »

Draw two vectors from the front of the car, pointing towards the edges of the road. If one is shorter than the other, turn the other direction. The amount of turning can be tuned to make the cars more or less "intelligent" - if they only adjust in small increments then their reaction time in corners will be reduced, making them more likely to crash.
User avatar
Ersh
Manic Miner
Posts: 480
Joined: Mon Nov 13, 2017 1:06 pm

Re: Super Sprint A.I.

Post by Ersh »

Kweepa wrote: Fri May 11, 2018 3:25 pm However, "do something clever" is not a very detailed algorithm :)
It's a bit vague isn't it. The video states that the replay function only recorded key presses and duration, not actual coordinates. Though I'm wondering if they didn't also record positions at certain points and did some simple extrapolating to get them there, if bumped, before continuing with the replay.

The advantage of pre-recorded computer players is of course that it looks organic, the downside would be that the computer always behaves the same (bumps discluded) unless you have multiple recordings (which Jet Bike Simulator doesn't appear to have).
Ralf
Rick Dangerous
Posts: 2279
Joined: Mon Nov 13, 2017 11:59 am
Location: Poland

Re: Super Sprint A.I.

Post by Ralf »

The video states that the replay function only recorded key presses and duration, not actual coordinates.
It means that the game is 100% deterministic, at given circumstances enemy vehicles would always behave the same. So we need to record human behaviour only and all the rest would be recalculated to the same result.

It's an interesting subject. Personally I never wondered much about AI for vehicles on a track but have a feeling that a comment from [mention]ZXDunny[/mention] may be pointing us in right direction.
User avatar
Ersh
Manic Miner
Posts: 480
Joined: Mon Nov 13, 2017 1:06 pm

Re: Super Sprint A.I.

Post by Ersh »

I just tried Jet Bike Simulator and it was pretty easy to figure out the 'clever' part... there's no collision between player(s) and the computer. :lol: They simply recorded a three player game and used that for the computer players.
Wall_Axe
Manic Miner
Posts: 492
Joined: Mon Nov 13, 2017 11:13 pm

Re: Super Sprint A.I.

Post by Wall_Axe »

good answers, i thought jetski was really tough too!
hikoki
Manic Miner
Posts: 576
Joined: Thu Nov 16, 2017 10:54 am

Re: Super Sprint A.I.

Post by hikoki »

some kind of tron variation logic where cars follow two invisible bikes ?
Post Reply