Photon pathfinding struggle

bogdanJoca
edited August 2018 in Any Topic & Chat
Hi, i am new to photon, and I got stuck in networking pathfinder, I see that this is no easy job as there are not a lot of information online.

In my game I have max 50 agents at the time, and I have a relatively small map without a lot of path changing...
So my idea is for the MasterClient to spawn and find paths for the agents, then convert the path array to short array and send it to other clients so they can run the path locally, and repeat that only when the path changes on the MasterClient, is it possible to do it this way, and how exactly, I already tried to change the array via RPC funcion, but it does not run on clients, not sure if this is the way to do that and what I am missing

Answers

  • S_Oliver
    S_Oliver ✭✭✭
    Are you using Unity and Photon Pun ?
  • Yes, sorry for not stating that right away, latest pun version and Unity ver 2017.4.0f1
  • S_Oliver
    S_Oliver ✭✭✭
    Ok,
    I assume you are using Unity NavMesh / NavMeshAgent.
    You can do it like that.
    On the MasterClient the Agents calculate the Path doing what their should do, add the PhotonTransformView to to the Agent to sync the Rotation and Position.
    On all other Clients you disable the NavMeshAgent Components and just let them sync their own position.

    Thats the easiest way to handle this.
  • bogdanJoca
    edited August 2018
    I know about that option, but wouldnt that way be to costly for the 500 msg/sec limit, with 60 creeps, this way, i would have bigger bandwith but less messages per sec, and I saw a video on youtube that gave me the idea, but there is no further explanation, but the idea is to use RPC to sync path arrays, then use those arrays locally on clients to move agents, but I want to know how to sync short array and how to transfer ownership so i can use the array locally on clients, and I am using aron gronbergs a* pathfinding
  • Hy, yeah I saw that but havent really checked it yet, but I have another idea to network pathfinding, but now I am on a vacation, when and if i manage to make it work ill post here
  • S_Oliver
    S_Oliver ✭✭✭
    That would be nice! Im started working with Unitys NavMesh - NavMeshAgent and try different things