The online racing simulator
Racetracking via InSim
(19 posts, started )
Racetracking via InSim
Hi all!

For some days I play somewhat with Insim.

At the moment I'm a bit confused, how to build up a live ranking table/list with the actual position of each driver in a race.

When a race restarts, I get the starting positions out of the IS_REO packet. But how do I know the position of a driver after a few laps?
To know the actual lap, I can count the IS_LAP packets, and if the IS_LAP of driver x arrives before IS_LAP of driver y, I could know, that x is in front of y. But is this the right way?
I want to know which driver is in front of whom in every second, or perhaps in every sector.
Must I use current path node? But then I only know if someone has overtaken another, when his node is higher than the node of the overtaken car.

paXton
First off, I am not an InSim expert by any means, but this is the way I would go about it, from the information that I have learent from the InSim.txt. I am sure that my colleages will post something on here that will not only blow my idea out of the water and also do things in much less steps, thus taking less resources to complete the task you have asked of it.

$place[] = $IS_LAP['NAME'];
$place[$lap][$IS_SPX['SplitNumb']] = $IS_SPX['NAME'];

Get the start order, with the player (user) name as the key.
From the IS_LAP packet, the order they are received in will dictate what place they are in for that split (In a perfect world that is, if a car is 0.03 seconds behind the other and the network lag causes it to delay a packet by 0.04 seconds then you have a problem.)
Quote from Dygear :First off, I am not an InSim expert by any means, but this is the way I would go about it, from the information that I have learent from the InSim.txt. I am sure that my colleages will post something on here that will not only blow my idea out of the water and also do things in much less steps, thus taking less resources to complete the task you have asked of it.

$place[] = $IS_LAP['NAME'];
$place[$lap][$IS_SPX['SplitNumb']] = $IS_SPX['NAME'];

Get the start order, with the player (user) name as the key.
From the IS_LAP packet, the order they are received in will dictate what place they are in for that split (In a perfect world that is, if a car is 0.03 seconds behind the other and the network lag causes it to delay a packet by 0.04 seconds then you have a problem.)

The LAP and SPX packets contain the time as measured by LFS, and should therefor be lagfree. If you manage to capture all the LAP packets, you can simply add all the laptimes, to get the total time after X amount of laps.

If you really want to know the exact standings you can use the NLP packets, but you have to keep in mind that the node on the finishline isn't necessarily zero, so you cant just say if (car_A_nod < car_B_node) then car_B is in front.
See paXton, I told you there would be someone to refute, and improve on my premise. All it takes is the first post, with a half ass'ed attempt to get the job done, the some one will say, No, no, that is wrong and you should do it this way. From here on in that is going to be my job on the LFS Programmer Forum, to give half assed ideas to the programmers who need it, only to be rebutted by a much more experience programmer. I think it must be some kind of territorial thing. Anyway, all it takes is the first post with the half assed awanser. Look at the time between your first post then my post. Then look at the time for a much better programmer to point out the improvements. It's kinda cool when you think about it .
#5 - filur
Quote from Dygear :From here on in that is going to be my job on the LFS Programmer Forum, to give half assed ideas to the programmers who need it, only to be rebutted by a much more experience programmer.

Bah, apart from the lag thingie you were basically spot on.

Frankmd even codes java by choice (?) , so you're technically ahead already.
Another quick hijack of this thread, what do you use to program Frankmd and filur, while I am at it, I'll also include the_angry_angel and JogDive in this sample.

What is your programming languages of choice?
What programming languages do you know?
What do you use the most as your text editor for programming?
What IDE do you use, if any, and if you don't do you have problems with them?
What is your compiler of choice, for your primary programming language?
What libarys do you recomend for your primary programming language?
Quote from Dygear :I'll also include the_angry_angel and JogDive in this sample.

pardon, what ??

My favorite choice is Borland C++ Builder (VCL/CLX) for apps with a gui. But i´m on the C# / C++ console also at home. During my education and Cisco Systems certification, we only used console programming to fit the apps under windows and unix.
Quote from Frankmd :If you really want to know the exact standings you can use the NLP packets, but you have to keep in mind that the node on the finishline isn't necessarily zero, so you cant just say if (car_A_nod < car_B_node) then car_B is in front.

If I remember correctly the way I did it in the RollingStart module of RaceManager (it's been a long time, forgive my failing memory), you'd need to:
- compare the lap number
- compare the nodes (I determined the node of the start/finish line by using the node the first car starts from at race restart)
- if 2 cars are on the same node, calculate the distance between the 2 cars projected on the axis of direction of one of the cars.

This is definitely not perfect, as the node for the start/finish might not be quite accurate (1 or 2 nodes off), and that the cars travel fairly straight (for distance comparison). This works fine for rolling start, since they are all on lap 1, and going at a reduced speed. For a full race, you might have some small errors for like a second, in case a car spins, or close to the finish line.


And to answer Dygear's questions (although I wasn't included in his list):
What is your programming languages of choice?
Python
What programming languages do you know?
Python, Java, PHP (and a few others, like C/C++, Perl when I've got no other choice).
What do you use the most as your text editor for programming?
Vi
What IDE do you use, if any, and if you don't do you have problems with them?
None, usually
What is your compiler of choice, for your primary programming language?
No compiler for Python
What libarys do you recomend for your primary programming language?
Just about everything is included with Python. A few specialized libraries can be used, but rarely.
What is your programming languages of choice?
The best tool for the job; once you get past the language bashing, and want to Just Get Things Done(TM), you're half way there. For me, this generally means PHP for web stuff (Perl doesnt fit in my brain), BASH for command line, and C for anything else. I detest Python.

What programming languages do you know?
Programming languages is a bit wide, generally; PHP, VBScript and elements of VBasic, C, BASH, brain**** (not sure if I'd ever touch this again, but I can write hello world), JavaScript plus or minus a few others probably.

What do you use the most as your text editor for programming?
Scite, or gVim (warning: you'll loose your ":" key markings very quickly using any Vi derivative).

What IDE do you use, if any, and if you don't do you have problems with them?
CodeBlocks for C/C++. Otherwise, I just use Scite or gVim and Test Driven Development.

What is your compiler of choice, for your primary programming language?
For C and C++, gcc.

What libaries do you recomend for your primary programming language?
For C, the standard ones, APR (Apache RunTime), cURL, for GUI's its usually WxWidgets for me, although I occasionally use GTK or Qt.

To be honest, something Stuart Langridge once said; "It's not a case of learning the syntax of the language, you can do that within minutes, its a case of learning the API's you're going to use" (not exact, but you get the gist). To make my point, you only need to know the following and you can code in most languages: if, else, while, for, =, +, -.
What is your programming languages of choice?
I use Java, mostly because it is the language used for several purposes at my university. I guess there are better languages, but at the moment it does the job.

What programming languages do you know?
PHP, Java and I've done some tiny stuff in vB.

What do you use the most as your text editor for programming?
I use Crimson Editor, just as basic as possible. Sometimes I use Eclipse to check the code, but I dont really like programs with 300 windows crammed at your screen, so I use it as less as possible.

What IDE do you use, if any, and if you don't do you have problems with them?
I dont use any, and I dont really understand the last part of the question...?

What is your compiler of choice, for your primary programming language?
Just the sun compiler.

What libarys do you recomend for your primary programming language?
Up till now I got everything done using the libraries that are standard in Java.
What is your programming languages of choice?
PHP, i often write something just about every day, and these days it's rarely web-based, PHP can do wonderful things outside a webserver.

What programming languages do you know?
PHP, some Delphi/pascal, some C and Quake-C (!), mIRC's scripting language, MS extended BASIC - Spectravideo 328, and i've code-monkey'd some stuff in C#. I know some javascript as well.

What do you use the most as your text editor for programming?
Scite.

What IDE do you use, if any, and if you don't do you have problems with them?
None.

What is your compiler of choice, for your primary programming language?
None, no need.

What libarys do you recomend for your primary programming language?
PHP-GTK, even though it's extremely annoying.
What is your programming languages of choice?
C#

What programming languages do you know?
C#/C/C++, perl, php, java, lisp

What do you use the most as your text editor for programming?
Emacs if not C#, Visual Studio, if C#

What IDE do you use, if any, and if you don't do you have problems with them?
Visual Studio w/ C#, no IDE otherwise

What is your compiler of choice, for your primary programming language?
Default .NET compiler, or mono if on non-MS platforms

What libarys do you recomend for your primary programming language?
.NET has more libraries in its core than i'm likely to use, but i use log4net & NUnit for most of my projects as well. Really just dev support not as a feature of the final product.
For a moment i thought mr.angry angel had prevailed, but i was wrong.

"libarys"? "libaries"?

I guess programmers are overly used to copy/paste.
@all: thx for the quick answers.
I have to think about it, which technique fit my needs, or how acurate the results should be.

@Dygear: sorry, I understood not the meaning of all your posts, but I will complete the list later, too.

btw: is it right, that when a lfs dedi is relayed via the lfs relay server, the insim port cannot be used by another isim app?
Quote from paXton :btw: is it right, that when a lfs dedi is relayed via the lfs relay server, the insim port cannot be used by another isim app?

Yes.
Even though nobody asked me and it's OT, I'll jump in here

What is your programming languages of choice?
Just about antying but C++. I actually love to work in ASM / C.

What programming languages do you know?
"Know" is a subjective term; C, x86 / x64 Assembly, oCaml, Perl, VB, C#, C++, etc, etc. I can work in just about anything save the "web based" languages. Don't have a need for web based stuff in driver land. *g*

What do you use the most as your text editor for programming?
Laugh as you will, I'm really starting to like VS 2005.

What IDE do you use, if any, and if you don't do you have problems with them?
See above.

What is your compiler of choice, for your primary programming language?
At home, See above above. At work we have a somewhat custom compiler tied to our source code manager.

What libarys do you recomend for your primary programming language?
What ever is needed honestly. Stupid as it sounds, you should always look for ways to streamline your binaries / code.

Programming is 10% typing and 90% researching APIs anyways.
Quote from der_jackal :Programming is 10% typing and 90% researching APIs anyways.

/me high fives der_jackal
*Chuckles @ The High Five*
For all of the programing langues I have done, it's been pretty much 75% - 25%. 75% is programming, and the other 25% is just looking it up myself or asking some one with more experience then myself how this or that works. It has worked whell so far, but I find myself lacking. :sad, perplexed look in his face: I should really stop high jacking this thead, and make another one. But I don't quite know what to call it.
To be honest, there are a few ways to think - particularly in OOP - which could be what you think you're missing. You can normally start picking these up from books and stuff. Personally I love getting a new programming or general geek book, especially one I can take with me to work, or read on the bog.

Racetracking via InSim
(19 posts, started )
FGED GREDG RDFGDR GSFDG