The online racing simulator
Java - JInSim - a Java InSim library
(240 posts, started )
Java - JInSim - a Java InSim library
JInSim is an easy to use Java library for communicating with InSim, OutSim and OutGauge. It's currently in pre-alpha form, but I've created a few small examples that work correctly to get you started. The examples are well commented and straightforward, so if you have any Java knowledge at all, you should be able to understand them and move on to creating your own clients.

Right now, the core communication with InSim is done and I'm starting to create specialized classes for common use scenarios. The first one is a "RaceEventClient" that will notify you about crashes in progress and the closest race on the track. What I really would like is some feedback from people who are interested in using a library like this.

I've created a SourceForge project where you can get the code through anonymous CVS. If you aren't familiar with CVS and want JInSim, let me know. You can find the project at http://jinsim.sourceforge.net

Thanks,

--
Rob
Nice work Rob :up: I probably won't use it, but the more libraries the better I've added it as a link to the FAQ thread.
I don't quite know how to word this. I've used CodeWarrior at school, but I don't really know where to start with Java. I'd love to use it for a web program I'm working on. Any clues as where I should look?
1. Make sure you have java installed. You can download a JDK from http://java.sun.com if you don't. If you can type "java -version" at a command line and get version information, you're on your way.

2. Download JInSim from SourceForge. Go to http://sourceforge.net/projects/jinsim/ and click the big green Download button to download the zip file. The current one is jinsim-0.1.zip

3. Unzip jinsim-0.1.zip somewhere on your hard drive that's handy.

4. Look at the README file inside the newly unzipped directory. There's some information there on how to run the "Hello World!" example. Once you have that working, you're well on your way.

To start off with, you may just want to edit simple java files with your favorite text editor, figure out how to compile them with javac and run them. Once you're comfortable with that, you can download one of the freely available Java IDEs like Eclipse or NetBeans. I use Eclipse, because that's what I use at work. I actually prefer IntelliJ, but that's a (spendy) commercial package. If you have any questions, let me know.

--
Rob
I start IntelliJ and it thows me out to a screen full of XML when I try to make a web application. I don't want a screen with XML, I want a screen where I can write java code. Now I've never done a java program for the web, but I don't think this was ment to happen. I need ... a tutorial. Anyone got a good one for making java programs for web browser?
JInSim v0.3 released
I'll announce new releases on this thread from now on instead of spamming the forum with new threads. The new release includes:

- An experimental client using the selectable sockets from Java's nio package.
- Fixes for thread synchronization (thanks Brilwing!)
- Fixes and additions to the request and response classes.
- Additions to InSimHelper
- Fixes to the packaging so that the speedometer example can find its images
- Fixes to some of the math on the RaceEventClient
- More documentation.
#7 - abz1
locks
Yep, the new features of Java 6 (Java SE 6? Java 1.6? What's with Sun and their versions?) Anyway...the new features are nice. I'm trying to stay 1.4 compliant for right now. You'll notice I don't use things like parameterized types in JInSim. I'm not doing anything fancy with locks either, so the cool new Lock objects wouldn't make a difference, I don't think. Thanks for pointing them out, though. It made me sit down and check out the feature more deeply.
Oh nice to see someone developing such thing, will be very useful... :>
I'm trying to make my own appl based on JInSim v0.3 and I have problems with getting

total time, split1 time, split2 time, split3 time, (last) lap time
front gap, back (rear) gap
actual lap number, total number of laps

Thx for help.
Brilliant!!!!!!!

I write AI programs in Java, and this will save me a lot of work!

thank you so much!
Quote from Pablo.CZ :I'm trying to make my own appl based on JInSim v0.3 and I have problems with getting

total time, split1 time, split2 time, split3 time, (last) lap time
front gap, back (rear) gap
actual lap number, total number of laps

Thx for help.

I have done such a program (except the front and back gap) and you find the source code here: https://openbakery.org/svn/repos/trunk/gstats/

The output of the program is a textfile that contains the stats and you find an example here:
http://dev.guglhupf.net/gstats ... O5_race_0608271626.gstats

I use the *.gstats files in a php program to manage the austrian championship league. (see liveforspeed.at -> Events/ÖLFSM)
Thank you Brilwing. I don't have some packages you are using (org.apache.commons.logging*) but I'm working on it. I'm new to Java, so my progress is slow.
I currently working on updating jinsim for patch X. It is not finished by now, but you can find a first test release here: http://liveforspeed.at/download/jinsim-0.4.91.zip
In this release all jinsim response and request packets are updated and should now work with lfs patch w24, but only UDP connections are supported right now. I will add the TCP support soon.
JInSim now requieres Java 5.0.

You should also look into the Changes file and also exam the examples, because I also have done some refactorings.
Great Now if there only was support for tyre temp and damage output in the game, ... but anyways, i'll definately have some use for the jinsim lib.
Here is a new package of the current jinsim for patch x: http://liveforspeed.at/download/jinsim-0.4.95.zip

Changes:
- Both TCP and UDP is supported
- New button system added
- Encoding support. The LFS codepages are converted.

So this package should now have all features of the new InSim in patch x. If I missed something let me know
Quote from Brilwing :Here is a new package of the current jinsim for patch x: http://liveforspeed.at/download/jinsim-0.4.95.zip

Changes:
- Both TCP and UDP is supported
- New button system added
- Encoding support. The LFS codepages are converted.

So this package should now have all features of the new InSim in patch x. If I missed something let me know

i keep getting this error Microsoft Windows XP [Version 5.1.2600]

Exception in thread "main" java.lang.NoClassDefFoundError: org/kerf/jinsim/examp
les/helloworld/Main


please help ............... me
Quote from joelbarton1987 :i keep getting this error Microsoft Windows XP [Version 5.1.2600]

Exception in thread "main" java.lang.NoClassDefFoundError: org/kerf/jinsim/examp
les/helloworld/Main


please help ............... me

I'm wondering how you get this error.
Try this:
java -cp dist\jinsim.jar;lib\commons-logging-1.0.4.jar org.kerf.jinsim.examples.helloworld.Main

You need Java 5.0 of course.
Quote from Brilwing :I'm wondering how you get this error.
Try this:
java -cp dist\jinsim.jar;lib\commons-logging-1.0.4.jar org.kerf.jinsim.examples.helloworld.Main

You need Java 5.0 of course.

same error aaaarrrrrrrggggg ....... any segestions
Quote from joelbarton1987 :same error aaaarrrrrrrggggg ....... any segestions

You must execute this command in the jinsim-0.4.95 directory.


C:\workspace\jinsim-0.4.95>java -cp dist\jinsim.jar;lib\commons-logging-1.0.4.jar org.kerf.jinsim.examples.helloworld.Main 192.168.99.
2 60000

vs.

C:\workspace\jinsim-0.4.95>cd ..

C:\workspace>java -cp dist\jinsim.jar;lib\commons-logging-1.0.4.jar org.kerf.jinsim.examples.helloworld.Main 192.168.99.2 60000
Exception in thread "main" java.lang.NoClassDefFoundError: org/kerf/jinsim/examples/helloworld/Main

Perhaps you don't have the system classpath var set. try adding the current directory (".") to the -cp list

java -cp .;dist\jinsim.jar;lib\commons-logging-1.0.4.jar org.kerf.jinsim.examples.helloworld.Main 192.168.99.
2 60000
The system classpath is not need cause the Main class is in the jinsim.jar
Quote from joelbarton1987 :i keep getting this error Microsoft Windows XP [Version 5.1.2600]

Exception in thread "main" java.lang.NoClassDefFoundError: org/kerf/jinsim/examp
les/helloworld/Main

Simple workaround: use Eclipse.

Java - JInSim - a Java InSim library
(240 posts, started )
FGED GREDG RDFGDR GSFDG