is this coming from kryonet code INDEXOUTOFBOUNDEXCEPTION

41 views
Skip to first unread message

jibbylala

unread,
Apr 27, 2011, 2:59:54 PM4/27/11
to kryonet-users
hello all,
i used kryonet lately after long time, i need to work on this again,i
stop working on this becuase of this exception but unfortunately i
need to open this project again, is this exception coming from
kryonet code or there is some problem in my code please help.

java.lang.IndexOutOfBoundsException: Index: 482, Size: 482
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at com.esotericsoftware.kryonet.rmi.ObjectSpace
$RemoteInvocationHandler.waitForResponse(ObjectSpace.java:344)
at com.esotericsoftware.kryonet.rmi.ObjectSpace
$RemoteInvocationHandler.invoke(ObjectSpace.java:329)
at $Proxy0.location(Unknown Source)
at
com.esotericsoftware.kryonet.BallWorldClient.runball(BallWorldClient.java:
135)
at
com.esotericsoftware.kryonet.BallWorldClient.run(BallWorldClient.java:
123)
at java.lang.Thread.run(Thread.java:662)
java.lang.IndexOutOfBoundsException: Index: 483, Size: 483
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at com.esotericsoftware.kryonet.rmi.ObjectSpace
$RemoteInvocationHandler.waitForResponse(ObjectSpace.java:344)
at com.esotericsoftware.kryonet.rmi.ObjectSpace
$RemoteInvocationHandler.invoke(ObjectSpace.java:329)
at $Proxy0.getColor(Unknown Source)
at
com.esotericsoftware.kryonet.BallWorldClient.drawworld(BallWorldClient.java:
153)
at com.esotericsoftware.kryonet.BallWorldClient
$MyKeyListener.paintComponent(BallWorldClient.java:192)
at javax.swing.JComponent.paint(JComponent.java:1029)
at javax.swing.JComponent.paintChildren(JComponent.java:862)
at javax.swing.JComponent.paint(JComponent.java:1038)
at javax.swing.JLayeredPane.paint(JLayeredPane.java:567)
at javax.swing.JComponent.paintChildren(JComponent.java:862)
at javax.swing.JComponent.paintToOffscreen(JComponent.java:5131)
at javax.swing.RepaintManager
$PaintManager.paintDoubleBuffered(RepaintManager.java:1479)
at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:
1410)
at javax.swing.RepaintManager.paint(RepaintManager.java:1224)
at javax.swing.JComponent.paint(JComponent.java:1015)
at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:
21)
at
sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:
60)
at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:
97)
at java.awt.Container.paint(Container.java:1780)
at java.awt.Window.paint(Window.java:3375)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:
796)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:
713)
at
javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:
693)
at javax.swing.SystemEventQueueUtilities
$ComponentWorkRequest.run(SystemEventQueueUtilities.java:125)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:
269)
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:
184)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:
174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:
169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:
161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
java.lang.IndexOutOfBoundsException: Index: 484, Size: 484
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at com.esotericsoftware.kryonet.rmi.ObjectSpace
$RemoteInvocationHandler.waitForResponse(ObjectSpace.java:344)
at com.esotericsoftware.kryonet.rmi.ObjectSpace
$RemoteInvocationHandler.invoke(ObjectSpace.java:329)
at $Proxy0.location(Unknown Source)
at
com.esotericsoftware.kryonet.BallWorldClient.runball(BallWorldClient.java:
135)
at
com.esotericsoftware.kryonet.BallWorldClient.run(BallWorldClient.java:
123)
at java.lang.Thread.run(Thread.java:662)
java.lang.IndexOutOfBoundsException: Index: 485, Size: 485
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at com.esotericsoftware.kryonet.rmi.ObjectSpace
$RemoteInvocationHandler.waitForResponse(ObjectSpace.java:344)
at com.esotericsoftware.kryonet.rmi.ObjectSpace
$RemoteInvocationHandler.invoke(ObjectSpace.java:329)
at $Proxy0.getColor(Unknown Source)
at
com.esotericsoftware.kryonet.BallWorldClient.drawworld(BallWorldClient.java:
153)
at com.esotericsoftware.kryonet.BallWorldClient
$MyKeyListener.paintComponent(BallWorldClient.java:192)
at javax.swing.JComponent.paint(JComponent.java:1029)
at javax.swing.JComponent.paintChildren(JComponent.java:862)
at javax.swing.JComponent.paint(JComponent.java:1038)
at javax.swing.JLayeredPane.paint(JLayeredPane.java:567)
at javax.swing.JComponent.paintChildren(JComponent.java:862)
at javax.swing.JComponent.paintToOffscreen(JComponent.java:5131)
at javax.swing.RepaintManager
$PaintManager.paintDoubleBuffered(RepaintManager.java:1479)
at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:
1410)
at javax.swing.RepaintManager.paint(RepaintManager.java:1224)
at javax.swing.JComponent.paint(JComponent.java:1015)
at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:
21)
at
sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:
60)
at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:
97)
at java.awt.Container.paint(Container.java:1780)
at java.awt.Window.paint(Window.java:3375)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:
796)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:
713)
at
javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:
693)
at javax.swing.SystemEventQueueUtilities
$ComponentWorkRequest.run(SystemEventQueueUtilities.java:125)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:
269)
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:
184)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:
174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:
169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:
161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Nate

unread,
Apr 27, 2011, 4:59:06 PM4/27/11
to kryone...@googlegroups.com
From the stacktrace, I can't tell why the exception is occurring. I encourage you to not use ObjectSpace so you can better understand what is going on. Structure your app like this:

* The server has list of balls. When a client connects, a ball is added to the list for that client. When a client disconnects, their ball is removed.

* The server has a thread. It sleeps for X seconds, then moves all the balls and sends the new positions to all clients, then repeats.

* The client connects to the server.

* The client draws all the balls at the last position the server told it.

This way you can have multiple clients connect, and they will all see the same balls moving around. The movement will only be updated X seconds, because the server thread only updates them every X seconds. Get that working first, then you can worry about how to make the balls move smoother (client side prediction), how clients can control their balls, etc.

-Nate



--
You received this message because you are subscribed to the "kryonet-users" group.
http://groups.google.com/group/kryonet-users

jibbylala

unread,
Apr 27, 2011, 9:01:16 PM4/27/11
to kryonet-users
i m working on the code, you send me last time, i was working on this
project. we had lot of discussion and finally i gave up and left
kryonet because of this exception and my unanswered questions u can
see the thread:Simple moving -ball animation /simulation is not
working with Kryonet

i thought i have enough information about kryonet last but now i m
again recovering because i forgot all, only lacking was my unanswered
questions and this problem

recently i posted the code here with the same question:
http://www.java-gaming.org/index.php/topic,24148.0.html

thanks
jibbylala

On Apr 27, 10:59 pm, Nate <nathan.sw...@gmail.com> wrote:
> From the stacktrace, I can't tell why the exception is occurring. I
> encourage you to not use ObjectSpace so you can better understand what is
> going on. Structure your app like this:
>
> * The server has list of balls. When a client connects, a ball is added to
> the list for that client. When a client disconnects, their ball is removed.
>
> * The server has a thread. It sleeps for X seconds, then moves all the balls
> and sends the new positions to all clients, then repeats.
>
> * The client connects to the server.
>
> * The client draws all the balls at the last position the server told it.
>
> This way you can have multiple clients connect, and they will all see the
> same balls moving around. The movement will only be updated X seconds,
> because the server thread only updates them every X seconds. Get that
> working first, then you can worry about how to make the balls move smoother
> (client side prediction), how clients can control their balls, etc.
>
> -Nate
>

Nate

unread,
Apr 27, 2011, 11:37:12 PM4/27/11
to kryone...@googlegroups.com
KryoNet works, it is your code that needs work. My advice still stands: rewrite your app without using RMI so you can better understand what is going on. Also, the approach that I outlined is very different from how your current code works.

-Nate

jibbylala

unread,
Apr 28, 2011, 12:19:12 PM4/28/11
to kryonet-users
what would be the more simpler code (logic) than that...
> ...
>
> read more »

jibbylala

unread,
Apr 28, 2011, 3:14:02 PM4/28/11
to kryonet-users
one more question is it possible to send array of objects?

On Apr 28, 5:37 am, Nate <nathan.sw...@gmail.com> wrote:
> KryoNet works, it is your code that needs work. My advice still stands:
> rewrite your app without using RMI so you can better understand what is
> going on. Also, the approach that I outlined is very different from how your
> current code works.
>
> -Nate
>
> ...
>
> read more »

Nate

unread,
Apr 28, 2011, 4:29:05 PM4/28/11
to kryone...@googlegroups.com
Yes.

-Nate



--
Reply all
Reply to author
Forward
0 new messages