So, if I have a network game going and I let people join while the game is running… (as apposed to requiring everyone to join before the game starts and then un-registering the host so no one else can see it.)
All loadlevel stuff is buffered, so when the “new” person comes in, they get a new fresh level… But…
What about the elements that I have destroyed before they come in? How do they get the message to destroy the objects that should not be there anymore?
Example:
I start the game… I am a car and I collect 2 of the 6 powerups in the level (I get awarded the points and then the powerup gets a Network.Destroy to remove it from everyones level)… then Bill joins the existing game and he sees the level and me driving around… but he also sees all 6 powerups as they were originally Network.Instantiated.
How does Bill’s “game” ever know to remove the items that were destroyed if there is no way of buffering the destroy command?
Do I have to manually track on the “server” what has been removed/destroyed and have all newly instantiated game items call back to the server and query if they should kill themselves or not? Is there not a cleaner way of doing this?
Hopefully I have missed something obvious, and some clever chap here will “make my day” by pointing me to something simple I missed
A Network.Instantiate that is only ever called on the server machine that has its RPCs buffered to allow joining clients to instantiate the correct elements SHOULD allow for the removal of the buffered instantiate call IF the object has been Network.Destroyed.
My logic directs me to the place where the networking technology has everything I need to NOT have to manually track the creation and deletion of network items in my own arraylist or hashtable… if an instantiate is buffered for an object on its creation on the server, why is that buffered instantiate RPC not deleted when the object is destroyed.
So, an alternate way of dealing with this is that I am now not using Network.Destroy at all, but instead I am getting my objects to call an RPC on itself to kill itself that uses RPCMode.AllBuffered and then just doing a normal Destroy instead on each client.
This is working as excepted and seems to be a cleaner method than maintaining an ArrayList of items to query to see if they should kill themselves or not.
If there is still a way of sidestepping this by using Network.Destroy differently, I would love to know about it.
I haven’t really looked to a great extent into networking, but there is a Network.RemoveRPCs that takes a NetworkView. Each powerup has a network view, right? So when it is destroyed, I think if you use this function, it will remove the messages associated with it from the buffer, and new players will not receive them anymore.