NPC for Racing Game (UPBGE 0.2.5 and Range 1.6)

Hi,
from a discord channel discussion:
I added some NPCs to a Car-setup (presumably by JREO)
3 versions of NPC:

  1. a Rigid-body using Navmesh and Steering-Actuator (NPC)
  2. a simple vehicle-wrapper (NPC2)
  3. a copy of the Player car-setup (NPC3)

They all use the same waypoint system using empties. There is a bpy-script to create waypoints from a BezierCurve:

For UPBGE 0.2.5:
old nfs physics replica_npc3.blend (4.3 MB)

For Range 1.6:
old nfs physics replica_npc3.range (4.3 MB)

Only the rigid-body-NPC has a builtin Obstacle avoidance


Here is a version where I implemented context-based-steering system to NPC2 and NPC3.
from:
upbge-0-3-context-based-steering
For UPBGE 0.2.5:
old nfs physics replica_npc3_avoid.blend (4.6 MB)

For Range 1.6:
old nfs physics replica_npc3_avoid.range (4.7 MB)

Although both NPC2 and NPC3 use the same system NPC3 is stubborn.
And: This system isn’t clever enough to avoid static obstacles on the track.
Already thinking about other ideas.

2 Likes

Here is another Version with radius based obstacles avoidance.
It is based on this:

For UPBGE 0.2.5:
old nfs physics replica_npc3_avoid_radius.blend (4.8 MB)

For Range 1.6:
old nfs physics replica_npc3_avoid_radius.range (4.8 MB)

edit: if cars are stuck they will try to go backwards

3 Likes

Added an Overlay-Scene for Positions.

To calculate positions also the player car needed to have a simple waypoint-system. (only the NPC had this before)
As long as the Player Car doesn’t get too far off-track all works fine. :wink:

For UPBGE 0.2.5:
old nfs physics replica_npc3_avoid_radius_position.blend (4.8 MB)

For Range 1.6:
old nfs physics replica_npc3_avoid_radius_position.range (4.8 MB)

update: Texts don’t jitter so much anymore.

2 Likes