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
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
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
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…
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 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
Each Entity (which is a class) [icode]implements Comparable[/icode], which means, the Entity can be compared to another Entity.
The Interface [icode]Comparable[/icode] forces me to implement the method [icode]public int compareTo(Entity other)[/icode], 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 )
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:
I know there is a trick with sorting by Integers…
[icode]return this.y - that.y;[/icode]
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:
[icode]return (int)(this.y * 1000 - that.y * 1000);[/icode]
The higher the two get multiplied the higher the precision…
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.
I can compile and connect the kryonet examples on my local pc (and use the same ports as used for ror).
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.
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?
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.
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:
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.
Any difference in the code between ror and the examples? Probably it’s a setup issue in the code…
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…
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…
Okey. I’ve tried out to replace this line:
client.start(); // ClientConnector.java line 55
by this line:
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
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.
[quote="bsmith2,post:53,topic:41136"]
[[i]snip...[/i]]
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:
[/quote]
Totally normal behavior, I'm sorry... :)
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.
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
It’s not fast enough sometimes, though, that’s why it doesn’t print null sometimes…
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.
I can compile and connect the kryonet examples on my local pc (and use the same ports as used for ror).
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.
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?
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.
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:
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.
Any difference in the code between ror and the examples? Probably it’s a setup issue in the code…
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…
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…
Okey. I’ve tried out to replace this line:
client.start(); // ClientConnector.java line 55
by this line:
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
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.
[quote="bsmith2"]
[[i]snip...[/i]]
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:
[/quote]
Totally normal behavior, I'm sorry... :)
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.
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
It’s not fast enough sometimes, though, that’s why it doesn’t print null sometimes…
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)
Once you hit enter and type in a chat message, you lose the ability to regain focus and move your character around again
The entered chat message doesn’t seem to go anywhere
Entering a chat message causes your character to disappear to the other connected client
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.
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)
Once you hit enter and type in a chat message, you lose the ability to regain focus and move your character around again
The entered chat message doesn’t seem to go anywhere
Entering a chat message causes your character to disappear to the other connected client
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.
Seems like the other client crashes when the client sends a message.
Nice you want to contribute, I really find that extremely cool
Hopefully I’ll find time (and will) to continue working on it, I’d love to collaborate
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…