ProceduralGridMover unit teleporting problem

Hi, aron.

I am also developing a large world game using ProceduralGridMover. The grid is periodically updated based on the player’s location. Enemy agents are supposed to follow the player. The problem arises when the grid updates and if the enemy agents are outside the updated grid, they end up teleporting (or warping) back towards the edge of the grid. I want to know how to stop this teleportation and make them halt in their place. I also want to learn how to check if an agent has exited the grid.

Thank you.

Enemies too far should be disabled with a proxymity manager. Also that should stop units from teleporting.

When enemy was inside the grid and as player move the grid updated,
the enemy just get outside of the grid teleported to the inside of the grid.

In other words, The enemy ‘was’ inside the grid and has target destination in grid. And update happened, the enemy get outside as the grid position moved and the enemy teleported to inside the grid.

I know well what happens to you; when it happened to me, I said, ‘Who cares, anyway…’. In a game where you navigate the grid, you can’t have all the AIs active; 10,000 NPCs moving and ‘thinking’ would overwhelm any PC. So, imagine you have the view on your monitor, and let’s say the pathfinding grid is three times as large. In addition to this, you’ll have a Proximity Manager that maintains a list of all your NPCs. If these NPCs are outside the screen, the Manager will deactivate them. When they come back on the screen, they will be reactivated. This way, no NPC will ever be teleported because they won’t move if they are outside the grid, as they are deactivated.

In the first image, you can see a map in the editor not running. As you can see, there are about a hundred NPCs (green-orange symbols). In the second image, it’s running, and there’s the movement of the grid. I deactivate the NPCs outside the grid and reactivate them when they are at a certain distance from the screen.
The teleportation is “done” by IAstarAI (like FollowerEntity), not by the Procedural Graph Mover. If you deactivate the NPC, you deactivate the script that teleported it.

Some advice: Create a Proximity Manager script and a Proximity Managed script. The first is the manager, and the second should be placed in each AI. In the Managed script, include a bool variable to indicate whether the object has been disabled by the Manager or by something else (death?). Pay attention to the script execution order, especially if it works in the editor and then not in the exe (you may need to adjust the execution order).


1 Like

Thank you for your kind answer. First, what I trying to make is 3Dgame. So, the proximityView must be large enough to cover view. But, your suggestion about larger than screenview is so good. I’ll try that and figure out how to handle 3D view.

Thank you so much. You raise me up.