Expanding 999 limit for PhotonView.
The whole answer can be found below.
Try Our
Documentation
Please check if you can find an answer in our extensive documentation on PUN.
Join Us
on Discord
Meet and talk to our staff and the entire Photon-Community via Discord.
Read More on
Stack Overflow
Find more information on Stack Overflow (for Circle members only).
Expanding 999 limit for PhotonView.
CyXoB
2014-04-26 11:58:56
I have much more then 1 thousand game object at single room, but photonView Max ID is only allow index of 999. I want to expand that limit. Is that possible? And if "yes", what restrictions it will have or what kind of a problems it will create?
Maybe its also possible to add PhotonView component at runtime, to let interacting objects synchronize theirs values, when its necessary?
Thank you.
Comments
It is possible and the road you have to go is described in the PDF / CHM file in the package. There is also a brief introduction to manual allocation of ViewIDs and PhotonViews. The explanations are pretty brief but give them a try and let us know what is unclear, ok?
Having that many objects in a networked game will create all kinds of issues. It's pretty difficult to make a FPS with more than 30 players and those only sync player positions, properties and their actions but never more than a couple of hundred things. You CAN have thousands of objects but if they move or need other updates frequently, you will run into bandwidth issues.
What are those thousands of GOs?
Thanks for reply, Tobias. I'll give it a try, when and if it's become necessary. Hope that wouldn't. Furthermore, I think I missed out some important thing about networking fundamentals. So, I got some ideas to avoid expanding PV ID limit. Gonna try them first. But whith that, I got more question :D Well, they all will be solved, especially with such responsive community :)
Btw, about my GOs... Maybe you know or heard about Space Station 13. My team working on 3D remake of it. Hard work, you know - vacuum and gravity phisycs, fully destructible and recoverable environment etc. There is a lot of things needing to synch over the network, but happily - not constantly. As I see, it depends on optimal packet size. So, many of them can be synched by one PV and almost at a time.
Any way, I still need some more clues about PUN. Thanks again for response, and until next time ;)
Ok, I'm still got no progress.
So, the question is - do that GO (to be instantiated and destroyed through network as a scene object) need a PV component? Or there is any another solution for such kind of GOs? I hope so, because there will be many of them at one scene.
As always, there are lots of different options how to implement this.
Things to think about: You can use PhotonNetwork.Instantiate but that requires a unique viewID per object you instantiate and each must have a PhotonView. If you don't move your GOs and never need to identify them, you can also send an RPC "create object X at place Y". Everyone does that and you're done, too. In that case, player who join later will only get the RPC if you buffered this RPC. If your game goes on and on, the number of RPCs for new objects will grow. At some point, you can't send those all to a new player and things will break. If you need to destroy a GO later on, you might need some way to identify your GO on all clients. Then you're more or less back to viewIDs or something you come up with.
What you should learn from this: There is no definite answer. Much less of we only know what you want to do right now. You have to keep some things in mind. If there is no good answer: Experiment :)
leonardpaiva
2020-06-20 13:59:18
Hello, i am just starting studies with photon, and I apologize for taking advantage of the topic to clear this doubt, but I believe it has to do with the topic.
How many buffered RPC objects would be a problem to new players entering in the scene? if i have something like 500 enemies to be spawned to new players, that would be a problem?
If you have that many objects being updated you probably don't want to be using buffered rpc calls and should use a different method to keep the objects in sync.
leonardpaiva
2020-06-24 13:10:58
what approach shoud i be using?
It's a very open-ended question.
How much data do you need to be synchronized?
Are there any ways within your project that you'd be able to mask the sync of large amounts of data?
Is there a case for using player properties from some data and RPC calls for the rest?
leonardpaiva
2020-06-26 12:33:20
The game is a room with 4 players, trying to survive waves of monsters, the monsters will be appearing endlessly until the players die, and the more score the players score the faster the monsters appear. So I imagine around 200 monsters, but that number is only possible considering a scenario in which players avoid killing monsters and run around the room.
Any spawned monster will follow one player, i am using nav mesh set destination to do that nav.SetDestination(player.position);
"Are there any ways within your project that you'd be able to mask the sync of large amounts of data?
Is there a case for using player properties from some data and RPC calls for the rest?"
Sorry, I am asking because i never did something like that before, i am new to photon and to unity aswell, i am not sure how to answer that... i can save a list of monsters spawned. to keep track of them, them if a new player join the room, i can use an RPC to get this list from the Master, the list will have the monsters transform and the player being followed, i could do something like that?
OneManArmy
2020-06-26 16:38:15
you don't have to attach PV on every object you want to sync.
For example in this video i am syncing 600 AI via RPC's (just one PV)
https://www.youtube.com/watch?v=wmt_rUSbA_c
leonardpaiva
2020-06-26 17:36:49
@OneManArmy wrote: »
you don't have to attach PV on every object you want to sync.
For example in this video i am syncing 600 AI via RPC's (just one PV)
https://www.youtube.com/watch?v=wmt_rUSbA_c
really cool, theres any tutorial or video that explain how you did it? you mean one PV, something like a bot manager that control all bots sending rpcs any time something happen to one of them?
OneManArmy
2020-06-27 00:12:11
No, i'm not making tutorials.
I am sending RPCs with constant rate (10/sec).
Every RPC contains info about all AI position and rotation on Y axis (basically 4 floats).
On master run AI logic and on other clients just sync position/rotation.
Nothing complicated.
@leonardpaiva wrote: »
The game is a room with 4 players, trying to survive waves of monsters, the monsters will be appearing endlessly until the players die, and the more score the players score the faster the monsters appear. So I imagine around 200 monsters, but that number is only possible considering a scenario in which players avoid killing monsters and run around the room.
Any spawned monster will follow one player, i am using nav mesh set destination to do that nav.SetDestination(player.position);
"Are there any ways within your project that you'd be able to mask the sync of large amounts of data?
Is there a case for using player properties from some data and RPC calls for the rest?"Sorry, I am asking because i never did something like that before, i am new to photon and to unity aswell, i am not sure how to answer that... i can save a list of monsters spawned. to keep track of them, them if a new player join the room, i can use an RPC to get this list from the Master, the list will have the monsters transform and the player being followed, i could do something like that?
I don't want to sound like an asshole but if you're new to Unity and new to the principles of networked games then I'd suggest working on a smaller simpler project to start with.
To help with your question, you could run some tests to see what performs best for you. Attaching a Photon Transform to each monster or having monsters controlled in clusters by some sort of controller class that sends relevant data when needed. The second approach has the benefit of you being able to control what and when you send data. A player only needs data from monsters nearby not all 200 on the map.
Back to your first question, I can't see where you'd be using buffered RPC calls within this. By default Photon.Instantiate and Photon.Destroy would keep all relevant monsters in the game.
leonardpaiva
2020-07-11 14:51:08
jeffries7 you are not "sounding like a asshole", all help is very welcome, you are right i should be working on something simpler, i can just decrease to 10 enemies in my scene and do all the tests i need to imagine a scenario with 200 monsters, that's more or less what I'm doing.
Right now I'm at a point where I can pass a list with the state of the enemies by serializing a List to json and sending it via RPC, as described by OneManArmy, I will continue doing tests on the performance that is what concerns me the most, and i will come back here to give my feedback, thanks for the help OneManArmy and jeffries7.
Hi all, If I have many enemies need to sync all players, how to do that without PhotonView , thank you
Please don't hijack such old threads if your question is really that high level.
Have a look at Fusion. If you don't know how this is done in PUN, no need to learn it anymore.
Back to top