The online racing simulator
I'm a begginer. Advices?
(15 posts, started )
I'm a begginer. Advices?
Hi!

I'm kinda new in all of this related with programing. I know c++ and bit of python and I have proposed to do an LFS mod even though that I may never publish it.

It's been days since I started searching for info, libs and open-source already done projects to try to understand how does "modding" work. I'm kinda worried about this becouse I don't understand that much. I do understand the code and how does it worck (in most of the cases) but i can't understand how to use the program. I mean, I dont know how to use it in the game. I know is TCP or UDP related but I don't know how does it works.

Any advice not only with that but also with beginning on this?

Thx Big grin.
Quote from Rexo35 :Hi!

I'm kinda new in all of this related with programing. I know c++ and bit of python and I have proposed to do an LFS mod even though that I may never publish it.

... of the cases) but i can't understand how to use the program. I mean, I dont know how to use it in the game. I know is TCP or UDP related but I don't know how does it works.

Any advice not only with that but also with beginning on this?

Thx Big grin.

Hey.

My suggestion is python and the pyinsim library to get startet. https://github.com/alexmcbride/pyinsim/tree/port-to-python3

If you need any help getting started with it, answer to this post, and ill give u a few examples.

My own program is completely based on that. LFS Thread:
https://www.lfs.net/forum/thread/92775-The-PACT-Driving-Assistant---DOWNLOAD

Oh and if you mean vehicle mods, there is a vehicle editor available for free, though I am not good at using it haha. https://www.lfs.net/downloads
Starting with PyInSim :D
Hi!

I tried to start my project by myself but it's kinda hard xD.

So, for my project I need the positions of the rest of the cars respect to the player's one. Basiclly I need to know the distances betweem the cars in the track.

I've read the "InSim.txt" in the "LFS/docs" folder and I saw that there is an struct called "CompCar" in the lines 1844-1859 that gives you the coordinates of the car you request (at least is what I interpreted).

Is that usable by some way by PyInSim? Or can you get the coordinates of the cars at all in pyinsim?

Thx Smile
Quote from Rexo35 :Hi!



I've read the "InSim.txt" in the "LFS/docs" folder and I saw that there is an struct called "CompCar" in the lines 1844-1859 that gives you the coordinates of the car you request (at least is what I interpreted).

Is that usable by some way by PyInSim? Or can you get the coordinates of the cars at all in pyinsim?


Yes, thats easily accessable with pyinsim. Ever used Python before? Then it should be possible quite easily for you. U good at math with vectors? Then it should be also easy For you to calculate the distance in the coordinate system. Look at insim.py and func.py in the insim library, they will Help you!

If you still need Help, reply on this Threads again.
Hi!

Sorry to bother you again xd. I think it will be better atually to use OutSim instead of InSim. I've been seeing the OutSim info and I saw I can get the player's coordinates, is there any way to get other players coordinates from the server in outsim? i dont think so but i dont lose anything xd.

thx <3
Quote from Rexo35 :Hi!

Sorry to bother you again xd. I think it will be better atually to use OutSim instead of InSim. I've been seeing the OutSim info and I saw I can get the player's coordinates, is there any way to get other players coordinates from the server in outsim? i dont think so but i dont lose anything xd.

thx <3

Well... I have never used outsim. But... It is very very easy to get everyones coordinates with insim...
Lfs sends the compcar Packets in the mci Packets (max 8 players per Packet). If you Then use a simple For Loop, you can get all the Data from all Cars Wink.

Would Look Something Like that in Python:

For Car in mci.info:
PlayerID = Car.PLID
xCoord = Car.X
yCoord = Car.Y
Speed = Car.Speed

etc...
Then you can For example Store the stuff in an Array or dictionary or smth.

I guess thats the easiest way. Does that Help?
It does help, but the problem is that the "mod" (is that the right word?) I'm making is personal, and not to use in my server but in everyones, without having to know the admin password. That's why i've chosen OutSim instead of InSim. Anyways, i will do it first on InSim and then check if it is doable in OutSim.
Quote from Rexo35 :It does help, but the problem is that the "mod" (is that the right word?) I'm making is personal, and not to use in my server but in everyones, without having to know the admin password. That's why i've chosen OutSim instead of InSim. Anyways, i will do it first on InSim and then check if it is doable in OutSim.

I am Not sure If i got you correctly But:

As Long as you want to Use a Program For yourself, you can Use it on all Servers, as you don't manipulate the Game But Just gather Data and process that. Insim hast No limitations there.

Only If you want to do an insim For the entire Server, you will Need to Host one! But as Long as its For you, No Need to worry!
-
(Rexo35) DELETED by Rexo35
Yes, you got me xd. I was wrong.

btw, when i try to use the function "pyinsim.IS_MCI.unpack()", python asks for 2 arguments, but in the definition there is only one argument "data" (also "self", but as far as I know you dont have to give "self" a value xd).

This is my line:
mci = pyinsim.IS_MCI.unpack(data)

thx <3 xd
Quote from Rexo35 :Yes, you got me xd. I was wrong.

btw, when i try to use the function "pyinsim.IS_MCI.unpack()", python asks for 2 arguments, but in the definition there is only one argument "data" (also "self", but as far as I know you dont have to give "self" a value xd).

This is my line:
mci = pyinsim.IS_MCI.unpack(data)

thx <3 xd

Right... So I've been at your point in 2018. Imma just gonna briefly explain to you whats missing there. Don't take this word by word, I am not really a pro, but this works.
I tried to make it as clear as possible with comments in the code. If you are not that comfortable with python yet, maybe sentdex on youtube is helpful there as well (helped me get started a lot):

https://pythonprogramming.net/
https://www.youtube.com/watch?v=eXBD2bB9-RA&list=PLQVvvaa0QuDeAams7fkdcwOGBpGdHpXln
https://www.youtube.com/watch?v=YSe9Tu_iNQQ&list=PLQVvvaa0QuDfju7ADVp5W1GF9jVhjbX-_

In python 3 it would look like that:

see attachment. .py files are not allowed on the forum, so its a .txt Smile
Attached files
main.txt - 2.2 KB - 142 views
that code was more less what i had, i corrected mine a bit and it's now working, thanks Big grin.

No I'm not really comfortable at all with python, but way more than with C++ XD.

About the videos, I'll watch the intermediate level one.

thx <3
ah btw, i remember that I could find somewhere the car lengh and width. Do u know where it is?
You do realize that an OutSim is just one of the packets inside the InSim which is a general term for this entire structure/protocol. So when you say that you will use OutSim instead of InSim it makes no sense.

I do not think that with InSim you can access any other car parameter than what is already contained in the OutSim or OutGauge packets.
Quote from rane_nbg :You do realize that an OutSim is just one of the packets inside the InSim which is a general term for this entire structure/protocol. So when you say that you will use OutSim instead of InSim it makes no sense.

Yes, ik. I meant i wasnt gonna use the whole InSim funcionalitys. Plus, for outsim you need less info and return diferent info than insim.

So that's why i said that, i meant i wasn't gonna use pyinsim.insim(args) but use pyinsim.ousim(args).

Thanks for the clarification as well.
Oh ok, I got what you mean. Yeah, this python library adds another abstraction layer between InSim and your app so they can call the functions inside whatever they like. Naming functions correctly can be a very difficult task Smile

I'm a begginer. Advices?
(15 posts, started )
FGED GREDG RDFGDR GSFDG