Hi, all. As the topic says, I'm very much an InSim noob. I've tried looking at the guides/examples/readme files for a few things, but haven't found many on Java/JInSim.
I've had an idea for writing my own race tracking/timing tool and I've been putting off writing it for a long time. So, I decided to get into it properly yesterday and I've made some progress. I've attached how it's looking in its current state (don't laugh! :P )
The biggest problem I have for the moment is that the player order isn't correct. So, I'm trying to use the Node and Lap information to order the players in correct race order. However, when I try to do this I get a BufferUnderflowException:
"02-Mar-2008 21:18:34 net.sf.jinsim.response.ResponseFactory getPacketData
SEVERE: java.nio.BufferUnderflowException"
I'm working from a modified version of one of the JInSim examples, the code for the insim part of the app is below:
I've put the request for the information in a loop that is delayed 5 seconds, so I'm trying to retrieve player's position information periodically then re-order the player list.
I'd appreciate any help/advice or pointing to relevant Java examples on this, thanks.
I'm using JInSim 0.5rc2.
I've had an idea for writing my own race tracking/timing tool and I've been putting off writing it for a long time. So, I decided to get into it properly yesterday and I've made some progress. I've attached how it's looking in its current state (don't laugh! :P )
The biggest problem I have for the moment is that the player order isn't correct. So, I'm trying to use the Node and Lap information to order the players in correct race order. However, when I try to do this I get a BufferUnderflowException:
"02-Mar-2008 21:18:34 net.sf.jinsim.response.ResponseFactory getPacketData
SEVERE: java.nio.BufferUnderflowException"
I'm working from a modified version of one of the JInSim examples, the code for the insim part of the app is below:
try {
client = new SimpleClient();
client.addListener(this);
client.connect(new UDPChannel(hostname, port), adminPassword, "console");
client.send(new SmallRequest(Small.START_SENDING_POSITION));
while(!stopped) {
// Retrieve node packets (for positioning)
client.send(new TinyRequest(Tiny.NODE_LAP));
Thread.sleep(Constants.WAITTIMEINSIM);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
client.close();
} catch (IOException e) {
e.printStackTrace();
}
}
I've put the request for the information in a loop that is delayed 5 seconds, so I'm trying to retrieve player's position information periodically then re-order the player list.
I'd appreciate any help/advice or pointing to relevant Java examples on this, thanks.
I'm using JInSim 0.5rc2.