Efficiently syncing hundreds (or thousands) of objects

Options
Hi there,

I'm developing a multiplayer 3D space shooter, and I'd like some advice on efficiently syncing the position & rotation of asteroids, potentially hundreds, along with other things such as AI ships.

I'm given to understand that this is a disastrous task, and that having a few hundred moving objects with photonViews would be very unwise. I have some ideas on ways to go about it, but I'd love some clarification and further advice. I'm a little rusty with Unity as it's been a while since I last used it, and I'm a relative novice at network programming, however in its current state I've got players and basic weapons working.

Asteroids
These are rigidbodies that may or may not be moving at any given time

AI
These are consistently moving ships that will likely need the same syncing accuracy as my players have (full stream sync with lerping)

I'm thinking that the server should control these elements, but only worry about objects that are within a certain radius of each player. This begs the question whether thousands of objects all with photonViews can be largely disabled and re-enabled with relative ease. I'm not too sure how feasible my compartmentalisation idea is, so any pointers an further advice on this would be appreciated.

Comments

  • 1. Only sync area of interest.
    2. You could group asteroids , and make some of them have a leader , doing some deterministic movements based on the leader , this way there would be the illusion of having them sy ched.

    So , just have per ship netView and then select a leader and group some asteroids and make them follow the leader without needing a netView.
  • PowerLight wrote:
    1. Only sync area of interest.
    2. You could group asteroids , and make some of them have a leader , doing some deterministic movements based on the leader , this way there would be the illusion of having them sy ched.

    So , just have per ship netView and then select a leader and group some asteroids and make them follow the leader without needing a netView.

    I'm not sure how your leader idea would work when each asteroid is a rigidbody that can be individually interacted with.
  • Hi! I am wondering what you did to solve the issue with having 1000's of multiplayer objects... I am facing the same issue... I found that if I make each player populate the room with 400 items it turns into a message flood and I go well above the 500 messages per second barrier... Thinking of having a delay on the objects if possible.. like a big array that gets sent out every 3-6 seconds with updated positions... still trying to figure this one out..
  • Tobias
    Options
    Please read the other posts on this topic. We always replied that the Photon Cloud game logic is not built with this in mind.
    The Photon Server SDK gives you the flexibility to implement this but this use case is always related to a lot of customization...
  • I have tried to convert my working photon networking game to a smartfox2X server implementation without the instant success I would of wished.... there is a feature in smartfox that has a MMO feature AOI (area of interest) that is really appealing.. Just a little bit of a nightmare to get working as I have to implement server side JAVA extensions with unity's C# gamelogic. Wondering what kind of server side logic is handled in photon's server...

    I managed to get the AOI system working just getting AOI Items and other game features became very tedious. I just have a vision of a game that has hundreds / thousands of players with equal number of items very troublesome to create as Photon has extreme message limitations mixed with CCU while smartfox has no message limits just CCU... what a nightmare.

    I fully understand the limitations of network bandwidth and the breaking point of messages, just seemingly see it extremely hard to create a game with hundreds of items without controlling the server directly.

    update: I just been looking over the photon server SDK docs.. and I have seen there is a MMO feature as well. with Area of Interest (Interest Areas). Very exciting news. I am in the process of getting a server setup and am hoping to have some rapid success.
  • donnysobonny
    Options
    I too have the same issue as yours (although I have not come to tackle it yet). I am currently working on an MMO game that involves players having the ability to fly around a universe, where landmarks in the universe translate to rooms in Photon. Although I don't intend to have dynamic objects within the same scale as yours (the asteroids in the game I'm working on are far more likely to be static objects that have minimal interaction capabilities), I too worry about how scalable I can make the game with the tools that I am using.

    I also looked into using SmartFoxServer for the exact same reason, and was also turned off by the idea of having to use Java server-side (I'm not a fan at all of Java). I didn't even attempt to implement it so it's good to know that I didn't waste any time!

    Tobias made a suggestion to me a week or so ago, which may or may not be something that you have considered but since playing around with the idea I have noticed an increase in performance and flexibility. Tobias suggested that I avoid using PhotonViews altogether, and use custom properties and events, which appear to be the tools that are used to make the MMO extension work. The RaiseEvent and RaiseEventOptions classes are what you want to check out. Take note of the interestGroups property of the RaiseEventOptions class and how that allows you to implement interest management. No idea if this will help you or not but it has certainly opened my eyes to some possibilities.

    Really keen to hear how you get on with this. I haven't yet gone for the Server solution, as I can't yet justify it (I'm still actually using PUN), so it would be great to know how you get on.
  • TechCor
    Options
    If you use the server solution, you pretty much have total control over messaging. You can have your server process incoming messages and then send only relevant information or nothing at all. You can pick and choose to send messages to whichever clients you wish. It's about as "to the metal" as you can possibly want to get without writing your own socket code.

    Also, the load balancing server is incredibly useful when it comes to scalability. You can pop a new game server up and connect it to the master and it will divide the rooms up between the game servers appropriately.

    It took some getting used to, but I've definitely become a fan of Photon Server.

    Now if only they could fix up that "Photon Chat" thing...
  • Tobias
    Options
    SkyboardStudios: Yes, there is a MMO project in the Server SDK. It does Interest Management and defines a few base entities that might be interesting. Aside from the basic setup, this is no full blown MMO solution either. We know that the requirements and solutions are usually very different per game and so, we just did a foundation.
    It's being used in "Das Tal", afaik: http://www.das-tal-game.com/home

    The more you want to synchronize, the more you have to go into details and optimize your solution. If one entity has a byte more or less doesn't matter but when there are thousands of entities, each byte per entity makes a difference.
    Photon's generic solution is on a fairly high level but very customizable and open for leaner implementations with more logic on the server side.

    Donnysobonny: Thanks for bringing up that suggestion. It's cool you chime in to this discussion.
    TechCor: Thanks for your post, too. Glad to read you now have a good opinion about the Server, too!