Network-Culling with sending nothing to other groups I'm in

Options
Hi Guys,

I decided to open a new thread for this, because on one hand I want to share my Idea with you, on the other hand I don't know how to achieve it. I am trying to make a 50 people Battle-Royale, and I'm really sure with my idea it's possible to achieve it with pun, just by doing some little changes. It could only work, because my game is a 2D-Top Down-Game. In a 3D-Shooter you are looking forward, so it's really necessary to sync what's in groups around you, because you are looking into more areas, which are more far away. The Culling scripts works that way, that u're in a group which consist of two (when you're in the border of the map) or 4 groups, when you're in the middle fields. And then there's the other thing, that you will also send messages to other groups (ya, in a smaller amount, but you are sending!). In a 3D-Game as already said, this is really necessary, but still the message amount will be big, when there is may people playing.

Please take a look at my picture:



In a 2D-TopDown shooter you are seeing other people in zones only when your screen is in this zone. I made a simple painting in Affinity Designer to show what I mean. There is three cases:
1.) The player is only in one zone
2.) The Player's screen crosses two zones
3.) The Player's screen crosses four zones

The Small blue border is the Player's screen, the red border around is a bit bigger then the blue one, because i want bullets, that are spawned, to go a bit further then the player's screen. So the Red Border is the Border, which will define, which groups I am in. If there Is a player in the other corner of the map running around - I really don't care, I don't need messages from him at all, means zero messages, about his positions. Imagine you're having 50 People walking around, and every of them sends one message, the message will reach 49 other players. If now all players run around, the amount of msg/s increases drastically, because everybody is syncing his position around - even it's only one time a second.

How can I tell PUN to only send messages to the groups my Red Corner is in? Yes of course there is some other things, I need to send to group 0, like items that were picked up or something, but at least this will not happen so often like syncing around my position and rotation constantly and receiving it constantly from other players - even if it's one time a second. The bigger the amount of players, the bigger the messages will be, even if only sent 1 time a second.

Is my Idea a good Idea? I think we could make 50 People play like this and stay most of the time under 500 msg/s, because I could make it so that players, when they spawn at the beginning, are really divided constant over the map, so that every one starts far away from others. Then I only send more messages, if one or more people cross their ways, but the rest of the players in other zones really don't need to know where they are - only if they are dead and which of the items were picked.

So how can I achieve this by changing the code in the Culling-Scripts? I want a border around my player, and my player will send messages maximum to four groups, and to the groups around zero.

I hope you can help me with this!

Greetings,
Dario

Comments

  • S_Oliver
    S_Oliver ✭✭✭
    edited August 2018
    Options
    Hello @Dochder , this is an rly interesting Topic, I personally hadn't the time to dig into it.

    https://doc.photonengine.com/en-us/pun/current/gameplay/interestgroups
    Therevis a pdf link you should read it, its pretty interesting.

    If I would start with something like this, I would start with something easy like creating spatial hash/ simple grid for my map and try to notice in wich area/grid node the player/ camera is, Each gridNode /area is a interest group wich u, assign to.If this kinda work I would start testing /implementing with pun.

    You attempt is good, thats more or less how it works.
    But im not sure if this could handle 50 player, since it always could happen that more than 10 players in one group and that's where the problems start again
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @Dochder,

    Thank you for choosing Photon!

    Will add this link for reference and for a background explanation on the network culling script provided in PUN1.
  • Dochder
    Options
    Hey Guys,

    Ya I know both the Interest-Groups and Culling-Topic on the site already, and I started with this, but in the end it was the best to overthink everything and start from scratch.

    And I good some good news: I was hard-coding the last 5 days, and I finally made it, it's working! The support gave me some good hints, and now everything is how it should be. Since I don't yet have 40-50 people to test it out I cannot tell, what the Result will be.

    @S_Oliver: Yes you are right, but in the current Culling Solution this can also happen to you, and what really a big thing in there is, that you are sending constantly those messages to group 0, which is synced with 32 people (EACH!) at the same time + the "subgroups" - as I said, for 3D this is really a perfect solution, and to be honest, I'm not understanding Mike's code, but for me this guy is genious. But: This sending to group 0 and all the subgroups really is producing a big amount of messages, which is not necesarry for 2D. When I put 32 Players with only 1 msg/s into the calculator on the website, it says 1024 messages (what would happen, if everyone moves at the same time).

    https://www.m2h.nl/network-traffic-culling/

    In the 4 Red Zones he's listening to a 100%, the blue zones 50% (which is always a whole quarter of the map!) and the rest of the zones 10% (where for sure group 0 also is). And with 32 people he said he's doing a roundabout 1000 msg/s. And only listening to those 50% in the blue zones and 10% of the rest I would estimate a number between 300-600 msg/s, because it's many players syncing all the time.

    In my game I will for sure not prevent to get over the 500 msg/s all the time, I'm aware about that, but I think in general, this will be possible (maybe also not with 50 players, maybe it's 40, I don't know yet because the game is not ready yet), but since 500 is not a hard limit and will (I think) not always be exceeded (since players will also "stay" and not move all the time), it can be that it's under 500, and when you make a Summary for one "round", which will be between 15-30 minutes, the 500 msg/s could be an average - could - i cannot promise. I think what the Photon Guys mean is, that you don't exceed that limit all the time, cuz it's clear that this is overusing their servers constantly.

    What I have to do in my game is, to be sure that players are not able to all start at the same point and that they are really spread a bit more constantly. I got some ideas about that too, some ideas that are not only about letting them spawn randomly, we will see.

    For now I will have to do some testing on this (also with my friends when my alpha starts), then maybe I will have to adjust some things here and there, make some overall improvements, and when I have it, I will share it with you. Since I have to think about some ideas with spreading the players, and I got all the graphic work left to do, it will take some time.

    Thank you for your answers!

    Greetings from Stuttgart,
    Dario
  • stevie
    Options
    I did something similar. However, I track the neighbouring sectors because of sector movements. To further reduce msg/s I predict more when input hasn’t changed. In reality some users stop sending messages for a few seconds entirely. What I’m saying is that If one is going straight without any movement change you don’t need any message at all.

    Same goes for shooting or other corrections: Only send if the value has changed.

    This will greatly reduce the msg/s and allows you to handle more players.
  • Dochder
    Options
    Ya of course, that's what I said up there also. My Players also only send new messages when they move / change Position, when they stay, they are not sending anything.