Commute AI theories

Discuss Artificial Intelligence and Bot programming.
Post Reply
leileilol
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Commute AI theories

Post by leileilol »

You know AI like in Quarantine and GTA of just NPCs in cars going along roads obeying the road rules?

I haven't a clue on how that could possibly be achieved in a Quake engine, and by in a, i mean all four generations of them.
i should not be here
Labman
Posts: 62
Joined: Fri Nov 05, 2004 2:39 am
Location: Brisbane, Australia
Contact:

Post by Labman »

So you want to create ai for NPC's who walk around and dont fight?
leileilol
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Post by leileilol »

Commute AI, referring to just the innocous vehicles on the road.

i'd have to prototype some basic media to try ai.qc frigarounds... just wondering if there's a good idea in mind for AI drivers already. Spike's done something in GoodNightOut I think, probably just the smegtank ai though
i should not be here
avirox
Posts: 137
Joined: Wed Aug 16, 2006 3:25 pm

Post by avirox »

Directional brush entities for each side of the road, and "stop light" entities that search for incoming car/pedestrian entities approaching from specified directions.
Wazat
Posts: 771
Joined: Fri Oct 15, 2004 9:50 pm
Location: Middle 'o the desert, USA

Post by Wazat »

Another option is to set up a waypoint system. Cars follow the waypoints in order until they come across one with special attributes... for example, a stoplight. A stoplight waypoint says "attach yourself to X entity and wait until you are triggered by it, then continue".

Other waypoints may be direction decision waypoints. For example, a waypoint may give multiple directions the vehicle can go simply by having multiple entities with matching triggernames (say, a right-hand turn vs continuing forward). The vehicle simply selects one at random.

You could even implement logic like 4-way stops. Each car that reaches a 4-way stop inserts itself into a queue and then comes to a complete stop. The entity managing the queue tells a new vehicle to proceed forward, waits for the vehicle to reach its next waypoint (out of the intersection), then calls upon the next entity. More detailed logic could handle left turns, vs forward and right turns (allow two opposing left-turning cars to go, etc), but in a game maybe this wouldn't be necessary.

Roundabouts would be more challenging... but you could do it. :) The big problem is making sure cars know to not run into each other or the player, when the player isn't doing anything crazy like ramming them on purpose.

I imagine a waypointing system like this, with different waypoint types & logic for each type of intersection/complexity, would give you the power needed to solve this dilemma. If any type of specialized intersection (such as a roundabout, 4-way stop, etc) is too complex, either omit it or simplify the rules (most players are too busy mowing down pedestrians with the hood of their car to notice if traffic laws are being perfectly obeyed by every single tin can surrounding them).
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.
Post Reply