Captive Imagination
September 06, 2010, 09:36:10 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Hosting change completed. Please send an e-mail to support@captiveimagination.com if you have any problems.
 
   Home   Help Search Calendar Login Register  
Pages: 1 2 [All]   Go Down
  Print  
Author Topic: Testing synchronize new nodes  (Read 3440 times)
0 Members and 1 Guest are viewing this topic.
Viko
Newbie
*
Offline Offline

Posts: 10


View Profile
« on: April 11, 2008, 04:23:44 PM »

Hi Darkfrog!
Thank you for your last answer, that helped. Now i have another problem.
I wrote a little test. There are tanks, and the tanks can shoot. It is very similar to the FlagRushTest. But after few shoots the game crash, and it throws a lot of exception.  Undecided If you don't want to try it, i can copy the substantive part of the code, and the error messages.
Viko

ShootTest.jar:
www.stud.u-szeged.hu/Blaskovics.Viktor/ShootTest.jar
Logged
darkfrog
Administrator
Inspired Imagination
*****
Offline Offline

Posts: 2650


View Profile
« Reply #1 on: April 12, 2008, 01:25:15 AM »

Lets start with the error messages and some relevant code. Smiley
Logged
Viko
Newbie
*
Offline Offline

Posts: 10


View Profile
« Reply #2 on: April 12, 2008, 04:31:20 AM »

Ok!  Smiley So the main messages:
Server:
Unable to find object: 3 on Server -> it repeats always when i shoot: to 4,5,6..etc.
and an error:
Code:
SEVERE: Uncaught exception: Terminating Thread.
java.lang.NullPointerException
at com.captiveimagination.jgn.synchronization.SynchronizationManager.remove(SynchronizationManager.java:321)
at com.captiveimagination.jgn.synchronization.SynchronizationManager.update(SynchronizationManager.java:343)
at com.captiveimagination.jgn.UpdatableRunnable.run(JGN.java:435)
at java.lang.Thread.run(Unknown Source)
2008.04.13. 9:24:12 com.captiveimagination.jgn.UpdatableRunnable run
INFO: JGN update thread 10 terminated
Client:
WARNING: message is not a playermessage: com.captiveimagination.jgn.synchronization.message.SynchronizeRequestIDMessage@123b25c

Code:
There are 5 classes:
- ShootTest, the main app, similar to flagrusgtest
- ShootTestServer, ShootTestClient
- ShootTestSOM -> SyncObjectManager
- BulletController -> to control the bullets

The ShootTest get the syncmanager (in client and server side too):
Code:
SynchronizationManager clientSyncManager = new SynchronizationManager(client, controller);
clientSyncManager.addSyncObjectManager(this);
JGN.createThread(clientSyncManager).start();

final ShootTest app = new ShootTest(clientSyncManager);
In the ShootTest app, when i click with the mouse, i synchronize bullet with this function:
Code:
private void synchronize(Node toSync, long type, long updateRate){
try {
SynchronizeCreateMessage syncCreateMsg = new SynchronizeCreateMessage();
syncCreateMsg.setSyncObjectType(type);
syncManager.register(toSync, syncCreateMsg, updateRate);
} catch (Exception e) {
System.err.println("ShootTest/synchronize");
}
}

And when i update the bullet controllers, i remove the bullets out of range:
Code:
for (Iterator iterator = removeBulletControllers.iterator(); iterator.hasNext();) {
BulletController bcontroller = (BulletController) iterator.next();
syncManager.unregister(bcontroller.getTargetSpatial());
bcontroller.getTargetSpatial().removeFromParent();
bulletControllers.remove(bcontroller);/*i remove the bullets own controller too*/
}

I think i post the essentials Smiley
Logged
darkfrog
Administrator
Inspired Imagination
*****
Offline Offline

Posts: 2650


View Profile
« Reply #3 on: April 12, 2008, 10:08:33 AM »

You should go back through your code because you're obviously doing some strange things.  Especially the client receiving a SynchronizeRequestIDMessage...a client should never ever receive that, only a server should.  It is what assigns an ID to an object.  That alone may solve all other problems.
Logged
Viko
Newbie
*
Offline Offline

Posts: 10


View Profile
« Reply #4 on: April 12, 2008, 07:25:34 PM »

But when i run the FlagRushTestClient, it throws the same warning message:

Code:
2008.04.14. 0:32:27 com.captiveimagination.jgn.clientserver.JGNClient sendToServer
WARNING: message is not a playermessage: com.captiveimagination.jgn.synchronization.message.SynchronizeRequestIDMessage@55a338
Sent request to server for id
Message Sent: com.captiveimagination.jgn.synchronization.message.SynchronizeRequestIDMessage@c8376b
Message Received: Receipt certifying:1
Message Received: com.captiveimagination.jgn.synchronization.message.SynchronizeRequestIDMessage@ae533a

In here the client receive SynchronizeRequestIDMessage too.  Huh
Logged
darkfrog
Administrator
Inspired Imagination
*****
Offline Offline

Posts: 2650


View Profile
« Reply #5 on: April 12, 2008, 10:09:22 PM »

Hmmm...and that's without any modifications to the test case?
Logged
Viko
Newbie
*
Offline Offline

Posts: 10


View Profile
« Reply #6 on: April 13, 2008, 03:49:36 AM »

Yes.. So the trouble is in my set. I will try it out today on another computer.
Logged
Viko
Newbie
*
Offline Offline

Posts: 10


View Profile
« Reply #7 on: April 15, 2008, 11:39:09 AM »

Hi! I stared the all JGN again. I got it from the SVN, then when i run the FlagRushTest, the client throw this:
Quote
2008.04.16. 16:37:46 com.captiveimagination.jgn.clientserver.JGNClient$1 messageReceived
INFO: JGNClient: playerId was assigned to 0
2008.04.16. 16:37:46 com.captiveimagination.jgn.clientserver.JGNClient$1 messageReceived
INFO: JGNClient: playerId was assigned to 0
Unable to find object: 1 on Client
2008.04.16. 16:37:46 com.captiveimagination.jgn.clientserver.JGNClient connectAndWait
INFO: JGN Connected
Unable to find object: 1 on Client
2008.04.16. 16:37:46 com.jme.scene.Node <init>
INFO: Node created.
2008.04.16. 16:37:46 com.jme.scene.Node <init>
INFO: Node created.
2008.04.16. 16:37:46 com.captiveimagination.jgn.clientserver.JGNClient sendToServer
WARNING: message is not a playermessage: com.captiveimagination.jgn.synchronization.message.SynchronizeRequestIDMessage@1de9ac4
2008.04.16. 16:37:46 com.jme.scene.Node <init>
INFO: Node created.
2008.04.16. 16:37:46 com.jme.scene.Node <init>
INFO: Node created.
2008.04.16. 16:37:46 com.jme.scene.Node <init>
INFO: Node created.
2008.04.16. 16:37:46 com.jme.scene.Node <init>
INFO: Node created.
Unable to find object: 1 on Client
2008.04.16. 16:37:46 com.jme.scene.Node <init>
INFO: Node created.
2008.04.16. 16:37:46 com.jme.scene.Node <init>
INFO: Node created.
2008.04.16. 16:37:46 com.jme.scene.Node <init>
INFO: Node created.
Unable to find object: 1 on Client
2008.04.16. 16:37:46 com.jme.scene.Node <init>
INFO: Node created.
2008.04.16. 16:37:46 com.jme.scene.Node attachChild
INFO: Child (TDS Scene) attached to this node (Player Node)
2008.04.16. 16:37:47 com.jme.scene.Node attachChild
INFO: Child (Player Node) attached to this node (Scene graph node)
Connecting!
CREATING PLAYER!
Connected!
PlayerID: 0
Sent request to server for id
Message Sent: com.captiveimagination.jgn.synchronization.message.SynchronizeRequestIDMessage@110c31
Message Received: Receipt certifying:1
Message Received: com.captiveimagination.jgn.synchronization.message.SynchronizeRequestIDMessage@419d05
Received id from server: 2
Message Certified: com.captiveimagination.jgn.synchronization.message.SynchronizeRequestIDMessage@110c31
Message Sent: Receipt certifying:1
Message Sent: com.captiveimagination.jgn.synchronization.message.SynchronizeCreateMessage@1c6572b
Message Received: Receipt certifying:2
Message Certified: com.captiveimagination.jgn.synchronization.message.SynchronizeCreateMessage@1c6572b
Message Sent: Noop
Message Received: Noop
Message Sent: Noop
Message Received: Noop
I get the same warning message. But everything goes fine. 
Logged
darkfrog
Administrator
Inspired Imagination
*****
Offline Offline

Posts: 2650


View Profile
« Reply #8 on: April 15, 2008, 12:36:34 PM »

Hmmm...very strange...perhaps a slight logic problem in my code.  I'll look into it.  Can you post a ticket on javagn.org for this?
Logged
Viko
Newbie
*
Offline Offline

Posts: 10


View Profile
« Reply #9 on: April 15, 2008, 12:58:39 PM »

Hmm, i think i've found the cause of my problem. When i unregister an object, everything goes bad.
I have a JME App (just like the FlagRush in the FlagRush test). The server and the client give theirs own SynchronizationManager to this app. When i shoot inside the app, i call the register function. And when the bullet goes out of range, the app call the unregister method.
If the server call unregister, the client throws this:
Quote
SEVERE: Exception in game loop
java.lang.IndexOutOfBoundsException: Index: 3, Size: 3
   at java.util.ArrayList.RangeCheck(Unknown Source)
   at java.util.ArrayList.get(Unknown Source)
   at com.jme.scene.Node.draw(Unknown Source)
   at com.jme.scene.Spatial.onDraw(Unknown Source)
   at com.jme.renderer.lwjgl.LWJGLRenderer.draw(Unknown Source)
   at com.jme.app.SimpleGame.render(Unknown Source)
   at com.jme.app.BaseGame.start(Unknown Source)
   at shoot.ShootTestClient$1.run(ShootTestClient.java:37)
If the client call unregister, the client throws this:
Quote
SEVERE: Uncaught exception: Terminating Thread.
java.lang.NullPointerException
   at com.captiveimagination.jgn.synchronization.SynchronizationManager.remove(SynchronizationManager.java:326)
   at com.captiveimagination.jgn.synchronization.SynchronizationManager.update(SynchronizationManager.java:348)
   at com.captiveimagination.jgn.UpdatableRunnable.run(JGN.java:435)
   at java.lang.Thread.run(Unknown Source)
and the server throws the same than the client before (IndexOutOfBoundsException).
I dont know what i do wrong. Embarrassed
Logged
Viko
Newbie
*
Offline Offline

Posts: 10


View Profile
« Reply #10 on: April 15, 2008, 01:03:19 PM »

I posted a ticket, but i'm not too experienced (i don't know correctly what is it Smiley)
Logged
darkfrog
Administrator
Inspired Imagination
*****
Offline Offline

Posts: 2650


View Profile
« Reply #11 on: April 15, 2008, 01:47:56 PM »

thanks, I'll get a look at it when I get a chance...it might be this weekend.
Logged
.:emp...Imm0|82:.
Jr. Member
**
Offline Offline

Posts: 61


View Profile
« Reply #12 on: April 16, 2008, 08:09:09 AM »

hi..
i had the same probs some days ago, so i could tell u what solved them in my case.
Darkfrog gave me the hint to use the GameTaskQueueManager, if u try to manipulate the SceneGraph form anywhere outside the single-threaded OpenGL-Thread.

So i tried to follow this hint, and started to use the GTQM in create() and remove() of the SyncObjectManager.

here my code: (i don't promise that it's perfect)
Code:
public Object create(SynchronizeCreateMessage scm)
{
Callable<AbstractAvatar> createAvatarCall = new Callable<AbstractAvatar>()
{

public AbstractAvatar call() throws Exception
{
                                //create a remote Object for the representaion of another user's Avatar.
final AbstractAvatar av = new AvatarFactoryImpl().create(AvatarFactoryImpl.NOUSERAVATAR);
av.addToScene(VB3DBaseGame.getInstance().getGui().getRootNode());
EntityManager.getInstance().addEntity(av);
return av;
}

};

try
{
                        //add the Callable, which should add the internaly create the remoteObject and add it to the sceneGraph
                        //to the updateQueue of the GameTaskQueueManager.
                        // .get() returns a Future containing the remoteObject.
return GameTaskQueueManager.getManager().update(createAvatarCall).get();
}
catch (InterruptedException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (ExecutionException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}

return null;
}


public boolean remove(SynchronizeRemoveMessage srm, Object obj)
{
if (obj instanceof NoUserAvatar)
{

System.out.println("CHAT-SYNC-OBJECT-MANAGER: remove() was Called by ID:" + srm.getPlayerId());
System.out.println("CHAT-SYNC-OBJECT-MANAGER: SyncObject to remove: " + srm.getSyncObjectId());

final AbstractAvatar av = (AbstractAvatar) obj;

Callable<Boolean> removeAvatarCall = new Callable<Boolean>()
{

public Boolean call() throws Exception
{
try
{
LuaManager.getInstance().destroyScript(av.getScript());
return av.removeFromScene();
}
catch (ConcurrentModificationException e)
{
e.printStackTrace();
return false;
}
}

};

try
{
return GameTaskQueueManager.getManager().update(removeAvatarCall).get();
}
catch (InterruptedException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (ExecutionException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
return false;
}
else
{
System.out.println("CHAT-SYNC-OBJECT-MANAGER: remove() was Called by ID:" + srm.getPlayerId());
System.out.println("CHAT-SYNC-OBJECT-MANAGER: SyncObject to remove: " + srm.getSyncObjectId());
System.out.println("CHAT-SYNC-OBJECT-MANAGER: but SyncObject was no instance of NoUserAvatar");
return false;
}
}

Hope this helps in your case as well.
« Last Edit: April 16, 2008, 03:05:14 PM by .:emp...Imm0|82:. » Logged
not!an!exit
Newbie
*
Offline Offline

Posts: 13


View Profile
« Reply #13 on: April 23, 2008, 10:18:58 AM »

Interesting that one finds this thread here... I just stumbled upon the same Problem... My app is throwing lots of "message is not a playermessage: com.captiveimagination.jgn.synchronization.message.SynchronizeRequestIDMessage@117c0eb" and I can't figure out, what's wrong.

Btw., I use GTQM for creation and an own synchronious removal which is called during the next update-cycle, so that can't be it.
Logged
darkfrog
Administrator
Inspired Imagination
*****
Offline Offline

Posts: 2650


View Profile
« Reply #14 on: April 23, 2008, 12:07:17 PM »

I'll look into this further...this shouldn't happen during normal execution.  If someone else has the time to investigate this further please feel free.
Logged
Viko
Newbie
*
Offline Offline

Posts: 10


View Profile
« Reply #15 on: April 24, 2008, 07:39:42 AM »

emp: Thank you! But i changed my strategy. Now only the server can regist/unregist. In this way the client don't get WARNING message, but i had to create another message channel.
Viko
Logged
Tumaini
JGN Developer
Jr. Member
*****
Offline Offline

Posts: 51


View Profile
« Reply #16 on: May 08, 2009, 03:26:52 PM »

Sorry to bring this old topic back, but I'm having the same issues.
I'm getting the warning about the SynchronizeRequestId-message not being a player message and I've gotten it from when I started using sync, so I thought it was supposed to be like that.
I register my objects on each client, so perhaps that's why?
How do I go about registering them from the server? How would the clients know which object was theirs?
The register method says 'authorative from this peer', which suggests it should be registered on a client, but how come this isn't working?
Perhaps you've had the opportunity to look into it now, darkfrog?
Logged
darkfrog
Administrator
Inspired Imagination
*****
Offline Offline

Posts: 2650


View Profile
« Reply #17 on: May 08, 2009, 06:41:58 PM »

Sorry, unfortunately this fell off the radar and sadly my time able to be spent on JGN has dwindled to nothing for quite a while apart from responding to messages here.

The source code is fully available and if you are interested in looking into the problem and finding a solution I would happily commit your update.  I know that kind of sucks for a solution, but alas, for the moment that's about all I can do unless someone else has more time to look into it.
Logged
Pages: 1 2 [All]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.287 seconds with 20 queries.