The online racing simulator
Making sense of OutSim UDP packets
(23 posts, started )
Making sense of OutSim UDP packets
Hi all,

I'm afraid I'm very new to this, but I hope you can help.

I have enabled the OutSim feature and captured some of the OutSim data as a text file using a program called SmartSniff.

Now, I am aware of the format the OutSim data takes. Each UDP packet is made up of 17 values:

unsigned int, float, float, float, float, float, float, float, float, float, float, float, float, int, int, int, int

OK, so here is what I get from SmartSniff when I log 10 consecutive UDP packets as a text file:

SMSNF100 À¨  \ Œò“ùû¨ÅE \›· €‡À¨ À¨ [ï2 H‰z8ð xäKºZë.<ÿ'ˆ¼µÓ¼Œ|<Â_E:XÈ–¹4*.¸oÓ}8'–ù·À{’º}3ä9ç»þcµ + \ @·˜ùû¨ÅE \›¼ €‚À¨ À¨ [ï2 HZ±Vð „?Kº0å2<f燼µÓ¼Œ|<Â_E:?¶³¹uðɶ«ôi8=íb¸?ª’º?³ä9ç»þ`µ + \ ô{?ùû¨ÅE \›Á €}À¨ À¨ [ï2 H-·tð üJºPõ5<¸*‡¼µÓ¼Œ|<Â_E:‚·¹p{¿7«ÔY8[*¸Ï’ºÊå9ç»þ]µ + \ NÞŸùû¨ÅE \›Â €|À¨ À¨ [ï2 Hö#ˆð w‰Jº ¨7<©Œ‡¼Æö¼,Š|<«×F:90™:_¡Ý8b3a8Á•66Ð’º¨aå9ç»þ[µ + \ £¤ùû¨ÅE \›Æ €xÀ¨ À¨ [ï2 HíÊœð `DºÛ*5<Ãÿ…¼Æö¼,Š|<«×F:Ì:…×69ÍAÎ70Ó8Éè?º
4â9ç»þYµ + \ j,®ùû¨ÅE \›Ê €tÀ¨ À¨ [ï2 HcØð *ùBºù-9<=Æ‚¼Æö¼,Š|<«×F:µÄZ:tô8pÈÕ7Â
Ý8“T?ºn$â9ç»þSµ + \ ÄŽ°ùû¨ÅE \›Ò €lÀ¨ À¨ [ï2 HUÉöð .UBºa
><Ðg?¼Æö¼,Š|<«×F:?`?¸
ò8‰Ø7¯á·"ò?º]¶â9ç»þPµ + \ xSµùû¨ÅE \›Ó €kÀ¨ À¨ [ï2 H?ñ ‰Aºž=B<¨€¼Æö¼,Š|<«×F:ôú
º ¸Ð5nÇÝ7¡B¹îw?ºØ=ã9ç»þMµ + \ ,ºùû¨ÅE \›Ö €hÀ¨ À¨ [ï2 HŠ2ñ ??@ºEVD<u}¼Æö¼,Š|<«×F:ÓŽ°¹"µê7†¨ 8`\¹‘ô?ºÿµã9ç»þJµ + \ àܾùû¨ÅE \›Ú €dÀ¨ À¨ [ï2 HnoFñ –¼?º“–D<Fž{¼Æö¼,Š|<«×F:¥×¨8—Ù$8v¿8pHŽ¸@9‘ºFä9ç»þHµ +

PLEASE NOTE: I assume that the first few characters - "SMSNF100" - have been added by SmartSniff.

Could anyone give me some pointers on how to convert this to human-readable ASCII state data? Am I correct in saying that the UDP packets are binary (I imagine they are)? Or hex? Or...?

Any help greatly appreciated. I just need a bit of advice to get me started!

Cheers,

Prospero
as written in the README.txt

Quote :
Motion Simulator Support : (OutSim)
--------------------------
The user's car in multiplayer or the viewed car in single player or
single player replay can output information to a motion system while
viewed from an internal view.

This is controlled by four lines in the cfg.txt file :

OutSim Mode 0 :0-off 1-driving 2-driving+replay
OutSim Delay 1 :minimum delay between packets (100ths of a sec)
OutSim IP 0.0.0.0 :IP address to send the UDP packet
OutSim Port 0 :IP port
OutSim ID 0 :if not zero, adds an identifier to the packet

Each update sends the following UDP packet :

unsigned int :time in milliseconds (to check order)
Angular Velocity :3 floats
Orientation :3 floats Heading, Pitch, Roll
Acceleration :3 floats X, Y, Z
Velocity :3 floats X, Y, Z
Position :3 ints X, Y, Z (metres x 65536)
Game ID :1 int (optional ID - if specified in cfg.txt)

Note 1 : X and Y axes are on the ground, Z is up.

Note 2 : Motion simulators can be dangerous. The developers of the
Live for Speed racing simulator do not support any motion systems in
particular and cannot accept responsibility for any injuries or death
connected with the use of such machinery.

Yes you are right to think that it is binary data... Viewing in ASCII won't help you much....
Use a hex editor (try google, there a lot freeware) or if you have Visual Studio 6.0 rename the .txt to .dat and open in there to see the byte values.
Quote from GeForz :as written in the README.txt

One sometimes wonders why one bothers to ask... Do you think I haven't read the README?
Prospero - what language are you trying to interface with In/OutSim? What is your longer term goal? If you can give us some more specifics we maybe beable to help me.
Hi Angry Angel,

It's all about learning for me.

Two goals:

1) Initially, to get LFS's OutSim UDP packets displayed in "user-readable ASCII" via some free 3rd party sniffer software. I have never done any TCP/UDP network programming before, so I'm treating this as a good introductory exercise in to it...

2) To recreate the same by writing my own routines from scratch in Visual Basic 6.

Any help (or links to good articles) greatly appreciated!

Prospero
you need to read the packet in binary and put the data into the floats. you cant just dump the packet into a text editor. doesnt work like that
Quote from dUmAsS :you need to read the packet in binary and put the data into the floats. you cant just dump the packet into a text editor. doesnt work like that

OK, here's a question. I understand what you say, but can't one take the ASCII dump and translate it... or... oh god... I am lost. I'm looking to get the 17 numerical values contained within an OutSim UDP packet in ASCII. Surely someone can just tell me what to do???

Oh, and how do I open a .dat file in VB6?

I need someone to set me straight here. I'm sorry if this is very naive.

Please, plain English chaps. Imagine you're trying to explain to a spastic why it's unwise to attempt crossing a motorway at rush hour.

Prospero
no, converting pure data to ascii corrupts it.

do you know how to work with data and binary files? loading floats from files etc?
Quote from dUmAsS :no, converting pure data to ascii corrupts it.

do you know how to work with data and binary files? loading floats from files etc?

Answer: No.

I've never had to parse binary files. So... help?



Prospero
i would recommend how to load up binary files and working with variables before diving into this
You patronizing ****.

Darn, maybe if I spell **** in binary, you'll be able to **** *** ** ** ********* *****.



(Think ....no uncertain terms)...
Quote from Prospero :Answer: No.

I've never had to parse binary files. So... help?



Prospero

How you do it varies from language to language, but the basic concept is that you read data byte by byte and then copy byte ranges into the datatypes it needs to go in.

To illustrate on the actual Outsim packet:

unsigned int :time in milliseconds (to check order)

unsigned int is 4 bytes, so read the first byte then cast that array of bytes to an unsigned int (using typed language lingo. Not sure how you'd do it in untyped languages like VB)

Angular Velocity :3 floats

Each float is 4 bytes, so read the next 4 bytes, cast the array of bytes to a float, repeat twice more

and so on

In C and C# (and probably other languages) you can just create a struct of that matches the packet, then read all entire packet and copy that byte array into the struct, and voila, everything is properly populated
Quote from Prospero :You patronizing ****.

Darn, maybe if I spell **** in binary, you'll be able to **** *** ** ** ********* *****.



(Think ....no uncertain terms)...

well you may think that but from my experiance. if you havnt done the basics you will struggle through the rest
Quote from Prospero :You patronizing ****.

Darn, maybe if I spell **** in binary, you'll be able to **** *** ** ** ********* *****.



(Think ....no uncertain terms)...

Oh dear. No help for you now.
Thats not really the right attitude.
As has been sort of said, I would really recommend writing your VB stuff to interface with In/OutSim, then try and understand it as you go along.

Loading it and attempting to read it all through a hex editor may not been the best way to learn; its all a bit abstract, although you can certainly do it. My favourite hex editor is XVI32 - you may wish to try and open your dump's with that, and see if you get any more luck with your understanding.
Quote from dUmAsS :well you may think that but from my experiance. if you havnt done the basics you will struggle through the rest

I suppose English isn't your first language. Not to worry. We all have our crosses to bear. I hope, for your sake, that your binary's more fluent.

Many thanks to sdether and angry_angel for giving me the info I need. Situation sorted - with great effort

Cheers,

Prospero
Quote from Prospero :I suppose English isn't your first language. Not to worry. We all have our crosses to bear. I hope, for your sake, that your binary's more fluent.

yes lets hope my programming is better then my english. my compiler doesnt like me writing proper sentances in english...

if your trying to get a flame war out of me, or make me cry with those oh so harsh comments, its not going to work
Ah, the god of Trade and Wealth versus Dumass... *Chin*.. Sorry, Prospero, I have my money on Dumass. And yes, he's right, diving in to complex matters when you don't understand the basics is a daft idea, and will only make things harder in the long run.

And no, I don't care if you call me names. I enjoy it, actually. It makes me drool with pleasure. So, please, go ahead.

P.S: If they begin with 'w', 'r' or 'f', they make me really ... Nevermind.
hi guys, i need to make a simulator with LFS and Arduino. The OutGauge works fine on Ethernet, i use this link to make OutGauge

https://github.com/jlinnosa/arduino-lfs-outgauge-monitor,

I'm try to build a library OutSim comparing with OutGauge, but is very dificult to me. I need use only Ethernet card, i don't want use serial.

Can anyone help me ??

Tks
Hello again, i´m try and win. kkkk

i use Arduino, and i can print the values of Sim.


But i have many question below,

int time, ----- is ok to me
Angular Velocity : 3 floats, ----- Where i use it ??
Orientation :3 floats Heading, Pitch, Roll, ----- is ok to me
Acceleration :3 floats X, Y, Z ----- same that accelerometer
Velocity :3 floats X, Y, Z ----- velocity in axes ??
Position :3 ints X, Y, Z (metres x 65536) ----- position of what ?
what the reference ?

Game ID :1 int, ----- is ok to me


Can anyone help me ??, or have a document do read about it ??

TKS
@berdam

In case you didn't know, this thread is 12 years old and I doubt anyone in here will reply. You can try starting your own thread Smile
Also, I don't know much about Arduino.
TKS man. i will make it.

Making sense of OutSim UDP packets
(23 posts, started )
FGED GREDG RDFGDR GSFDG