Small concept how to make the points that moving on the graph.
Points moving on graph
Points moving on graph
- Attachments
-
points-on-graph-2-02.love
- (5.88 KiB) Downloaded 60 times
Re: Points moving on graph
What are we looking at? Is it based on pathfinding between two points?

Re: Points moving on graph
Yes.
1. There is the graph - the diagram with nodes and edges. Each edge can have multiple points, so the edge can be curved and total length. Also the edges have just only one direction.
2. From nodes to nodes can be find the shortest path.
3. Points are moving along the paths.
Re: Points moving on graph
Nice. Did you use some common algorithm such as A*? Sorry, I didn't go through your code, just checked the demo.

Re: Points moving on graph
No, it's the Dijkstra's algorithm, but id can be changed to A*, if we add the distance to the end point as extra weight.
Re: Points moving on graph
your demos are super neat.
are you also working on some bigger project to use them?
are you also working on some bigger project to use them?
Re: Points moving on graph
Yes, I am makin the game, that needs alot of mechanics, one of them is path following along the graph structure.
https://www.youtube.com/watch?v=GbTO3S_-klM
Re: Points moving on graph
Nice, is that a transport-related game?darkfrei wrote: ↑Fri Apr 18, 2025 4:53 pmYes, I am makin the game, that needs alot of mechanics, one of them is path following along the graph structure.
https://www.youtube.com/watch?v=GbTO3S_-klM

Re: Points moving on graph
List of Game Ideas
1. Urban Traffic Manager (Traffic Management Simulator)
Genre: Simulator, Puzzle
Description: The player manages a city's transportation system, controlling traffic lights, routes, and road signs to minimize congestion and accidents. The goal is to ensure smooth traffic flow as the number of vehicles increases.
Mechanics:
Routing: Use computePath to dynamically recalculate vehicle routes, avoiding congested roads (as in processNextEdge).
Collisions: Apply behaviour1 (on the same road) and behaviour4 (at intersections) to manage priority at junctions. For example, cars closer to an intersection get priority status.
Speed: Regulate speed using interpolateSpeed to slow vehicles as they approach others within a softRadius.
Visualization: Show interactionLines to highlight vehicles yielding to others (red color for yielding).
Uniqueness: The player can build new roads or modify the graph (adding nextEdges/prevEdges), influencing findShortestPath behavior.
2. Racing with Traffic
Genre: Racing, Arcade
Description: The player races in an open world, overtaking not only opponents but also avoiding city traffic. Victory depends on speed and maneuvering.
Mechanics:
Traffic: Use points.lua to simulate NPC vehicles moving along a road graph. behaviour2 and behaviour3 help NPCs avoid the player and each other at intersections.
Routes: Apply findShortestPath for dynamic NPC routing that adapts to the player's actions (e.g., avoiding roadblocks).
Speed & Collisions: Use interpolateSpeed to slow NPCs when near the player or other vehicles. Player gets penalties for collisions based on hardRadius.
Visualization: Display statuses (priority/yielding) as color indicators above vehicles to help the player anticipate traffic behavior.
Uniqueness: NPCs react to the player's driving behavior (e.g., aggressive driving causes traffic slowdown), using getDistanceSquared for proximity evaluation.
3. Post-Apocalyptic Caravan (Caravan Survival)
Genre: Strategy, Survival
Description: The player leads a caravan of vehicles across the wasteland, delivering resources between settlements. Avoiding bandits, managing internal traffic, and choosing safe paths are key.
Mechanics:
Caravan: Each vehicle is a point moving along road edges. behaviour1 ensures no collisions within the caravan.
Routes: Use findShortestPath to avoid bandit zones (add weights to calculateEdgeTravelTime based on danger).
Enemy Encounters: Extend getNextEdgesWithinRadius to detect bandits ahead and slow the caravan (behaviour2).
Visualization: interactionLines show which vehicles are yielding or under threat.
Uniqueness: Players can sacrifice vehicles to delay enemies or speed up the caravan at risk of collision (ignoring minSpeed).
4. Public Transport Tycoon
Genre: Simulator, Tycoon
Description: The player manages a public transport system (buses, trams, metro), optimizing routes and schedules to maximize profit and citizen satisfaction.
Mechanics:
Transport: Buses and trams are points moving along fixed routes (list of edges).
Collisions: Use behaviour4 to manage priority at nodes (e.g., intersections or stations).
Routes: findShortestPath helps build new routes when expanding the network (e.g., adding stations).
Speed: updateAvgSpeedOnEdges simulates route congestion affecting scheduling.
Uniqueness: The player can modify schedules (via spawnInterval) or add lines by editing the graph.
5. Space Freight Simulator
Genre: Simulator, Strategy
Description: The player manages a fleet of cargo spaceships delivering resources between planets, avoiding asteroids, pirates, and orbital collisions.
Mechanics:
Ships: Each ship is a point moving along orbital edges.
Collisions: Use behaviour3 to avoid ships converging on the same orbit.
Routes: Use findShortestPath with calculateEdgeTravelTime that includes fuel cost.
Visualization: interactionLines act as radar signals warning about nearby ships.
Uniqueness: Players can build new orbital stations by adding nodes and edges to the graph.
6. Emergency Services Dispatch
Genre: Simulator, Strategy
Description: The player manages ambulances, fire trucks, and police cars, dispatching them to calls while avoiding traffic and accidents.
Mechanics:
Vehicles: Each is a point with a target destination (targetNodeId).
Priorities: Extend behaviour1 to give emergency vehicles default priority, making others yield.
Routes: Use computePath to find the fastest route based on edge.avgSpeed.
Visualization: Highlight emergency vehicles in green and show interactionLines for yielding cars.
Uniqueness: Players can activate sirens to increase maxSpeed and slow surrounding traffic.
7. Traffic Rules Education Game
Genre: Educational, Simulator
Description: An educational game to teach traffic rules. The player controls a vehicle or pedestrian, interacting with AI traffic and earns points for rule compliance.
Mechanics:
Traffic: Use points.lua to simulate rule-following vehicles (e.g., stopping at red lights).
Collisions: Use behaviour1–behaviour4 to model interaction with the player, including rule violations (extend getPrevEdgesWithinRadius).
Scoring: Evaluate player actions by comparing them to AI behavior (priority/yielding).
Uniqueness: Interactive scenarios where players react to traffic violations (e.g., car running a red light).
8. Traffic-Based Tower Defense
Genre: Tower Defense, Strategy
Description: The player builds towers along roads to stop waves of enemy vehicles (e.g., smugglers), while avoiding disruption to civilian traffic.
Mechanics:
Routes: Use findShortestPath for enemy paths, blockable by towers (removing edges from the graph).
Visualization: interactionLines show civilians yielding to enemies, visualizing the chaos.
Uniqueness: Towers can slow traffic (edge.avgSpeed), affecting enemy routing.
1. Urban Traffic Manager (Traffic Management Simulator)
Genre: Simulator, Puzzle
Description: The player manages a city's transportation system, controlling traffic lights, routes, and road signs to minimize congestion and accidents. The goal is to ensure smooth traffic flow as the number of vehicles increases.
Mechanics:
Routing: Use computePath to dynamically recalculate vehicle routes, avoiding congested roads (as in processNextEdge).
Collisions: Apply behaviour1 (on the same road) and behaviour4 (at intersections) to manage priority at junctions. For example, cars closer to an intersection get priority status.
Speed: Regulate speed using interpolateSpeed to slow vehicles as they approach others within a softRadius.
Visualization: Show interactionLines to highlight vehicles yielding to others (red color for yielding).
Uniqueness: The player can build new roads or modify the graph (adding nextEdges/prevEdges), influencing findShortestPath behavior.
2. Racing with Traffic
Genre: Racing, Arcade
Description: The player races in an open world, overtaking not only opponents but also avoiding city traffic. Victory depends on speed and maneuvering.
Mechanics:
Traffic: Use points.lua to simulate NPC vehicles moving along a road graph. behaviour2 and behaviour3 help NPCs avoid the player and each other at intersections.
Routes: Apply findShortestPath for dynamic NPC routing that adapts to the player's actions (e.g., avoiding roadblocks).
Speed & Collisions: Use interpolateSpeed to slow NPCs when near the player or other vehicles. Player gets penalties for collisions based on hardRadius.
Visualization: Display statuses (priority/yielding) as color indicators above vehicles to help the player anticipate traffic behavior.
Uniqueness: NPCs react to the player's driving behavior (e.g., aggressive driving causes traffic slowdown), using getDistanceSquared for proximity evaluation.
3. Post-Apocalyptic Caravan (Caravan Survival)
Genre: Strategy, Survival
Description: The player leads a caravan of vehicles across the wasteland, delivering resources between settlements. Avoiding bandits, managing internal traffic, and choosing safe paths are key.
Mechanics:
Caravan: Each vehicle is a point moving along road edges. behaviour1 ensures no collisions within the caravan.
Routes: Use findShortestPath to avoid bandit zones (add weights to calculateEdgeTravelTime based on danger).
Enemy Encounters: Extend getNextEdgesWithinRadius to detect bandits ahead and slow the caravan (behaviour2).
Visualization: interactionLines show which vehicles are yielding or under threat.
Uniqueness: Players can sacrifice vehicles to delay enemies or speed up the caravan at risk of collision (ignoring minSpeed).
4. Public Transport Tycoon
Genre: Simulator, Tycoon
Description: The player manages a public transport system (buses, trams, metro), optimizing routes and schedules to maximize profit and citizen satisfaction.
Mechanics:
Transport: Buses and trams are points moving along fixed routes (list of edges).
Collisions: Use behaviour4 to manage priority at nodes (e.g., intersections or stations).
Routes: findShortestPath helps build new routes when expanding the network (e.g., adding stations).
Speed: updateAvgSpeedOnEdges simulates route congestion affecting scheduling.
Uniqueness: The player can modify schedules (via spawnInterval) or add lines by editing the graph.
5. Space Freight Simulator
Genre: Simulator, Strategy
Description: The player manages a fleet of cargo spaceships delivering resources between planets, avoiding asteroids, pirates, and orbital collisions.
Mechanics:
Ships: Each ship is a point moving along orbital edges.
Collisions: Use behaviour3 to avoid ships converging on the same orbit.
Routes: Use findShortestPath with calculateEdgeTravelTime that includes fuel cost.
Visualization: interactionLines act as radar signals warning about nearby ships.
Uniqueness: Players can build new orbital stations by adding nodes and edges to the graph.
6. Emergency Services Dispatch
Genre: Simulator, Strategy
Description: The player manages ambulances, fire trucks, and police cars, dispatching them to calls while avoiding traffic and accidents.
Mechanics:
Vehicles: Each is a point with a target destination (targetNodeId).
Priorities: Extend behaviour1 to give emergency vehicles default priority, making others yield.
Routes: Use computePath to find the fastest route based on edge.avgSpeed.
Visualization: Highlight emergency vehicles in green and show interactionLines for yielding cars.
Uniqueness: Players can activate sirens to increase maxSpeed and slow surrounding traffic.
7. Traffic Rules Education Game
Genre: Educational, Simulator
Description: An educational game to teach traffic rules. The player controls a vehicle or pedestrian, interacting with AI traffic and earns points for rule compliance.
Mechanics:
Traffic: Use points.lua to simulate rule-following vehicles (e.g., stopping at red lights).
Collisions: Use behaviour1–behaviour4 to model interaction with the player, including rule violations (extend getPrevEdgesWithinRadius).
Scoring: Evaluate player actions by comparing them to AI behavior (priority/yielding).
Uniqueness: Interactive scenarios where players react to traffic violations (e.g., car running a red light).
8. Traffic-Based Tower Defense
Genre: Tower Defense, Strategy
Description: The player builds towers along roads to stop waves of enemy vehicles (e.g., smugglers), while avoiding disruption to civilian traffic.
Mechanics:
Routes: Use findShortestPath for enemy paths, blockable by towers (removing edges from the graph).
Visualization: interactionLines show civilians yielding to enemies, visualizing the chaos.
Uniqueness: Towers can slow traffic (edge.avgSpeed), affecting enemy routing.
Re: Points moving on graph
Very cool!
I was working on something similar along ideas #4 and #1 around 2019 I think I had posted a couple of screenshots here on the forums.
I was working on something similar along ideas #4 and #1 around 2019 I think I had posted a couple of screenshots here on the forums.

Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 4 guests