Getting unpredictable results with proximity list update

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

kheldorin
Posts: 11
Joined: 25 Jan 2017, 08:46

Getting unpredictable results with proximity list update

Postby kheldorin » 26 Jan 2017, 22:00

This occurs only when there's at least one other player in the mmoroom.

Player A and Player B joins MMOroom 1.

Player B leaves to join MMOroom2. setuserposition is called on the server side.

Player B comes back to join MMOroom1. setuserposition is called on the server side.

On the clientside, I expect there to be an initial proximity list update to tell player B what is around him in mmoroom1.

But I don't get that update, just the subsequent updates.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Getting unpredictable results with proximity list update

Postby Lapo » 27 Jan 2017, 08:40

Hi,
I need a few clarifications.

Player A and Player B joins MMOroom 1.

Player B leaves to join MMOroom2. setuserposition is called on the server side.

By who? User A?
Player B comes back to join MMOroom1. setuserposition is called on the server side.

called by User B?

On the clientside, I expect there to be an initial proximity list update to tell player B what is around him in mmoroom1.

It will fire only if there's "anything" around player B. If no other users or MMOItems fall within User B's AOI no event will be fired.
This is not different from when you enter the Room the first time.

The PROXIMITY_LIST_UPDATE works as a "delta" (i.e. a difference), meaning that it will only tell you which users or items have been added/removed from your current state. If the player lands in an area where nobody is there, there will be no updates until someone enters the AOI.

hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
kheldorin
Posts: 11
Joined: 25 Jan 2017, 08:46

Re: Getting unpredictable results with proximity list update

Postby kheldorin » 31 Jan 2017, 04:16

Sorry for the late reply. Was the holidays/weekends here.

The setuserposition is called on the server side when the player joins the room. Something like

Code: Select all

   addEventHandler(SFSEventType.USER_JOIN_ROOM, SpawnPlayerHandler.class);
   ...       
       User user = (User) isfsEvent.getParameter(SFSEventParam.USER);
       Room room = (SFSRoom) isfsEvent.getParameter(SFSEventParam.ROOM);
       Vector3 position = new Vector3(36, 0, 43);
       ISFSMMOApi mmoAPi = SmartFoxServer.getInstance().getAPIManager().getMMOApi();
       mmoAPi.setUserPosition(user,  new Vec3D(position.x, position.y, position.z), room);


I was trying to simplify my code to narrow down the cause since the SpaceWar demo worked fine. So I must be doing something differently/wrongly.
I tried to replicate the same settings as the SpaceWar demo.

It turns out that the difference seems to be I'm setting the mmoItem position in the same function. Like when a player joins a room, the code will be like:

Code: Select all

        mmoAPi.setUserPosition(user,  new Vec3D(position.x, position.y, position.z), room);
        MMOItem avatar = createAvatar(user.getId());
        mmoAPi.setMMOItemPosition(avatar, new Vec3D(position.x, position.y, position.z), room);


If I omit the last 2 lines, I'm receiving the proximity list updates on the client side just fine . It's very weird. Maybe that could provide you with clues with what could be wrong.
kheldorin
Posts: 11
Joined: 25 Jan 2017, 08:46

Re: Getting unpredictable results with proximity list update

Postby kheldorin » 31 Jan 2017, 07:09

I think I managed to repro it using the spacewars example in Unity.

In spacewar.cfg, set the speed to 0 and the duration to a very high value.

Let 2 players join a room.
Let player A shoot multiple projectiles.
Let player A switch rooms and then switch back.
Player A doesn't get the update about the initial state of the room even if he's in the AOI.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Getting unpredictable results with proximity list update

Postby Lapo » 31 Jan 2017, 08:03

Thanks,
can you tell me which SFS2X version are you using and what's the version of the C# API?
Lapo

--

gotoAndPlay()

...addicted to flash games
kheldorin
Posts: 11
Joined: 25 Jan 2017, 08:46

Re: Getting unpredictable results with proximity list update

Postby kheldorin » 31 Jan 2017, 08:15

I'm using sfs2x version 2.12. The client api is the one from the unity 5 examples pack. Not sure how to check the version.
kheldorin
Posts: 11
Joined: 25 Jan 2017, 08:46

Re: Getting unpredictable results with proximity list update

Postby kheldorin » 31 Jan 2017, 08:18

oops...didn't check for new api version..

was it already fixed?

Version 1.7.2 [Jan 14th, 2017]
[FIX] Error in adding/retrieving MMOItems to/from the player's Area of Interest.
[FIX] Loop optimization when processing the queued events.


oh nvm..I still see the issue.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Getting unpredictable results with proximity list update

Postby Lapo » 01 Feb 2017, 09:15

We'll try to reproduce it on our end. Stay tuned.
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Getting unpredictable results with proximity list update

Postby Bax » 01 Feb 2017, 16:15

Are you sure in your test the torpedoes were in the AOI range?
Because I can't reproduce the issue.
These are my steps:
- in the spacebar.cfg file set the torpedo speed to 0 and duration to 1000;
- launched the SpaceWar example from the Unity 5 examples pack in the Editor (WebGL mode, but this should be irrelevant);
- logged in as user A; without moving the ship (just rotating it) fired a bunch of torpedoes
- launched SpaceWar example in the browser (Web Player version, as distributed in the example zip)
- logged in as user B; everything is fine: A's starship and torpedoes are on the screen
- relaunched the example in the Editor
- again logged in as user A and again everything is fine: B's starship and previous A's torpedoes are on the screen

Can you please follow the same steps and report your findings?
Thanks.
Paolo Bax
The SmartFoxServer Team
kheldorin
Posts: 11
Joined: 25 Jan 2017, 08:46

Re: Getting unpredictable results with proximity list update

Postby kheldorin » 01 Feb 2017, 16:41

The issue occurs when switching rooms, not relaunching of the editor which is more of a disconnect/relog in.

So create a second room, make a joinrequest to it and then back to the other room.
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Getting unpredictable results with proximity list update

Postby Bax » 02 Feb 2017, 09:20

We confirm there's an issue. We could replicate it using a new example we are working on.
We will start investigating the cause of the problem and update this post as soon as we have more information.
In the meanwhile, thank you for pointing out.
Paolo Bax
The SmartFoxServer Team
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Getting unpredictable results with proximity list update

Postby Lapo » 07 Feb 2017, 17:30

UPDATE: we have fixed the problem.

@kheldorin:
Please drop us an email to our support@... email box, we can provide the update for you to test. Make sure to mention this thread for reference.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
kheldorin
Posts: 11
Joined: 25 Jan 2017, 08:46

Re: Getting unpredictable results with proximity list update

Postby kheldorin » 08 Feb 2017, 01:54

Awesome. Thanks for the update. Looking forward to the new Mmo example too :D.
Might not be able to test the fix anytime soon but will contact you guys when I do.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Getting unpredictable results with proximity list update

Postby Lapo » 08 Feb 2017, 09:00

It would help us if you could test the update on your side so that we can close it, if the problem is solved.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Getting unpredictable results with proximity list update

Postby Bax » 15 Feb 2017, 14:56

Patch 2.12.3 just released, including the fix to the reported issue. Thank you.
Paolo Bax
The SmartFoxServer Team

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 70 guests