Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (538)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (600)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 [2]
  ignore  |  Print  
  Ruins of Revenge  (Read 8040 times)
0 Members and 1 Guest are viewing this topic.
Offline bsmith2

Senior Newbie




All about the iso


« Reply #30 - Posted 2013-04-25 05:10:22 »

On to the next problem Smiley

I have the client connecting to the server successfully now. However, the connection is dropped after 5 seconds. Also it doesn't seem that any keyboard commands are being accepted except F8 and Esc.

I don't have a gamepad plugged in and am wondering if this is the problem. From what I can tell I'd say the connection is set to timeout quickly and no keyboard input is being sent to the server.
Offline matheus23

JGO Kernel


Medals: 114
Projects: 3


You think about my Avatar right now!


« Reply #31 - Posted 2013-04-25 13:04:35 »

On to the next problem Smiley

I have the client connecting to the server successfully now. However, the connection is dropped after 5 seconds. Also it doesn't seem that any keyboard commands are being accepted except F8 and Esc.

I don't have a gamepad plugged in and am wondering if this is the problem. From what I can tell I'd say the connection is set to timeout quickly and no keyboard input is being sent to the server.
Ehh...
Huh

Any exception?
The game should actually work without gamepad... :/

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline bsmith2

Senior Newbie




All about the iso


« Reply #32 - Posted 2013-04-25 15:14:50 »

I ruled out the gamepad as being the problem. I noticed that the server prints to the console that a connection was made. However, I don't see the corresponding client connection being printed.

Console Output:
[SERVER]: Client /127.0.0.1:5351 connected.
ControllerPlayer initializing: [Entity]:
   type: player
   id: 10
   connection: 10   pos: [23.0:25.0]
   rot: 0.00000
   vel: [0.0:0.0]
   rot-vel: 0.00000
103:22  INFO: [kryonet] Connection 10 disconnected.
[SERVER]: Client null disconnected.
ControllerPlayer dying



Per clientconnector.java I would have expected to see this get dumped at some point:

public void connected(Connection connection) {
      System.out.println("[CLIENT]: connected to " + connection.getRemoteAddressTCP());
   }
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline bsmith2

Senior Newbie




All about the iso


« Reply #33 - Posted 2013-04-25 15:25:31 »

Still debugging ... I turned on trace level logging for kryonet on the client. It looks like it's attempting to connect over and over again but using a different port each time.

00:11  INFO: [kryonet] Connection 1 connected: /127.0.0.1
[SERVER]: Client /127.0.0.1:4708 connected.
ControllerPlayer initializing: [Entity]:
   type: player
   id: 1
   connection: 1   pos: [23.0:25.0]
   rot: 0.00000
   vel: [0.0:0.0]
   rot-vel: 0.00000
00:23  INFO: [kryonet] Connection 1 disconnected.
[SERVER]: Client null disconnected.
ControllerPlayer dying
00:29  INFO: [kryonet] Connection 2 connected: /127.0.0.1
[SERVER]: Client /127.0.0.1:4713 connected.
ControllerPlayer initializing: [Entity]:
   type: player
   id: 2
   connection: 2   pos: [23.0:25.0]
   rot: 0.00000
   vel: [0.0:0.0]
   rot-vel: 0.00000
00:41  INFO: [kryonet] Connection 2 disconnected.
[SERVER]: Client null disconnected.
ControllerPlayer dying
41:06  INFO: [kryonet] Connection 3 connected: /127.0.0.1
[SERVER]: Client /127.0.0.1:4782 connected.
ControllerPlayer initializing: [Entity]:
   type: player
   id: 3
   connection: 3   pos: [23.0:25.0]
   rot: 0.00000
   vel: [0.0:0.0]
   rot-vel: 0.00000
41:18  INFO: [kryonet] Connection 3 disconnected.
[SERVER]: Client null disconnected.
ControllerPlayer dying
Offline matheus23

JGO Kernel


Medals: 114
Projects: 3


You think about my Avatar right now!


« Reply #34 - Posted 2013-04-25 16:15:15 »

Strange... seems to be some settings issue. Have you searched inside the System's settings? I don't know... probably the process hasn't got the permission do listen on ports?
I really have no idea...

I need to look into the source again, to find out, why there was that gamepad issue, can you post it? Wanted to have it optional, but...

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline bsmith2

Senior Newbie




All about the iso


« Reply #35 - Posted 2013-04-25 19:37:02 »

Compiled using Intellij IDEA just to compare and hit the same problem.

Someone posted an issue for Kryonet in Feb. regarding a connection and immediate disconnection issue but there is no further discussion --> https://code.google.com/p/kryonet/issues/detail?id=32

I'm using Win 7 64 bit. I disabled the windows firewall. Here is the client side console output with tracing turned on:

Reading config.
00:00 TRACE: [kryo] Register class ID 14: org.matheusdev.ror.net.packages.CreateEntity (com.esotericsoftware.kryo.serializers.FieldSerializer)
00:00 TRACE: [kryo] Register class ID 15: org.matheusdev.ror.net.packages.EntityState (com.esotericsoftware.kryo.serializers.FieldSerializer)
00:00 TRACE: [kryo] Register class ID 16: org.matheusdev.ror.net.packages.NetPackage (com.esotericsoftware.kryo.serializers.FieldSerializer)
00:00 TRACE: [kryo] Register class ID 17: org.matheusdev.ror.net.packages.Input (com.esotericsoftware.kryo.serializers.FieldSerializer)
00:00 TRACE: [kryo] Register class ID 18: org.matheusdev.ror.net.packages.FetchEntities (com.esotericsoftware.kryo.serializers.FieldSerializer)
00:00 TRACE: [kryo] Register class ID 19: org.matheusdev.ror.net.packages.CreateEntity[] (com.esotericsoftware.kryo.serializers.DefaultArraySerializers$ObjectArraySerializer)
00:00 TRACE: [kryo] Register class ID 20: org.matheusdev.ror.net.packages.DeleteEntity (com.esotericsoftware.kryo.serializers.FieldSerializer)
00:00 TRACE: [kryonet] Client thread started.
00:00  INFO: Connecting: localhost/127.0.0.1:5455
00:00 DEBUG: [kryonet] Port 8510/TCP connected to: localhost/127.0.0.1:5455
00:00 TRACE: [kryo] Read class 9: com.esotericsoftware.kryonet.FrameworkMessage$RegisterTCP
00:00 TRACE: [kryo] Read field: connectionID (com.esotericsoftware.kryonet.FrameworkMessage$RegisterTCP)
00:00 TRACE: [kryo] Read int: 10
00:00 DEBUG: [kryo] Read: com.esotericsoftware.kryonet.FrameworkMessage$RegisterTCP
00:00 TRACE: [kryo] Object graph complete.
00:00 TRACE: [kryonet] Connection 10 received TCP: RegisterTCP
00:00  INFO: [kryonet] Connection 10 connected: localhost/127.0.0.1
00:00 TRACE: [kryonet] Connection listener added: org.matheusdev.ror.client.ClientConnector$1
00:00 TRACE: [kryonet] Client listener added.



On a side note regarding the gamepad. This is the console error I was getting:
Controllers: added manager for application, 1 managers active
Couldn't find controller for name "..."

It may be a non issue though, I just noticed it was red in the console due to the print statement used.
Offline matheus23

JGO Kernel


Medals: 114
Projects: 3


You think about my Avatar right now!


« Reply #36 - Posted 2013-04-25 20:33:24 »

On a side note regarding the gamepad. This is the console error I was getting:
Controllers: added manager for application, 1 managers active
Couldn't find controller for name "..."

It may be a non issue though, I just noticed it was red in the console due to the print statement used.

Oh, well, yes, that's how it should be Smiley
It's pretty bad designed right now (with those "...")
I set "..." as the default value, so that that shows up in the settings ^^

Anyways, regarding the connection issue:
Eh... seems like everything is fine (when I read what the Traces say)... There seems to be no disconnection...
This is what the Server prints (I think...), what does the client Print?


Very cool that you are interested in my coding, would be cool if we could somehow get in contact. Skype? Anything?

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline bsmith2

Senior Newbie




All about the iso


« Reply #37 - Posted 2013-04-25 20:36:00 »

Not trying to be spammy, just posting debugging progression here in case other users hit a similar issue. I have the stack trace printing to the console during the client connect. Note the bolded lines below. I'll do some more digging any hopefully find the root issue.

Reading config.
00:00 TRACE: [kryo] Register class ID 14: org.matheusdev.ror.net.packages.CreateEntity (com.esotericsoftware.kryo.serializers.FieldSerializer)
00:00 TRACE: [kryo] Register class ID 15: org.matheusdev.ror.net.packages.EntityState (com.esotericsoftware.kryo.serializers.FieldSerializer)
00:00 TRACE: [kryo] Register class ID 16: org.matheusdev.ror.net.packages.NetPackage (com.esotericsoftware.kryo.serializers.FieldSerializer)
00:00 TRACE: [kryo] Register class ID 17: org.matheusdev.ror.net.packages.Input (com.esotericsoftware.kryo.serializers.FieldSerializer)
00:00 TRACE: [kryo] Register class ID 18: org.matheusdev.ror.net.packages.FetchEntities (com.esotericsoftware.kryo.serializers.FieldSerializer)
00:00 TRACE: [kryo] Register class ID 19: org.matheusdev.ror.net.packages.CreateEntity[] (com.esotericsoftware.kryo.serializers.DefaultArraySerializers$ObjectArraySerializer)
00:00 TRACE: [kryo] Register class ID 20: org.matheusdev.ror.net.packages.DeleteEntity (com.esotericsoftware.kryo.serializers.FieldSerializer)
00:00 TRACE: [kryonet] Client thread started.
00:00  INFO: Connecting: localhost/127.0.0.1:5455
00:00 DEBUG: [kryonet] Port 9124/TCP connected to: localhost/127.0.0.1:5455
00:00 TRACE: [kryo] Read class 9: com.esotericsoftware.kryonet.FrameworkMessage$RegisterTCP
00:00 TRACE: [kryo] Read field: connectionID (com.esotericsoftware.kryonet.FrameworkMessage$RegisterTCP)
00:00 TRACE: [kryo] Read: 6
00:00 DEBUG: [kryo] Read: com.esotericsoftware.kryonet.FrameworkMessage$RegisterTCP
00:00 TRACE: [kryo] Object graph complete.
00:00 TRACE: [kryonet] Connection 6 received TCP: RegisterTCP
00:00  INFO: [kryonet] Connection 6 connected: localhost/127.0.0.1
00:00  INFO: [kryonet] Connection 6 disconnected.
00:00  INFO: Connecting: localhost/127.0.0.1:5455
00:00 DEBUG: [kryonet] Port 9127/TCP connected to: localhost/127.0.0.1:5455
00:00 TRACE: [kryonet] Unable to update connection.
java.net.SocketException: Connection is closed.
   at com.esotericsoftware.kryonet.TcpConnection.readObject(TcpConnection.java:100)
   at com.esotericsoftware.kryonet.Client.update(Client.java:239)
   at com.esotericsoftware.kryonet.Client.run(Client.java:317)
   at java.lang.Thread.run(Unknown Source)
java.net.SocketTimeoutException: Connected, but timed out during TCP registration.
Note: Client#update must be called in a separate thread during connect.

   at com.esotericsoftware.kryonet.Client.connect(Client.java:159)
   at com.esotericsoftware.kryonet.Client.connect(Client.java:114)
   at org.matheusdev.ror.client.ClientConnector.<init>(ClientConnector.java:63)
   at org.matheusdev.ror.client.ClientMaster.createConnection(ClientMaster.java:131)
   at org.matheusdev.ror.client.ClientMaster.<init>(ClientMaster.java:80)
   at org.matheusdev.ror.screens.ScreenConnect.tryConnect(ScreenConnect.java:92)
   at org.matheusdev.ror.screens.ScreenConnect.access$0(ScreenConnect.java:89)
   at org.matheusdev.ror.screens.ScreenConnect$3.touchUp(ScreenConnect.java:70)
   at com.badlogic.gdx.scenes.scene2d.InputListener.handle(InputListener.java:58)
   at com.badlogic.gdx.scenes.scene2d.Stage.touchUp(Stage.java:317)
   at org.matheusdev.ror.screens.AbstractScreen.touchUp(AbstractScreen.java:85)
   at org.matheusdev.ror.RuinsOfRevenge.touchUp(RuinsOfRevenge.java:168)
   at com.badlogic.gdx.backends.lwjgl.LwjglInput.processEvents(LwjglInput.java:297)
   at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:186)
   at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:110)
Saving up = W
Saving down = S
Saving left = A
Saving right = D
Saving debugDraw = F8
Saving escape = ESCAPE
Saving chat = ENTER
Config written.
AL lib: alc_cleanup: 1 device not closed
Offline bsmith2

Senior Newbie




All about the iso


« Reply #38 - Posted 2013-04-26 21:59:00 »

Bummer, still stuck. I've been reading the Kryonet discussion group and some other users indicated having issues on the latest kryonet build. I've tried 3 or 4 different versions though and none seem to change anything.

If anyone else pulls down and connects successfully let me know Smiley. Inserting breakpoints into this project hasn't seemed to help me debug. Next step would be to insert breakpoints into kryonet code and recompile it from source, but not sure I have the energy to tackle that Smiley.
Offline matheus23

JGO Kernel


Medals: 114
Projects: 3


You think about my Avatar right now!


« Reply #39 - Posted 2013-04-27 09:54:45 »

Client#update() is called in a separate thread, the Kryonet updateThread (not handled through my code, see Kryonet's code: Client#start())

So that shouldn't be the issue...

I can't reproduce Sad

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline bsmith2

Senior Newbie




All about the iso


« Reply #40 - Posted 2013-04-27 14:45:16 »

Hey matheus23,

Any chance you could try reuploading to github? If you look at the .classpath file you'll see that it's pointing to .jars in a path where they don't exist. I'm wondering if the .classpath is out of sync then maybe there is something else out of sync in github vs. your local pc. Just a random thought since I'm out of ideas Smiley
Offline matheus23

JGO Kernel


Medals: 114
Projects: 3


You think about my Avatar right now!


« Reply #41 - Posted 2013-04-27 14:59:53 »

Hey matheus23,

Any chance you could try reuploading to github? If you look at the .classpath file you'll see that it's pointing to .jars in a path where they don't exist. I'm wondering if the .classpath is out of sync then maybe there is something else out of sync in github vs. your local pc. Just a random thought since I'm out of ideas Smiley

The problem is, that .classpath is not anymore 'maintained' by me... I'm now using intellij, but yeah, I could try to start up with eclipse again and fix the .classpath Smiley

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline matheus23

JGO Kernel


Medals: 114
Projects: 3


You think about my Avatar right now!


« Reply #42 - Posted 2013-04-27 15:14:33 »

Done!

I could start from eclipse Smiley (and connect to server...)

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline wreed12345

JGO Knight


Medals: 25
Projects: 2
Exp: 2 years


http://linebylinecoding.blogspot.com/


« Reply #43 - Posted 2013-04-27 22:23:19 »

Hello, just a couple questions,

How do you change the drawing order as shown at 0:16 in your video? Also how are you doing collision detection it seems very good and I was thinking maybe I could incorporate something like it into my game

Offline matheus23

JGO Kernel


Medals: 114
Projects: 3


You think about my Avatar right now!


« Reply #44 - Posted 2013-04-28 09:00:14 »

Hello, just a couple questions,

How do you change the drawing order as shown at 0:16 in your video? Also how are you doing collision detection it seems very good and I was thinking maybe I could incorporate something like it into my game

1. Very easy. I have my entities, and do y-sorting: I sort them and then render them.
Also take a look at 'Entity'
This is very easy if you want to sort entities. But if you want to draw a Tiled map Bush once in front and once behind the player, that's harder... It took me some time (A great amount of time actually) to figure it out...

2. Very hard. It's LibGDX's port of Box2D, but it's really hard to get rotation, movement, scaling and everything else working. Really hard...
Also, you need to define (rather complex) shapes for some kinds of Entities. For now there are almost only circles, but take a truck for example. You'd need lots of vertices... Also you need to brake the truck up into several convex Polygons and additionally be sure, that the convex polygons don't have more than 8 vertices.
I'd say it's not really worth it. I already thought about moving back to my own collision system: A simple one. No physics. I don't even really need them...
But when they're already there, why not leave them Smiley
How I render an Entity (this could be VERY useful code. It took me ages. AGES.)
How I save entities as Javascript-JSON. (take a look at 'body' and 'fixtures'. Those describe the Box2D Body)
And finally look how I create fixtures and bodies from the .json

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline wreed12345

JGO Knight


Medals: 25
Projects: 2
Exp: 2 years


http://linebylinecoding.blogspot.com/


« Reply #45 - Posted 2013-04-28 16:57:19 »

Thank you for that! Ill think I will just stick to aabb collision Smiley And for your sorting I am assuming that
1  
Collections.sort(entities);

entities is some time of list or something? Also how would you specify what it sorts it by?

Offline matheus23

JGO Kernel


Medals: 114
Projects: 3


You think about my Avatar right now!


« Reply #46 - Posted 2013-04-28 17:23:03 »

Thank you for that! Ill think I will just stick to aabb collision Smiley And for your sorting I am assuming that
1  
Collections.sort(entities);

entities is some time of list or something? Also how would you specify what it sorts it by?

Each Entity (which is a class)
implements Comparable<Entity>
, which means, the Entity can be compared to another Entity.

The Interface
Comparable<Entity>
forces me to implement the method
public int compareTo(Entity other)
, which returns -1, when the entity is 'smaller' than "other", 0 if it's 'equal' and 1, if it's 'greater'...
smaller is lower y value, equal is same y value, and greater is bigger y value in this case.

entities is an ArrayList of Entities. (for those kind of things, simply look through the code Smiley )

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline Riven
« League of Dukes »

« JGO Overlord »


Medals: 840
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #47 - Posted 2013-04-28 18:54:36 »

The Interface
Comparable<Entity>
forces me to implement the method
public int compareTo(Entity other)
, which returns -1, when the entity is 'smaller' than "other", 0 if it's 'equal' and 1, if it's 'greater'...
smaller is lower y value, equal is same y value, and greater is bigger y value in this case.
comparable.compareTo(that) may only return zero when this.equals(that)

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social
Offline matheus23

JGO Kernel


Medals: 114
Projects: 3


You think about my Avatar right now!


« Reply #48 - Posted 2013-04-28 20:44:02 »

The Interface
Comparable<Entity>
forces me to implement the method
public int compareTo(Entity other)
, which returns -1, when the entity is 'smaller' than "other", 0 if it's 'equal' and 1, if it's 'greater'...
smaller is lower y value, equal is same y value, and greater is bigger y value in this case.
comparable.compareTo(that) may only return zero when this.equals(that)

So how should my method look like, if it only compares the two y-values?

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline Riven
« League of Dukes »

« JGO Overlord »


Medals: 840
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #49 - Posted 2013-04-28 21:17:10 »

Given that if the Y values of two entities are equal, you don't care about their relative ordering, you can treat it as if one of them was larger than the other, or even simpler:
1  
return this.y < that.y ? -1 : +1;

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social
Offline matheus23

JGO Kernel


Medals: 114
Projects: 3


You think about my Avatar right now!


« Reply #50 - Posted 2013-04-29 10:16:58 »

Given that if the Y values of two entities are equal, you don't care about their relative ordering, you can treat it as if one of them was larger than the other, or even simpler:
1  
return this.y < that.y ? -1 : +1;


I know there is a trick with sorting by Integers...
return this.y - that.y;

When I cast this to int's it's not really working... (since for example this.y = 50.5 and that.y = 50.6 => return (int) 0.1 => 0)
The best I could do was this:
return (int)(this.y * 1000 - that.y * 1000);

The higher the two get multiplied the higher the precision...

Good enough I guess...

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline bsmith2

Senior Newbie




All about the iso


« Reply #51 - Posted 2013-04-30 23:51:48 »

Thanks for taking the time to update github with the correct .classpath for eclipse. Unfortunately, I'm still having trouble getting the connect to work. I'm determined to resolve the problem at this point so I'll post details in the event it helps others.

1) I can compile and connect the kryonet examples on my local pc (and use the same ports as used for ror).
2) I can compile and run the ror server and ror client with no issue. After clicking connect the map loads and I actually see the character entity created (but he is unable to move). Enter, F8 and esc keys are accepted as those see to be client side only.
3) From what I can tell ClientConnector.java has a few overriden methods and I see that the received method gets called but the connected method is never reached. I know this because you have a print statement that would get output to the console if it was reached. I don't know kryonet very well but I would have thought that connected should execute before received?
4) I looked into one possible solution on the kryonet discussion group but it didn't seem to work --> https://groups.google.com/forum/?fromgroups=#!topic/kryonet-users/QTHiVmqljgE

I've been trying to insert some various sleeps on threads to help pinpoint the problem but no luck. My prior post regarding a TCP registration error seems to no longer be a problem (it was a side effect of debugging code I had in place). I'm currently trying to break down the timing of the connect and update thread to see if somehow data is being sent before the connection is established.

Offline bsmith2

Senior Newbie




All about the iso


« Reply #52 - Posted 2013-05-01 04:58:51 »

In ClientConnector.java

public ClientConnector(ClientMaster master, String host) throws IOException {
      this.master = master;
      this.client = new Client();
      this.queue = new LinkedBlockingQueue<>();
      this.newestInput = new Input();

      Register.registerAll(client.getKryo());
      client.start();
      client.connect(5000, InetAddress.getByName(host), ServerMaster.PORT);
      client.addListener(new QueuedListener(this) {
         @Override
         protected void queue(Runnable runnable) {            
            queue.add(runnable);
         }
      });
      
   
      
   }

I confirmed that queue.add(runnable) keeps getting called over and over. I assume on a normal connect this should just get called a single time. I added "System.out.println(queue.peek());" just before queue.add to see what was happening and got a dump like:

com.esotericsoftware.kryonet.Listener$QueuedListener$4@37b2cb94
null
com.esotericsoftware.kryonet.Listener$QueuedListener$4@5781ab44
com.esotericsoftware.kryonet.Listener$QueuedListener$4@5781ab44
com.esotericsoftware.kryonet.Listener$QueuedListener$4@5781ab44
com.esotericsoftware.kryonet.Listener$QueuedListener$4@5781ab44
com.esotericsoftware.kryonet.Listener$QueuedListener$4@5781ab44
com.esotericsoftware.kryonet.Listener$QueuedListener$4@5781ab44
com.esotericsoftware.kryonet.Listener$QueuedListener$4@5781ab44
com.esotericsoftware.kryonet.Listener$QueuedListener$4@5781ab44
com.esotericsoftware.kryonet.Listener$QueuedListener$4@5781ab44
null
com.esotericsoftware.kryonet.Listener$QueuedListener$3@38882d9a
null
com.esotericsoftware.kryonet.Listener$QueuedListener$3@644a5ddd
null

This seems to indicate that not only is the list getting added to multiple times (from a single connection attempt) but that occasionally the list is emptied and results in those null lines. In other words a listener is added, something happens and it gets removed from the list, next time through we see a null line, and then the next time a new listener is created. It seems to go on like this indefinitely.

Hopefully I'm on the right track now. I am curious if anyone else running this demo were to insert this line if they would see the same output.


Thanks for taking the time to update github with the correct .classpath for eclipse. Unfortunately, I'm still having trouble getting the connect to work. I'm determined to resolve the problem at this point so I'll post details in the event it helps others.

1) I can compile and connect the kryonet examples on my local pc (and use the same ports as used for ror).
2) I can compile and run the ror server and ror client with no issue. After clicking connect the map loads and I actually see the character entity created (but he is unable to move). Enter, F8 and esc keys are accepted as those see to be client side only.
3) From what I can tell ClientConnector.java has a few overriden methods and I see that the received method gets called but the connected method is never reached. I know this because you have a print statement that would get output to the console if it was reached. I don't know kryonet very well but I would have thought that connected should execute before received?
4) I looked into one possible solution on the kryonet discussion group but it didn't seem to work --> https://groups.google.com/forum/?fromgroups=#!topic/kryonet-users/QTHiVmqljgE

I've been trying to insert some various sleeps on threads to help pinpoint the problem but no luck. My prior post regarding a TCP registration error seems to no longer be a problem (it was a side effect of debugging code I had in place). I'm currently trying to break down the timing of the connect and update thread to see if somehow data is being sent before the connection is established.


Offline matheus23

JGO Kernel


Medals: 114
Projects: 3


You think about my Avatar right now!


« Reply #53 - Posted 2013-05-01 11:59:51 »

1) I can compile and connect the kryonet examples on my local pc (and use the same ports as used for ror).

Any difference in the code between ror and the examples? Probably it's a setup issue in the code...

2) I can compile and run the ror server and ror client with no issue. After clicking connect the map loads and I actually see the character entity created (but he is unable to move). Enter, F8 and esc keys are accepted as those see to be client side only.

Yes. Enter, F8 and Esc are client side. Walking isn't client side, because the input from the client goes to the server and then travels back to the client, where it is 'allowed' to be processed. Additionally (if the server would send anything) it would correct the player's position, but actually this has nothing to do with your issues... Cheesy

3) From what I can tell ClientConnector.java has a few overriden methods and I see that the received method gets called but the connected method is never reached. I know this because you have a print statement that would get output to the console if it was reached. I don't know kryonet very well but I would have thought that connected should execute before received?

It's normal behavior that connected is never called.
Try to start a server and connect a client, let's call it client A, and connected another client B. In A's Console you'll see the debugging output about client B connecting to the server.

So you actually receive messages, but you still can't walk? Or do anything? What happens if you connect two clients?

I could reproduce once... only once... when I was debugging somehow (through breakpoints and stepping), but I couldn't reproduce anymore. And I don't even remember what exactly I did.
The problem with debugging is, that the connection code depends a lot on timeouts and locks and stuff... So if you step through the code, simply by waiting to long on one instruction you could break a lock (for example the TCP registration lock, which waits 'only' 100 ms).
But I have no Idea what one could do instead...

4) I looked into one possible solution on the kryonet discussion group but it didn't seem to work --> https://groups.google.com/forum/?fromgroups=#!topic/kryonet-users/QTHiVmqljgE

Okey. I've tried out to replace this line:
1  
client.start(); // ClientConnector.java line 55

by this line:
1  
new Thread(client).start(); // ClientConnector.java line 55


For me it works. But since I've had no issues, it didn't fix anything noticeable for me, obviously Smiley
I've been trying to insert some various sleeps on threads to help pinpoint the problem but no luck. My prior post regarding a TCP registration error seems to no longer be a problem (it was a side effect of debugging code I had in place). I'm currently trying to break down the timing of the connect and update thread to see if somehow data is being sent before the connection is established.

Same as above: client A's connect is only called when another client B connects to the server, to which client A is connected to.

<edit>
[snip...]
I confirmed that queue.add(runnable) keeps getting called over and over. I assume on a normal connect this should just get called a single time. I added "System.out.println(queue.peek());" just before queue.add to see what was happening and got a dump like:

Totally normal behavior, I'm sorry... Smiley
What the queued listener does is: It takes the listener to which it should redirect to as an argument, and delivers Runnables which call the appropriate Listener's methods (receive, connect, disconnect, etc.). For that I have to give a method for queueing those Runnables. (The 'queue' method).

The reason for that is that I can call and process those Messages in my main loop then (tick method of ClientConnector). There it polls all the Runnables and processes them in the current thread.

[snip...]
This seems to indicate that not only is the list getting added to multiple times (from a single connection attempt) but that occasionally the list is emptied and results in those null lines. In other words a listener is added, something happens and it gets removed from the list, next time through we see a null line, and then the next time a new listener is created. It seems to go on like this indefinitely.

Hopefully I'm on the right track now. I am curious if anyone else running this demo were to insert this line if they would see the same output.

Messages come to the client -> multiple times Runnables for processing the messages come in.
The list is emptied, because the Client's main loop polls out all the runnables Wink
It's not fast enough sometimes, though, that's why it doesn't print null sometimes...
</edit>

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline bsmith2

Senior Newbie




All about the iso


« Reply #54 - Posted 2013-06-18 16:01:12 »

I was curious to see if I could get this working. I deleted the project and downloaded the latest from github and it worked! I'm not sure what has changed since the last build (if anything) but for some reason it seems good now. I was able to start the server and connect multiple clients and see them update on both sides.

A couple things I noticed (which I'm sure you already know about)
1) Once you hit enter and type in a chat message, you lose the ability to regain focus and move your character around again
2) The entered chat message doesn't seem to go anywhere
3) Entering a chat message causes your character to disappear to the other connected client
4) Entering a chat message causes the other connected client to no longer be able to move

I really appreciate the overall direction of this project, including the way you have your code organized. Now that I have a build running I'll also see what I can do to contribute.
Offline matheus23

JGO Kernel


Medals: 114
Projects: 3


You think about my Avatar right now!


« Reply #55 - Posted 2013-08-02 17:35:22 »

1) Yup..
2) Yup..
3) Err...
4) What da heck?

Seems like the other client crashes when the client sends a message.

Nice you want to contribute, I really find that extremely cool Smiley
Hopefully I'll find time (and will) to continue working on it, I'd love to collaborate Cheesy

Currently I'm having a day job, so I don't have that much time (willpower reduced as well...).
I still need to train myself to one of those persons who can have a programming hobby next to a programming job...

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Pages: 1 [2]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (29 views)
2014-12-15 09:26:44

Mr.CodeIt (20 views)
2014-12-14 19:50:38

BurntPizza (40 views)
2014-12-09 22:41:13

BurntPizza (75 views)
2014-12-08 04:46:31

JscottyBieshaar (37 views)
2014-12-05 12:39:02

SHC (50 views)
2014-12-03 16:27:13

CopyableCougar4 (47 views)
2014-11-29 21:32:03

toopeicgaming1999 (114 views)
2014-11-26 15:22:04

toopeicgaming1999 (102 views)
2014-11-26 15:20:36

toopeicgaming1999 (30 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!