The online racing simulator
JInSim v0.2 released
(8 posts, started )
JInSim v0.2 released
The Java InSim library v0.2 has been released.

See http://jinsim.sourceforge.net

v0.2 includes:
  • org.kerf.jinsim.RaceEventClient is a class that gathers interesting race events as they happen. Extending this class will allow you to easily reaspond to certain race events easily. Currently it will tell you when a car is losing control and may be crashing (or drifting?), and also reports on the closest current race between two cars.
  • org.kerf.jinsim.InSimHelper is a new helper class that is a handy place to look for commonly needed tasks. There are plans for a number of new methods. Right now you can get a taste for what will go in there. A lot of the requests will have an easy to use helper so you don't have to create them and send them. There is a "sendColoredMessage()" helper right now that makes it much easier to send a message in any color you'd like. Eventually there will be a "sendMultiColoredMessage()" helper that will allow you to mix colors within a message easily.
  • New example: A working speedometer. This example shows how you might use OutGauge data to drive an external GUI (or real gauges?)
  • Some of the code has been improved for performance. Particularly when creating OutSim and OutGauge packets, since the information contained in them is only accurate for a short amount of time.
  • More javadoc was added and will continue to be added.
--
Rob
The Java InSim library (JInSim)
http://jinsim.sourceforge.net
Quote from rheiser :
  • org.kerf.jinsim.RaceEventClient is a class that gathers interesting race events as they happen. Extending this class will allow you to easily reaspond to certain race events easily. Currently it will tell you when a car is losing control and may be crashing (or drifting?), and also reports on the closest current race between two cars.
Rob
The Java InSim library (JInSim)
http://jinsim.sourceforge.net

That is funny. Very useful tool also, I'm sure many developers and league admins might be able to use this. Especially a certain league I'm in may benefit because she has many people to watch at once.
Nice one
I am learning java in the university so it might come in helpful
Keep up the good work
Quote from dawesdust_12 :That is funny. Very useful tool also, I'm sure many developers and league admins might be able to use this. Especially a certain league I'm in may benefit because she has many people to watch at once.

It's interesting to play with at any rate. The code for the RaceEventClient in 0.2 is brand new and I've already found a number of bugs in it. I'm using it for a JInSim based add-on I'm toying around with, so I should shake out the obvious bugs pretty quickly. I'll be making a 0.3 release relatively soon. If I find out that any bugs are holding someone up I'll release more often.

Quote from Falcon1 :Nice one
I am learning java in the university so it might come in helpful
Keep up the good work

I've tried to include plenty of documentation so that even Java beginners can get some use out of it. It's a lot easier to learn something when you're using it for something else you're interested in.

As always, let me know if you're stuck and I can point you in the right direction.
I've started using NetBeans as my ide. God ... that makes me shudder every time I type that.
First of all you jinsim is a great tool. I have played around with it for some time now and it saves me a lot of time, and I really like this lib


I have some improvement suggestions:
I found out that jinsim uses a lot of cpu time. First in the examples you stop the main thread with a:

while(true) {
}


This is not a good idea, because the loop here produces a lot of no-operations on the cpu, so the cpu load is 100%.
This can be avoid by a dead-lock (the only dead-lock I know that make sense ):

String lock = new String("lock");
synchronized(lock) {
lock.wait();
}


This does the same as the loop, but does not cost any cpu time.

After I have done this, the cpu load was still high (about 50% on my machine), so a investigated the code a bit and found the cause:
In the Receiver class the run method waits for packages you have following loop:

while(isRunning()) {
...
}


When you add the command
Thread.sleep(1);
at the end of the loop, than the cpu load is near to idle on my machine, because the thread scheduler does not process this loop too excessive.

Another minor issue is that the Request classes (e.g. NewPlayerInfoRequest) the setValue method is protected, and I use this request at the start of an race to get the starting position of each player and I have to set the player id using this method.
It would be nice if the method is public, because so I don't have to make a subclass to achieve the same behavier.
Now I really discovered a bug

In the ResultResponse.java 32 bytes are read from the buffer for the carName, but this must be 4 bytes. To the rest of the values are not correct
Thanks for the feedback, Brilwing -- I really appreciate it. I've been working on the thread synchronization and added your suggestions. The bug in ResultResponse was a cut and paste error :guilty:

I plan to make a new release today, so these should be fixed in that release as well as in CVS.

JInSim v0.2 released
(8 posts, started )
FGED GREDG RDFGDR GSFDG