Error: can't proceed adding the NPC

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

Moderators: Lapo, Bax

Fun Bobby
Posts: 48
Joined: 26 Sep 2008, 11:23

Error: can't proceed adding the NPC

Postby Fun Bobby » 28 Nov 2008, 08:34

hello there,

the new npc-funktion works nice,

but sometimes when adding the NPC i get the message, that i cannot add
this NPC (for example adding 10 NPCs in a loop, the server cannot add #8 but continues with #9).
My first thought was that this happens when i try to add too many NPCs at once, but randomized this happens sometimes when i add only one NPC. Overall the method works fine, e.g. i add 500 NPCs i have at the end 469 NPCs or something like that.


[ com.bumblebee.silentwolves.game.NpcExt ]: Npc Ext called - JSON - createNPC
INFO | jvm 1 | 2008/11/28 10:11:43 | java.lang.Exception: Server connection was not found, can't proceed adding the NPC. Sorry.
INFO | jvm 1 | 2008/11/28 10:11:43 | at it.gotoandplay.smartfoxserver.extensions.ExtensionHelper.createNPC(ExtensionHelper.java:1258)
INFO | jvm 1 | 2008/11/28 10:11:43 | at com.bumblebee.silentwolves.game.NpcExt.lobbyLoginNPC(NpcExt.java:174)
INFO | jvm 1 | 2008/11/28 10:11:43 |
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 02 Dec 2008, 08:08

Each NPC creation requires setting up a "fake" connection to the loopback interface (127.0.0.1).
The loop you are using might be the problem. Try adding a small "pause" at each iteration, using a Thread.sleep(50) or so
I am taking a note for the next update.

Let me know if it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
Fun Bobby
Posts: 48
Joined: 26 Sep 2008, 11:23

Postby Fun Bobby » 05 Dec 2008, 15:46

Yes this helps when i am adding 1000 NPCs in a loop no NPC is lost due of the former problem.

Unfortunately i am adding the NPCs not always in some kind of loop. For example the clients can add NPCs at a random time and amout.

How can i avoid here the "java.lang.Exception: Server connection was not found, can't proceed adding the NPC. Sorry." ?

Do you have some kind of clue?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 05 Dec 2008, 16:03

Yes, we have inspected the issue and found a possible problem which is now fixed. We are now testing.
If you drop us an email as a reminder I should be able to send you a patch in the first days of the next week.

Hope it helps
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
potmo
Posts: 154
Joined: 02 Feb 2007, 14:28
Location: Stockholm Sweden
Contact:

Postby potmo » 28 Jan 2009, 08:09

im having the same issue. Is there a workaround?

When a client asks to start a new botGame a java.lang exception is thrown.
java.lang.Exception: Server connection was not found, can't proceed adding the NPC. Sorry.
at it.gotoandplay.smartfoxserver.extensions.ExtensionHelper.createNPC(ExtensionHelper.java:1258)
at se.raketspel.smartbox.core.ExtensionCore.createBot(ExtensionCore.java:519)


The strange thing is that it does'nt happen all the time.
Nisse Bergman
Raketspel
User avatar
potmo
Posts: 154
Joined: 02 Feb 2007, 14:28
Location: Stockholm Sweden
Contact:

Postby potmo » 28 Jan 2009, 08:10

is it possible to get that patch you mentioned?
Nisse Bergman

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

Postby Lapo » 28 Jan 2009, 08:17

Are you using version 1.6.5?
You shouldn't have that problem anymore.

Also in 1.6.5 we have added an new "serverReady" event that is fired on the server side when SFS is ready to accept connections.
The event can be used to initialize the NPCs

viewtopic.php?t=4386
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 19 guests