The online racing simulator
Searching in All forums
(17 results)
iamproplayer7
S3 licensed
https://github.com/Iamproplayer7/tsinsim

Various fixes and new features.
Support for 0.7F5 patch InSim.

- Added IS_AII, IS_AIC features.
- Parse Mod name in IS_NPL packet.
- Added IS_PLH pack method.
- Fixed IS_BTN order.
- Fixed IS_BFN missing key.
- Moved IS_PLC into sendable structs and fixed export.
- Fixed IS_MST:Msg value type.
iamproplayer7
S3 licensed
Suggestions will be:
- let select a car for ai with /ai.
- add direction to IS_AII like CompCar struct has.
- add possibility to send multiple PLID with IS_SMALL to request IS_AII packet.

Fixes:
- auto gear box sometimes gear up to high or too low, with message GEAR_DOWN avoided or similar

multiple PLIDs because local InSim gets a bit spammed when you want to control 30 or more AI vehicles.
30 vehicles every 50ms = 600 packets every second. 600 * 8 bytes = 4800 bytes every second.

Appreciate your work take your time. Thanks.
Last edited by iamproplayer7, .
iamproplayer7
S3 licensed
Quote from Scawen :From my point of view it's most likely there could be a bug in your packet reader. For example two packets arriving at once but you only read the first one.

This is a quite fundamental packet so I doubt that it is broken, though I could check tomorrow.

EDIT: I've checked now and I'm getting IS_PLL as expected. I think you should check how many bytes arrived in your TCP read and compare that with the packets you processed. In case a packet is going missing. Packets may arrive more than one in a single read or even be split across multiple reads, which really does happen!

First of all, yes - there is problem in my own script/framework and i'm very sorry that i made you waste so much valuable time of yours to check it up.

I did my investigation, checked my cruise mod and it works as intended, but still it has that problem but it was not visible till now. My framework have global packet listener and local packet listener, and i can bind any entity (like vehicle) to local packet handler, and after spectating that bind function removed wrong local packet handler and there is issue where problems occurs, i lost handler after spectating and made some sort of memory leak. Thanks. We learn from mistakes.
iamproplayer7
S3 licensed
Now i have this issue, using 7F4 (also tried 7F3) as client and InSim Version 9 in my InSim, i rechecked my framework and it works very well and intended as it should. I'm not getting ISP_PLL packet consistely (player spectates), only first time after insim connects and sometime after randomly. https://www.youtube.com/watch?v=jrgYdkmHdI4
Last edited by Scawen, . Reason : removed youtube tags as they slow down the page load
iamproplayer7
S3 licensed
Quote from KingOfIce :I understand the 2 points of view, between the impatience of the update with all...

Bro thats so funny to see Big grin my experience with it
iamproplayer7
S3 licensed
use mass from lfs mods api if its below 500kg is motorcycle i guess
iamproplayer7
S3 licensed
tsinsim updated into INSIM 0.7F
https://github.com/Iamproplayer7/tsinsim

- Added IS_IPB (packet supports array of IP addresses in string format *.*.*.*)
iamproplayer7
S3 licensed
Quote from Flame CZE :I like your idea with including the binary data types in the reflect metadata...

I used ezstruct in jsinsim it was easy to add and simple, but not supported in typescript, tried lfspack at first, but best I think is raw bytes handling. There should be even simpler handling than I did.


Last edited by iamproplayer7, .
iamproplayer7
S3 licensed
Quote from Flame CZE :Did you take inspiration from...

Structure is very similar its simple and easy to understand: enums, types, structs it just stuck in my head, I took idea how decorators work because it looks very useful and easy to use, but as you can see a lot of things my implementation.
iamproplayer7
S3 licensed
Quote from EfsaneTosun :Looks great...

Yes, now you can, I finished my new module named: tsinsim https://github.com/Iamproplayer7/tsinsim,
it's a base InSim module at the time, but I will start to work on bigger framework on this module, with a lot of Functions, Plugins and etc. Let me know if you have some ideas.
iamproplayer7
S3 licensed
Quote from Scawen :Looks like threejs uses vertical FOV, while LFS FOV is horizontal FOV.

The conversion:

3JS fov = 80
half_fov = 40
// now take the tangent so we can convert to horizontal:
tan(half_fov) = 0.8391
// convert this vertical tangent of half_fov to horizontal tangent of half_fov (for 16:9 screen):
(16/9) * tan(half_fov) = 1.491
// convert this to a half_fov using inverse tangent (arctan)
atan((16/9) * tan(half_fov)) = 56.16 degrees
// finally multiply by 2 to get the LFS fov
112.3 degrees

So assuming 16:9 screen:

lfs_fov = 2 * atan( (16/9) * tan(threejs_fov / 2) )

or:

threejs_fov = 2 * atan( (9/16) * tan(lfs_fov / 2) )

Thanks it works as expected!
First time used in JS it gave me invalid output, because i had to convert FOV into rad and result into degrees, and your explanation above really helped me to understand and check if those values are right by doing it in my code.

const threejsFOV = 2 * toDeg(Math.atan((9/16) * Math.tan(toRad(LFSFOV / 2))));

This is how it looks now: https://streamable.com/pucon8
Question about FOV and how it works? (threejs problem)
iamproplayer7
S3 licensed
Hello,
im trying to create my own 3D rendered scene on top of LFS window, for now using IS_CPP packet with tick interval and it seems giving right output that i managed to convert, but i want to know how to make LFS FOV into threejs FOV. Currently in the example i created PerspectiveCamera in threejs with 80 FOV as default. In the video that is below you can see LFS FOV in shift+u view, and it looks 112-113 LFS FOV almost same as threejs FOV (80).




Maybe someone was doing something same as this, manipulating 3D space externally, because i do not have experience with injections into DLL to draw something similiar using LFS itself. Im looking for better ideas, maybe someone already did that before.

Object is moving like this, because framerate is different in game and in scene, but it should stand in right location.
https://streamable.com/h6wesa
InSim: Interface change in mods window
iamproplayer7
S3 licensed
Right now we have IS_CIM packet to show which window is open.

struct IS_CIM // Conn Interface Mode
{
byte Size; // 8
byte Type; // ISP_CIM
byte ReqI; // 0
byte UCID; // connection's unique id (0 = local)

byte Mode; // mode identifier (see below)
byte SubMode; // submode identifier (see below)
byte SelType; // selected object type (see below)
byte Sp3;
};

// Mode identifiers

enum
{
CIM_NORMAL, // 0 - not in a special mode
CIM_OPTIONS, // 1
CIM_HOST_OPTIONS, // 2
CIM_GARAGE, // 3
CIM_CAR_SELECT, // 4
CIM_TRACK_SELECT, // 5
CIM_SHIFTU, // 6 - free view mode
CIM_NUM
};

Improvement will be CIM_MOD_SELECT // 7
We need window at mods selection.
Node.js - jsinsim - InSim library
iamproplayer7
S3 licensed
jsinsim is a InSim library for Live For Speed, written in javascript runtime Node.js.
This library allows you to create socket connection to the game server and share packets trought TCP stream.

Current version is 1.0
Current InSim version is 9

Github
https://github.com/Iamproplayer7/jsinsim


RequirementsRequired dependeciesSource of this project
jsinsim is free to all, you can clone, fork repository and make changes to it. (do whatever you want with this).


Future
I will be very happy if you will use this library and will help to improve it, comment or share your code, create issues threads, write improvement suggestions. This library always will be updated to a newest InSim version.
(this library not giving his full potential, i am talking about OutSim, OutGauge, not every packet for InSim works right now.)


Added Classes
Right now this library have a list of classes that will help you program faster and simplier, don't be scared to use them, those classes will be updated and there will added more functionality to it.Multiple hosts
jsinsim supports connection to one host, two hosts or even 10 hosts. All packets have info about his host, premade classes uses hostName in some functions to make clear which host will be affected.

First code

// import InSim library
const InSim = require('./module/insim');

// init InSim connection
InSim.Server.start({
host: { // host name used only in module
ip: '127.0.0.1', // your host ip
port: 53330, // your host port
admin: 'admin password', // your host admin password
prefix: '!', // command prefix like (-> !command)
pps: 12 // vehicle info update per second (max: 12)
}
}, (hostName) => { // host name defined above
InSim.Server.message(hostName, '^2InSim: Node.js connected.');
});

Examples
jsinsim have a list of examples how to use some classes, this list will be updated.
Github Examples list

Do you have questions?
Find me at discord Vidmantas#9888 if you think you need help in private. If not just let me know in comments and i will help you and answer your questions.
iamproplayer7
S3 licensed
Quote from rockclan :
Call me anything you like, but this is very suspicious in my eyes.
The entire world can't connect to LFS, but this guy is on TC Two? xD

idk why. Just mine udp not going over 100. I see others with red udp and make jokes about them Big grin but for me everything works good.
Last edited by iamproplayer7, .
iamproplayer7
S3 licensed
https://www.lfs.net/files/vehmods/B71D1A?information : https://i.imgur.com/jUodOmO.png
very bugged mod. Why? Because u can set tyre pressure to 0. https://i.imgur.com/r4mwJ0Z.png https://i.imgur.com/goaCmdm.png

When you put 0 pressure u can't even move.

But when you set final drive like this: https://i.imgur.com/fOLvaez.png
Then you press accelerator to full. (it have to reach full speed) Everyone in multiplayer server loses sound and sound appears when u reconnect server. But that's not all. To others players you start to flicker: this is from replay: https://i.imgur.com/0HsLlQ3.gif https://i.imgur.com/3wZZjBy.mp4

I can't send all replay because it's too big.
Last edited by iamproplayer7, .
FGED GREDG RDFGDR GSFDG