Home    LittleBigPlanet 2 - 3 - Vita - Karting    LittleBigPlanet 2    [LBP2] Help!
#1

Ai Racers, need help!

Archive: 3 posts


I'm currently working on a Need for Speed Hot Pursuit remake, and I hit some problems. The big one is that I can't seem to get my Ai racers to follow a set path. The Ai cops work just fine, following the racers, but it wouldn't be much of a level without racers. If anyone could offer any advice, I would be super happy! (The cars are top-down, by the way)2012-03-19 21:13:00

Author:
Unknown User


tags on the route, selector with multiple followers attached on the cars (each follower goes to a different tag) tag sensor cycles to next follower when tag in the road is hit... simples XD2012-03-19 21:26:00

Author:
ForgottenEnigma
Posts: 1414


Hmmm. No. That's too simple for effective AI.

What you'll want to do is give each car a hologram WP. That waypoint is what should be intelligently navigating the track, while the Police Car uses a Look-At Rotator to follow the Waypoint.
The Waypoint should use Dav1d0's suggestion regarding the Selector cycling between Follower Movers following Tags, not the vehicle itself. Using a WP allows the vehicle to correct itself if it gets stuck (I'll cover that in depth at a later point, if need be.) and also gives the vehicles cornering a more fluid appearance.
For your road WPs, you'll need a minimum of 3 Tag Labels.
Let's call them Road1, Road2 and Road3. When the hologram waypoint reaches Tag 'Road1' have it start moving to the closest 'Road2' and so on. Once it reaches 'Road3' have it move back to the closest Road1. Place a looping trail of these 3 labels all the way around your track. You'll probably need loads. Just make sure the closest Tag is always the next one it should be moving to.

If you've done this right, what you should have should be somewhat reminiscent of a scalextric. Also, if you want to make your AI look even more intelligent, add multiple lanes. But that's again, a little more advanced, and I'll only cover that if you really need it.

For getting your cars to handle turns well, you might need hologram 'Slow Down Zones' as I liked to call them. When a vehicle hits one, have it intelligently slow down so it doesn't just fly straight into the corner and hit the outside wall.


Remember, each car must have it's own separate hologram WP. If you're emmiting clones of the same vehicles, you'll need to create a system so that new vehicles can figure out what ID numbers aren't already taken, so they can follow the right WP.

EDIT - Forgot something pretty important - The WP should also identify the vehicle it's working with. It should only move around the track when the respective vehicle is nearby. If the WP pulls ahead of the car, have it stop wherever it is until it catches up. The WP should ideally be taking baby steps as the car chases along behind it.


Whew. Giving away all my secrets here.
2012-03-19 21:59:00

Author:
Ostler5000
Posts: 1017


LBPCentral Archive Statistics
Posts: 1077139    Threads: 69970    Members: 9661    Archive-Date: 2019-01-19

Datenschutz
Aus dem Archiv wurden alle persönlichen Daten wie Name, Anschrift, Email etc. - aber auch sämtliche Inhalte wie z.B. persönliche Nachrichten - entfernt.
Die Nutzung dieser Webseite erfolgt ohne Speicherung personenbezogener Daten. Es werden keinerlei Cookies, Logs, 3rd-Party-Plugins etc. verwendet.