- Joined
- Jun 30, 2013
- Messages
- 22
- Reaction score
- 9
The One-Block Solution to NPC Pathing
So I’m not going to make a big intro, because I’m lazy and want to actually go play video games, so here it is.
The Node.
The node is an intangible block that (much like the pick-up rails) can only be seen in build mode. A node can be connected (C -> V) to other nodes to form a one way, direct route between the two. If two nodes are linked together both ways, it will be a two-way passage. NPCs will take move in a straight line between nodes, and will not path around obstructions. A node can be connected to any logic block. A node will send a HIGH signal to any connected logic blocks when an NPC is standing on the node. If the node is slaved to any logic blocks, the NPC standing on the node will wait until a HIGH signal is sent to the node before moving to the next node.
Examples: (Sorry in advance for the random periods, spacing wasn't working for some reason :l )
A → B → C
.........| --> D
The NPC will move from A to B, and then move to either C or D, depending on where the NPC needs to go. The NPC can not move from D or C to B, or from B to A
A → |WALL| → B
The NPC will get stuck by the wall, and will not path around it.
A <-> B <-> C
...........|<-> D
This example is like the first, except the NPC can move from D or C to B, and from B to A, as well as A to B, and B to C or D.
Elevator Example:
A → | Elevator |
........|B C D |
........| 1 2 3 |
Logic:
Node A is connected to nodes B, C, and D, which are all inside the elevator. Node B, C, and D are part of the main entity, not the elevator entity. Nodes B, C, and D are connected to their respective floor buttons below them, and to their respective node on each floor. A signal is connected to nodes B, C, and D. When the elevator is at the selected floor, the signal is HIGH.
Pathing:
The NPC wants to go to floor 2, and starts at node A. The NPC moves from node A to node C. When the NPC steps on node C, a HIGH signal is sent to button 2. The elevator then moves to floor two, while the NPC stays on node C. Once the elevator reaches floor two, a HIGH signal is sent to node C, and the NPC exits the elevator.
End note:
Please tell me how I can improve on this system, and how you feel about this suggestion. I will provide more examples if needed, and if you have any questions, please ask. I will try to answer as soon as I can, and you can expect an answer within two days.
So I’m not going to make a big intro, because I’m lazy and want to actually go play video games, so here it is.
The Node.
The node is an intangible block that (much like the pick-up rails) can only be seen in build mode. A node can be connected (C -> V) to other nodes to form a one way, direct route between the two. If two nodes are linked together both ways, it will be a two-way passage. NPCs will take move in a straight line between nodes, and will not path around obstructions. A node can be connected to any logic block. A node will send a HIGH signal to any connected logic blocks when an NPC is standing on the node. If the node is slaved to any logic blocks, the NPC standing on the node will wait until a HIGH signal is sent to the node before moving to the next node.
Examples: (Sorry in advance for the random periods, spacing wasn't working for some reason :l )
A → B → C
.........| --> D
The NPC will move from A to B, and then move to either C or D, depending on where the NPC needs to go. The NPC can not move from D or C to B, or from B to A
A → |WALL| → B
The NPC will get stuck by the wall, and will not path around it.
A <-> B <-> C
...........|<-> D
This example is like the first, except the NPC can move from D or C to B, and from B to A, as well as A to B, and B to C or D.
Elevator Example:
A → | Elevator |
........|B C D |
........| 1 2 3 |
Logic:
Node A is connected to nodes B, C, and D, which are all inside the elevator. Node B, C, and D are part of the main entity, not the elevator entity. Nodes B, C, and D are connected to their respective floor buttons below them, and to their respective node on each floor. A signal is connected to nodes B, C, and D. When the elevator is at the selected floor, the signal is HIGH.
Pathing:
The NPC wants to go to floor 2, and starts at node A. The NPC moves from node A to node C. When the NPC steps on node C, a HIGH signal is sent to button 2. The elevator then moves to floor two, while the NPC stays on node C. Once the elevator reaches floor two, a HIGH signal is sent to node C, and the NPC exits the elevator.
End note:
Please tell me how I can improve on this system, and how you feel about this suggestion. I will provide more examples if needed, and if you have any questions, please ask. I will try to answer as soon as I can, and you can expect an answer within two days.