MMORoom Demo Code PROXIMITY_LIST_UPDATE Not Firing

Post here your questions about the Unity / .Net / Mono / Windows 8 / Windows Phone 8 API for SFS2X

Moderators: Lapo, Bax

klbytec
Posts: 4
Joined: 29 Jan 2015, 02:52

MMORoom Demo Code PROXIMITY_LIST_UPDATE Not Firing

Postby klbytec » 29 Jan 2015, 20:28

Basically I have not changed anything in the demo code downloaded so it supposedly should just work, I thought?

I downloaded the latest MMORoom server demo code and the Unity C# API demo a few days ago, didn't change any of the code. It runs fine up to the point that I can see on the server log multiple players had joined the same room. But the problem is, the players don't see each other on the map even though they spawned at the same spot. Both players can walk around, and the map is small and I made them walk to the same spot, but PROXIMITY_LIST_UPDATE event is never fired. The do see other events fired in GameManage, such as USER_VARIABLES_UPDATE and CONNECTION_LOST, so it is working.

I read a few threads on this and one of the reply was:

"When a client joins, it doesn't receive updates until it sets its position in the MMORoom.
When the position is set, it will start receiving data about the players which are inside its Area Of Interest only."

I am seeing the demo has set position by sending to server a SetUserVariablesRequest in SpawnLocalPlayer() and FixedUpdate(). Is this code not doing what I think it's doing, or do I need to manually add more code to the demo?

Thanks.
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: MMORoom Demo Code PROXIMITY_LIST_UPDATE Not Firing

Postby Lapo » 30 Jan 2015, 10:43

Hi,
I am not sure if I understand the problem correctly.

If you see the other animated colored cubes going around in the demo then the PROXIMITY_LIST_UPDATE is working correctly.
If the event didn't work the rendering would not work either, because it is specifically that event that tells Unity which NPCs to render, which has entered the AOI, which have left it etc...

Does this help?

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
klbytec
Posts: 4
Joined: 29 Jan 2015, 02:52

Re: MMORoom Demo Code PROXIMITY_LIST_UPDATE Not Firing

Postby klbytec » 02 Feb 2015, 07:42

Thanks for replying.

I mean, they appear to be in the same room in the server log, but on the two clients rendering colored squares or sphere, the players don't see each other. So even though they entered the same room, player 1 on one client doesn't see player 2 on the other client.

Or am I using the demo incorrectly? I run one player on Unity, I also run the same build via Xcode on iPhone. I expect to see two players on both Unity and on the phone. Further more, I ran the Flash html file given in the demo but I still don't see anyone. The server does correctly log that they all entered MMORoom: UnityMMODemo.

I must be missing something major, as that I have no changed any code but I can't seem to receive PROXIMITY_LIST_UPDATE events. I appreciate any help in pointing me to the right direction.
narfi
Posts: 14
Joined: 30 Jan 2015, 20:22

Re: MMORoom Demo Code PROXIMITY_LIST_UPDATE Not Firing

Postby narfi » 02 Feb 2015, 20:02

I am having the same issues.
I installed the server on AWS EC2 and have SmartFoxServer2X Multiplayer SDK from the unity asset store.
I moved the Extentions folders and the spacewar zone to their appropriate places on the server.

All of the examples work except for the mmo example which acts exactly like described already in this thread.
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: MMORoom Demo Code PROXIMITY_LIST_UPDATE Not Firing

Postby Lapo » 03 Feb 2015, 09:14

Actually the MMODemo is meant to be run locally. It runs very fast sending lots of packets, more than a remote connection can handle.
We have a note in the tutorial saying:
It is important to point out that this approach is good for local testing but it's not optimized for online playing. This way we will be sending too many updates per second, quickly saturating the internet connection. It is beyond the scope of this Example to go in the details of how to optimize the message rate. If you want to learn more please check the other tutorials available.
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: MMORoom Demo Code PROXIMITY_LIST_UPDATE Not Firing

Postby Lapo » 03 Feb 2015, 09:15

klbytec wrote: I appreciate any help in pointing me to the right direction.

Does the example work locally with two unity clients?
E.g. two webplayer clients?

Maybe the problem is only with the iOS export?
Lapo

--

gotoAndPlay()

...addicted to flash games
narfi
Posts: 14
Joined: 30 Jan 2015, 20:22

Re: MMORoom Demo Code PROXIMITY_LIST_UPDATE Not Firing

Postby narfi » 03 Feb 2015, 22:48

ok thanks.

I hard read,
It is important to point out that this approach is good for local testing but it's not optimized for online playing. This way we will be sending too many updates per second, quickly saturating the internet connection. It is beyond the scope of this Example to go in the details of how to optimize the message rate. If you want to learn more please check the other tutorials available.


To mean that it was not optimized for use beyond the tutorial, not that the tutorial itself actually wouldn't work. It seems a bit silly to have a tutorial for a networking MMO room that is incapable of functioning over the internet.

Would reducing the number of simulated players in the extension make it function, or would that not even make it possible?
klbytec
Posts: 4
Joined: 29 Jan 2015, 02:52

Re: MMORoom Demo Code PROXIMITY_LIST_UPDATE Not Firing

Postby klbytec » 04 Feb 2015, 02:22

Actually the MMODemo is meant to be run locally. It runs very fast sending lots of packets, more than a remote connection can handle.


I am running two instances locally. Although since I cannot get two Unity to run at the same time on one machine, I used another machine, so:

1. Server running on machine 1
2. Unity on machine 1 Connection pointed to 127.0.0.1
3. Unity on machine 2 Connection pointed to 10.0.1.x

Both Unity instances appeared on the server log saying they entered the same room. They do not see each other on either of the maps, and unity debug message never showed that PROXIMITY_LIST_UPDATE events get fired.

As for using web player, same thing.

1. Server running on machine 1
2. Run in browser on machine 1 file:///...SFS2X_Unity_Examples/MMORoomDemo/deploy/client/MMORoomDemo.html
3. Run in another browser on machine 1 file:///...SFS2X_Unity_Examples/MMORoomDemo/deploy/client/MMORoomDemo.html

Both players joined the same room as it appeared on server log, but still don't see each other on the map.

Am I doing this wrong? I didn't change anything code in the demo.

The server log shows that they are in the same room, which really throws me off, telling me I am doing this correctly yet just cannot get PROXIMITY_LIST_UPDATE to fire. It's almost there but not quite. Eventually this won't be running locally, but I just want to get to the first step.

Thanks.
narfi
Posts: 14
Joined: 30 Jan 2015, 20:22

Re: MMORoom Demo Code PROXIMITY_LIST_UPDATE Not Firing

Postby narfi » 04 Feb 2015, 03:35

You dont need another machine to test it. You can just build your project, and make sure that run in background is selected in the build settings so it stays connected, then once its built open the exe a couple of times. You can see it works doing that on the object movement tutorial.
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: MMORoom Demo Code PROXIMITY_LIST_UPDATE Not Firing

Postby Lapo » 05 Feb 2015, 09:08

I have retested the demo and found a similar problem only with version 2.9.x.
I should have asked for errors in the logs, as there is a server side problem with the demo Extension, which is responsible for triggering events.

The demo Extension written in python doesn't seem to be able to run due to a strange "import error" which seems to be caused by an incorrect initialization of the Python interpreter. The reason is not clear yet.

In any case there is a simple way to force the Python interpreter to initialize which is to add a Zone-level extension.

To fix this issue simply open your SFS2X/zones/BasicExamples.zone.xml file, scroll to the bottom (line 110) where you will see this:

Code: Select all

  <extension>
    <name></name>
    <type>JAVA</type>
    <file></file>
    <propertiesFile></propertiesFile>
    <reloadMode>AUTO</reloadMode>
  </extension>


Replace it with this:

Code: Select all

  <extension>
    <name>pyTest</name>
    <type>PYTHON</type>
    <file>Simple.py</file>
    <propertiesFile></propertiesFile>
    <reloadMode>AUTO</reloadMode>
  </extension>

Save and restart the server. You should be good to go.
I've tested with two WebPlayers and it's working as expected.

If there's any problem keep an eye on the server logs and let us know.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
narfi
Posts: 14
Joined: 30 Jan 2015, 20:22

Re: MMORoom Demo Code PROXIMITY_LIST_UPDATE Not Firing

Postby narfi » 06 Feb 2015, 01:24

I am not sure if this is the same issue or not, but it seems like it.
I wasn't able to get anything from the server when the room was toggled to mmoroom. Not PROXIMITY_LIST_UPDATE,not USER_VARIABLES_UPDATE, I even tried MODERATOR_MESSAGE and sending a message and kicking from the admin panel, but nothing was triggering. (I had debug messages in each function)

So I played a little more with it. In a normal room with no extentions and mmoroom toggled OFF,

Code: Select all

         if (timer > 20) {
            Debug.Log ("It has been 20 frames, lets do something already!");
            Debug.Log ("The most Recently Joined room: " + smartFox.LastJoinedRoom.Name);
            FreshList = new List<User>(smartFox.LastJoinedRoom.PlayerList);
            //NewUsers = new List<User>(smartFox.LastJoinedRoom.UserList);
            Debug.Log ("There are " + FreshList.Count + " players in the room");
            Debug.Log ("There should also be " + smartFox.LastJoinedRoom.UserCount + "Users in the room");
            foreach(User x in FreshList){
               Debug.Log ("Player ID# " + x.Id);
               }

            timer = 0;
                  }


Works just like you would expect, and counts yourself if just running the editor, or if you compile and run a few instances of it, it will show how many are actually in the room.

However, without changing anything except for the mmoroom toggle to ON, and restarting the smartfoxserver, it stops working and only reports 0, regardless of how many.
The player variables are changing on the admin panel, so it is getting the updates from each player connected.

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

Re: MMORoom Demo Code PROXIMITY_LIST_UPDATE Not Firing

Postby Lapo » 06 Feb 2015, 09:26

Did you try the fix I posted in my previous message?
Did it work for you?
Lapo

--

gotoAndPlay()

...addicted to flash games
narfi
Posts: 14
Joined: 30 Jan 2015, 20:22

Re: MMORoom Demo Code PROXIMITY_LIST_UPDATE Not Firing

Postby narfi » 06 Feb 2015, 17:12

I tried the fix, (though the xml seems much longer than what you suggested, that section was beyond line 110 a ways and was not the end) and it didn't seem to change anything.
I may have the zone configuration messed up from trying to figure it out?

I thought your fix was just for the mmo demo which you said would not work over the internet anyways.
My test was without any extensions.

I also noticed that my remote admin says v2.9.0 and that you have newer patches on your site.

Today I will try to uninstall and re-install the server and patch it to the newest 2.9.2 and then implement your fix to see if that works.
narfi
Posts: 14
Joined: 30 Jan 2015, 20:22

Re: MMORoom Demo Code PROXIMITY_LIST_UPDATE Not Firing

Postby narfi » 06 Feb 2015, 18:48

Ok,
Fresh server install,
Fresh upgrade to 2.9.2
Changes you recommended above applied to the xml file and saved and server restarted.

Created a new room through the remote admin called TestRoom in the BasicExamples zone.

Is MMO Room toggled to False under MMO Settings tab.

The Debug lines I posted above show number of users in the room and their IDs.



Is MMO Room toggled to True under MMO Settings tab and server restarted.

The Debug lines I posted above shows 0 regardless of number of users in the room.


As you can see I have a debug line showing me it is the correct room.
The remote admin shows them in the room.
The remote admin shows they are updating their user variables.

From the documentation it seems that the MMO room has both .PlayerList and .UserList , but it is not clear if those are for the room or for your connection's AOI.
Another thing I am not clear on is player variables vs player position, I am updating x,y,z for both but would rather not overlap if its not necessary.

Code: Select all

      smartFox.Send(new SetUserVariablesRequest(userVariables));
      //Debug.Log ("SetUserVariablesRequest Sent!");
      smartFox.Send (new SetUserPositionRequest(pos));
      //Debug.Log ("SetUserPositionRequest Sent!");


I know that PROXIMITY_LIST_UPDATE isn't sent until position is set, but I don't think that is the issue since the server is not kicking them out for inactivity, and it is updating their user variables.
klbytec
Posts: 4
Joined: 29 Jan 2015, 02:52

Re: MMORoom Demo Code PROXIMITY_LIST_UPDATE Not Firing

Postby klbytec » 06 Feb 2015, 20:41

Thank you!! This fix works! :D

To fix this issue simply open your SFS2X/zones/BasicExamples.zone.xml file, scroll to the bottom (line 110) where you will see this:

<extension>
<name></name>
<type>JAVA</type>
<file></file>
<propertiesFile></propertiesFile>
<reloadMode>AUTO</reloadMode>
</extension>


Replace it with this:

<extension>
<name>pyTest</name>
<type>PYTHON</type>
<file>Simple.py</file>
<propertiesFile></propertiesFile>
<reloadMode>AUTO</reloadMode>
</extension>

Save and restart the server. You should be good to go.

Return to “SFS2X C# API”

Who is online

Users browsing this forum: No registered users and 25 guests