- Home /
Optimization Pun2 send hundreds of rpcs
Since I've been seeing you quite a few times since I've started using Pun2, I'm asking for your help / advice about a problem (anyone can participate ofc).
So i've been making this top-down conquest planet style video game and it works fine so far. -The map generates randomly at each game with random planets at random positions -Players can connect and send troops to conquer neighbor planets
Now, I want to upgrade the sending troop thing. Because right now you can only send troops to a neighbor planet of the one you're sending the troops from. So I managed to implement Dijkstra's algorithm so now It returns me a list of the planets' Vector2 of the shortest path between the planet I want to send the troops from, to the desired one.
Now here the issue. In my game you can send up to 666 troops per planet at a time. So i have to find a way to make them travel the same way for every player in the room. So far, There wasn't really a big bandwidth problem since the only thing synced through the network was the starting and ending point of each troop. But now I have to find a way to pass a List for each troop for it to travel from a planet A to a Planet B passing by n planets.
In a nutshell :
So My question is : How can I sync hundreds of troops that have to travel through n points without lagging?
I thought about passing the starting and ending point for each troop, and then each troop would calculate their way to the ending point. But I tried and doing 1000 times Dijkstra's algorithm is.. Yeah you get the point.