Super Sprint A.I.

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

Super Sprint A.I.

Post by Wall_Axe » Fri May 11, 2018 1:01 am

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?
0 x

Ersh
Manic Miner
Posts: 227
Joined: Mon Nov 13, 2017 1:06 pm

Re: Super Sprint A.I.

Post by Ersh » Fri May 11, 2018 6:48 am

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:
0 x

Kweepa
Manic Miner
Posts: 216
Joined: Sat Feb 03, 2018 6:14 pm
Location: Austin, Texas

Re: Super Sprint A.I.

Post by Kweepa » Fri May 11, 2018 2:25 pm

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.
0 x

User avatar
ZXDunny
Manic Miner
Posts: 242
Joined: Tue Nov 14, 2017 3:45 pm

Re: Super Sprint A.I.

Post by ZXDunny » Fri May 11, 2018 2:35 pm

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.
2 x

Ersh
Manic Miner
Posts: 227
Joined: Mon Nov 13, 2017 1:06 pm

Re: Super Sprint A.I.

Post by Ersh » Fri May 11, 2018 3:11 pm

Kweepa wrote:
Fri May 11, 2018 2: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).
0 x

Ralf
Dynamite Dan
Posts: 1306
Joined: Mon Nov 13, 2017 11:59 am
Location: Poland

Re: Super Sprint A.I.

Post by Ralf » Fri May 11, 2018 3:49 pm

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 @ZXDunny may be pointing us in right direction.
0 x

Ersh
Manic Miner
Posts: 227
Joined: Mon Nov 13, 2017 1:06 pm

Re: Super Sprint A.I.

Post by Ersh » Fri May 11, 2018 4:15 pm

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.
0 x

Wall_Axe
Microbot
Posts: 175
Joined: Mon Nov 13, 2017 11:13 pm

Re: Super Sprint A.I.

Post by Wall_Axe » Fri May 11, 2018 5:58 pm

good answers, i thought jetski was really tough too!
0 x

hikoki
Manic Miner
Posts: 400
Joined: Thu Nov 16, 2017 10:54 am

Re: Super Sprint A.I.

Post by hikoki » Mon May 28, 2018 2:34 am

some kind of tron variation logic where cars follow two invisible bikes ?
0 x

Post Reply