Creating a road for a shifting map

Im creating a driving game. the player doesnt need to follow roads but the npc vehcles do. how to i create these roads ? with vectors? the map/ camera will be moving so the player is always on screen, so how can i create roads that work with this?

Crazy idea but can work: make .go that is “checkpoint” and you could put these checkpoints along the map, then every .go sends message to some “nav.script” its location. Script creates a spline curve, and if you add direction - it becomes your AI path :slight_smile: Then you could just have a function that returns closest point for each AI along that path in direction of the track and you are all set?

Or maybe you can find a more automated way to place these waypoints, like center of each tile?

Think of it as a “navmesh”, but instead of triangles you have just waypoints, a curve connecting them, and function to get vector for npc in direction of how curve flows. Point is: once you have a curve that follows the road you can then let npc logics decide how to drive on it..

1 Like