123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|683|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> On Topic -> Racing A.I. Any ideas?

Tue, 07 Apr 2015, 16:34
cyangames
Planning out a racing game, probably involving penguins and / or spaceships with asteroid physics, weapons, etc and I'm thinking about how best to do A.I. for CPU cars.

Does this look like a goo way to approach it [pseudocode warning]?



-=-=-
Web / Game Dev, occasionally finishes off coding games also!
Tue, 07 Apr 2015, 16:54
Jayenkai
Assuming the tracks are predesigned, maybe record nodes as you play each track the first few times, and store those points as "Dev-AI" or something?

But, yeah, I'd say you're on the right (*teehee*) track.
Points around the map which the AI driver drives towards, and maybe have a preset speed variable in the dots that the AI should aim for, too.

With enough nodes and a little randomisation, you oughta get something "playable".. Maybe..!?

-=-=-
''Load, Next List!''
Tue, 07 Apr 2015, 17:03
cyangames
That's a bloody good idea! I hadn't thought about the cornering speed and having that as a variable for the dots but that's got to be a thing, you can add aggression to certain A.I. in the sense that they could aim for a higher speed, etc, etc, which may, or may not work out for them

Yeah, the tracks will be pre-designed for certain.

Here's the test track as it stands:



-=-=-
Web / Game Dev, occasionally finishes off coding games also!
Tue, 07 Apr 2015, 17:08
Jayenkai
Ooooh, chunky
Tue, 07 Apr 2015, 17:21
cyangames
yeah, all a bit greyboxed currently. trying out using this method before i get into the graphics this time around.

But there's checkpoints, damage, heal pads and slow zones there.

-=-=-
Web / Game Dev, occasionally finishes off coding games also!
Tue, 07 Apr 2015, 17:26
Jayenkai
Oh, you're changing it
Looks like an Air Hockey table!

-=-=-
''Load, Next List!''
Wed, 08 Apr 2015, 01:26
spinal
Thats roughly how mariokart did it, should be good enough for anyone else.

-=-=-
Check out my excellent homepage!
Wed, 08 Apr 2015, 02:40
cyangames
Cool!

I started thinking that maybe I could just record a bunch of ghosts and have them in the game as racers instead perhaps, the theory being that I could record a bunch of them and select a random batch of 10. But that may not work out as well, I guess that time and testing will tell!

I probably will be changing it at a later point Jay, yup. Depends on how I feel about it later on, but you're right, an air hockey table would give good context to the physics also.

-=-=-
Web / Game Dev, occasionally finishes off coding games also!
Thu, 09 Apr 2015, 15:58
cyangames
Managed to get the cpu driving around the map based on basic way points tonight. It's a little glitchy but that can be added to tomorrow.

-=-=-
Web / Game Dev, occasionally finishes off coding games also!
Thu, 09 Apr 2015, 16:01
Jayenkai
Kewly!!
Looking forward to seeing the end result!

-=-=-
''Load, Next List!''
Fri, 10 Apr 2015, 17:46
cyangames
8 Racing CPU in place and me (in pink) Got the ghost recording and playback going on so I'm sorta racing myself x 8... Their speed is a bit randomized so there's a bit of pack spread (this is lap 4)



Sadly, I'm lapping them, but still, it's running smoothly!

-=-=-
Web / Game Dev, occasionally finishes off coding games also!
Fri, 10 Apr 2015, 18:06
Jayenkai
Awesome!!!
Fri, 10 Apr 2015, 20:06
cyangames
Added a mini map and the "car" becomes tougher to handle once damaged. Oh my gosh..it's gone 3am.

Had fun playtesting it and twaeking the ai though clearly, which is good!

Recorded another few ai tracks for a bit better bunching between cpu players, works quite nicely.

-=-=-
Web / Game Dev, occasionally finishes off coding games also!