Max Number of players in proximity

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

nepoez
Posts: 40
Joined: 13 Aug 2016, 04:28

Max Number of players in proximity

Postby nepoez » 23 Oct 2018, 03:03

Hi. I am currently already using the proximity list in a MMORoom. However I'd like to add another layer of optimization.
I want it so if there are over x amount of players returned from the proximity list. I want to filter out the farthest ones.
For example if the proximity list returns 1000 players all in the same AOI, as it can happen. I currently manually store all their positions, and then loop through the 1000 players and filter out the farthest ones so only the closest 100 players will be in this list.

- Does Smartfox have something like this already so I don't have to do this maually?
- If not, Since MMOApi has a setUserPosition(), is there an easy way to get this userPosition back so I don't have to manually store positions separately?

Thx
User avatar
Lapo
Site Admin
Posts: 20392
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Max Number of players in proximity

Postby Lapo » 23 Oct 2018, 08:44

Hi,
- Does Smartfox have something like this already so I don't have to do this maually?

No, we don't have another filtering layer on top of the AoI.
Your request triggers my curiosity. If you have to filter out users at the edges of the AoI wouldn't it suffice to shrink the AoI itself instead of letting it calculate more data than what is needed, and then filtering it out?

- If not, Since MMOApi has a setUserPosition(), is there an easy way to get this userPosition back so I don't have to manually store positions separately?

You can use this:

Code: Select all

Vec3D pos = (Vec3D) target.getProperty(MMOHelper.USER_LOC);


Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
nepoez
Posts: 40
Joined: 13 Aug 2016, 04:28

Re: Max Number of players in proximity

Postby nepoez » 24 Oct 2018, 00:30

Thank you for your response. That is indeed what I ended up doing. The downside to that is that now we are limited to seeing only people closer to you. Imagine an extreme example of you standing in one spot. However 500 people are all standing 20 feet from you. Now if my code detects that is's over 100 people and all I do is shrink my AOI, I have now effectively filtered out all 500 people instead of just showing 100 of them.

I ended up still shrinking the aoi just because:

1.) Performance might be better
2.) I'm hoping this is an edge case.
3.) either approach I take is flawed because reducing list of players in AOI does not guarantee reducing how many people I see, it just means I'm removing myself from their view as I'm not broadcasting my position to them, but they can all still be broadcasting their positions to me. For what I really wanted the logic would have to be inverse, e.g. I only receive messages from players who are in my AOI, but that's not how AOI works :(

So using my flawed approach, I'm hoping that the average of the effect will still help me achieve optimization when a space is too jammed.
User avatar
Lapo
Site Admin
Posts: 20392
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Max Number of players in proximity

Postby Lapo » 24 Oct 2018, 07:59

When you talk about performance are you referring to client/rendering performance, I guess?
In theory, and depending on how your game works, you should already be filtering out a significant amount of players via the limits of your view, no?

What I mean is that if there are 500 players in your AOI you will likely be rendering 40-50% of them due to the constraints of the camera field of view.

From there you might also apply some extra filtering based on distance (as you proposed), only when the are is too busy/cluttered. For instance you might establish that more than 50 players in view can cause performance issues on some hardware and then filter extra player models based on distance.

This way, I think, you could be able to efficiently remove some of the rendering load maintaining interaction with all clients that are closer to the current player.
Lapo

--

gotoAndPlay()

...addicted to flash games
nepoez
Posts: 40
Joined: 13 Aug 2016, 04:28

Re: Max Number of players in proximity

Postby nepoez » 24 Oct 2018, 16:06

Hi friend. Yes that is what I'm talking about. I do indeed do filtering on client side with 1.) LOD, distance etc. 2.) On client side is number if players reach threshold, only the closest ones under threshold guarantee to show full detail. These 2 optimizations help with reducing details. I had contemplated to ad 3rd optimization via client too, to cap the number of players to render completely. But that doesn't stop the client from receiving network packets that aren't even used. That's why I decided to do it on server side. E.g. in the aoi other are 500 players, if I filter 400 of them out I only see 100. It does safe render processing but my client will still be receiving 500 position updates that don't even get used. It's a mobile game too so it needs to be more conservative on anything possible.

I appreciate your help. If you can think of anything else I'd love to hear more. Thank you very much again.

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 4 guests