NPC not show in MMO Demo

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

Moderators: Lapo, Bax

ganquan
Posts: 38
Joined: 17 Apr 2013, 01:42

NPC not show in MMO Demo

Postby ganquan » 19 Jul 2015, 09:19

Hi
I download the mmo demo, and run the server and client, but in client, i not see any npc. And when 2 clients login, they do not see each other in client.
Is there anything else need to set?

server log is below:

Code: Select all

17:09:08,450 INFO  [SFSWorker:Sys:1] v2.SmartFoxServer     - SmartFoxServer 2X (2.9.0) READY!
17:09:11,123 INFO  [main] v3.SessionFilter     - BlueBox-2X Service (3.0.0) ready.
17:09:39,243 INFO  [SocketReader] sessions.DefaultSessionManager     - Session created: { Id: 1, Type: DEFAULT, Logged: No, IP: 127.0.0.1:53832 } on Server port: 9933 <---> 53832
17:09:39,313 INFO  [SFSWorker:Sys:3] api.SFSApi     - User login: { Zone: BasicExamples }, ( User Name: 11, Id: 0, Priv: 0, Sess: 127.0.0.1:53832 ) , Type: Unity
17:09:39,619 WARN  [SFSWorker:Sys:4] extensions.PythonExtension     - Failed initializing Python Extension: pyTest -> Traceback (innermost last):
  File "<string>", line 39, in ?
NameError: ISFSEventListener

17:09:39,620 INFO  [SFSWorker:Sys:4] managers.SFSRoomManager     - Room created: { Zone: BasicExamples }, [ MMORoom: UnityMMODemo, Id: 2, Group: default, AOI: (25.0, 1.0, 25.0) ]
17:09:39,630 INFO  [SFSWorker:Sys:4] api.SFSApi     - Room joined: [ MMORoom: UnityMMODemo, Id: 2, Group: default, AOI: (25.0, 1.0, 25.0) ], { Zone: BasicExamples }, ( User Name: 11, Id: 0, Priv: 0, Sess: 127.0.0.1:53832 ) , asSpect: false
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: NPC not show in MMO Demo

Postby Lapo » 20 Jul 2015, 06:38

From the logs there is a problem in the Extension not starting up.
If I remember correctly the Python Extension did cause some problem for some folks.

Did you make changes to the Extension?

If not, try this simple workaround. In the Zone you're working with (presumably "BasicExample") add the Simple.py extension which is found under the pyTest folder.
If I remember correctly this solves the initialization problem.

If you prefer not to use python Extensions at all you can download the Java version of the same code here:
viewtopic.php?p=71998&f=1#p71998

thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
aiaustin
Posts: 23
Joined: 19 May 2011, 13:33

Re: NPC not show in MMO Demo

Postby aiaustin » 15 Sep 2015, 13:43

I get this issue too. I somehow started the MMORoomDemo.py extension when fiddling around over a period of a few hours but was not sure what specific step had enabled the extensions.. as they were in the correct extensions/pyTest folder as instructed.

Now its working on first test server.... I get this when the extension loads...

14:17:11,547 INFO [SFSWorker:Sys:4] Extensions - {pyTest}: MMO Item Tester: 1.02

But on a second server I could not work out how to start the extension so the test logins show each avatar separately and no NPCs... I saw this message though...

14:05:35,451 WARN [SFSWorker:Sys:4] extensions.PythonExtension - Failed initializing Python Extension: pyTest -> Traceback (innermost last):
File "<string>", line 39, in ?
NameError: ISFSEventListener

So I removed Simple.py (which as far as I thought I was not enabling with the MMORoomDemop test Unity app). then it worked.

I am trying to work out how to put back Simple.py to have other demos running without swapping the .py extensions in and out.
Last edited by aiaustin on 15 Sep 2015, 17:17, edited 1 time in total.
aiaustin
Posts: 23
Joined: 19 May 2011, 13:33

Re: NPC not show in MMO Demo

Postby aiaustin » 15 Sep 2015, 13:51

Issue was that I had corrupted Simple.py which was missing a proper line ending on the last line of the file. Maybe done while transferring the setup and files from one server to the other during testing. I restored extensions/pyTest/Simple.py to the SFS original (which has the proper line ending on the last line of the code) ad it works now.

I will leave this here in case others see a similar problem. I am not quite sure why Simple.py is being checked at all as its not listed in the client side code as an extension, but maybe all extensions load someone.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: NPC not show in MMO Demo

Postby Lapo » 15 Sep 2015, 14:20

If you want we also provide the Java version of the MMODemo extension.
Python can be practical for quick tests without recompiling but it has its own quirks and not everyone likes it.

The extension is linked in the MMODemo tutorial or can be downloaded from this post from another discussion:
viewtopic.php?p=71998&f=1#p71998

cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
aiaustin
Posts: 23
Joined: 19 May 2011, 13:33

Re: NPC not show in MMO Demo

Postby aiaustin » 15 Sep 2015, 15:34

Thanks Lapo, I have that now for a test...

I seem to be able to run fine now with the .py extension and using the provided demo code with some minor changes as a test for changing area of interest, etc. And when using the default Zone (BasicExamples) and Room (UnityMMODemo) but when I try to use a new Zone (already set up) and Room (will be dynamically created) it reports the room created is not an MMO Room, which I see others have come across as an issue, so I will trawl the forums for that too.
Last edited by aiaustin on 15 Sep 2015, 17:18, edited 1 time in total.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: NPC not show in MMO Demo

Postby Lapo » 15 Sep 2015, 16:08

If you can give us more details about the exceptions it would help...

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
aiaustin
Posts: 23
Joined: 19 May 2011, 13:33

Re: NPC not show in MMO Demo

Postby aiaustin » 15 Sep 2015, 19:22

I can use the default basicExamples zone and a the default UnityMMODEmno or a customized room name there. but once I try to use a new (pre-established zone) with (apparently) exactly the same settings in all tabs as BasicExamples.. all hell breaks loose and I start on every load to get errors on restarting the server - to ensure the room with NPCs in it is not present. I seem to have to go to a saved copy of the Zone .xml files to be able to restart SFS2X without this stratup error.. and that's before I try to run the Unity app and connect.


19:39:32,777 INFO [main] managers.SFSRoomManager - Room created: { Zone: I-Zone }, [ Room: I-Room, Id: 1, Group: default, isGame: false ]
19:39:33,431 INFO [main] Extensions - {pyTest}: MMO Item Tester: 1.02
19:39:33,443 WARN [main] extensions.PythonExtension - Failed initializing Python Extension: pyTest -> Traceback (innermost last):
File "<string>", line 98, in init
File "<string>", line 119, in simulatePlayers
at com.smartfoxserver.v2.api.SFSApi.createNPC(SFSApi.java:690)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)

java.lang.NullPointerException: java.lang.NullPointerException

------

There are much longer sets of errors when running the Unity app itself, as below. But if we could explain why the zone .xml files seem to get messed up as above that would be a start.

19:36:23,511 INFO [SFSWorker:Sys:3] api.SFSApi - User login: { Zone: I-Zone }, ( User Name: Ai, Id: 1, Priv: 0, Sess: 129.215.219.86:50776 ) , Type: Unity
19:36:23,538 INFO [SFSWorker:Sys:4] api.SFSApi - Room joined: [ Room: I-Room, Id: 1, Group: default, isGame: false ], { Zone: I-Zone }, ( User Name: Ai, Id: 1, Priv: 0, Sess: 129.215.219.86:50776 ) , asSpect: false
19:36:23,820 WARN [SFSWorker:Ext:4] managers.SFSExtensionManager - com.smartfoxserver.v2.exceptions.SFSRuntimeException:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Exception: com.smartfoxserver.v2.exceptions.SFSRuntimeException
Message: Room is not an MMORoom! [ Room: I-Room, Id: 1, Group: default, isGame: false ], ( User Name: Ai, Id: 1, Priv: 0, Sess: 129.215.219.86:50776 )
Description: Error during event handling: com.smartfoxserver.v2.exceptions.SFSRuntimeException: Room is not an MMORoom! [ Room: I-Room, Id: 1, Group: default, isGame: false ], ( User Name: Ai, Id: 1, Priv: 0, Sess: 129.215.219.86:50776 ) , Listener: org.python.proxies.main$UserVarsUpdateListener$0@19a20d0
+--- --- ---+
Stack Trace:
+--- --- ---+
com.smartfoxserver.v2.api.SFSMMOApi.setUserPosition(SFSMMOApi.java:85)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.python.core.PyReflectedFunction.__call__(Unknown Source)
org.python.core.PyMethod.__call__(Unknown Source)
org.python.core.PyObject.__call__(Unknown Source)
org.python.core.PyObject.invoke(Unknown Source)
org.python.pycode._pyx0.handleServerEvent$2(<string>:51)
org.python.pycode._pyx0.call_function(<string>)
org.python.core.PyTableCode.call(Unknown Source)
org.python.core.PyTableCode.call(Unknown Source)
org.python.core.PyTableCode.call(Unknown Source)
org.python.core.PyFunction.__call__(Unknown Source)
org.python.core.PyMethod.__call__(Unknown Source)
org.python.core.PyObject.__call__(Unknown Source)
org.python.core.PyObject._jcallexc(Unknown Source)
org.python.proxies.main$UserVarsUpdateListener$0.handleServerEvent(Unknown Source)
com.smartfoxserver.v2.entities.managers.SFSExtensionManager.dispatchEvent(SFSExtensionManager.java:769)
com.smartfoxserver.v2.entities.managers.SFSExtensionManager.dispatchRoomLevelEvent(SFSExtensionManager.java:711)
com.smartfoxserver.v2.entities.managers.SFSExtensionManager.handleServerEvent(SFSExtensionManager.java:969)
com.smartfoxserver.v2.core.SFSEventManager$SFSEventRunner.run(SFSEventManager.java:65)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: NPC not show in MMO Demo

Postby Lapo » 16 Sep 2015, 09:47

I would double check the Room you're working with because it doesn't seem an MMO Room.
The error is pretty clear and there can't be other reasons why it is raised.

Try catching the SFSRuntimeException in your code and trace out the Room, so you can see what class it is.

Once this is fixed the 2nd error should definitely go away and let us know about the first one.

thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
aiaustin
Posts: 23
Joined: 19 May 2011, 13:33

Re: NPC not show in MMO Demo

Postby aiaustin » 16 Sep 2015, 11:54

It is odd.. and I have even returned to a pristine copy of the .py extension and the SFS2X demo unity example. So the room is just a newly cerate one under BasicExamples Zone as in the example code. And on one machine I even built a fresh SFSX2 server. And tried 32 bit and 64 bit servers. All fail the same way now. yet at one stage it did work It must be something cached or set in the configs somewhere.

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 78 guests