Hello everybody, ive been playing LFS for quite some time now and in the past 6 months have involved myself in learning how the Lapper really works and looking at its source code. Over that period of time i came to two conclusions that probably many of you have:
1. The lapper doesnt provide real angle of the car as a variable, but rather AngleVelocity
2. The drift point calculation is based entirely on speed and angle.
3. There was no event that could give the user real-time data.
So after about a week of setting up my programming environment and looking through the source code of LFSLapper 6.0 curtecy of Gai-Luron, I have come up with this:
Othern than the obvious visual menus and Drift Meter i have changed a couple of things on the back end.
1. I made the absolute angle be an available variable for use in the .lpr files
2. Modified the drift calculation allowing the player for possible chaning of drifts and raising their multiplier. (I will give more details further down on how it works)
3. I have added a "OnDrive" event which is being called withing the UpdateState method of the infoPlayer.cs file (meaning it gets called 10 times a second)
4. Added a best drift feature which tracks down the single best drift done by any driver and displays it for all players on their personal drift meters
Drift System Details:
Ok so wat ive done with the drift calculation is this. The basic formula for calculating the drift points in a drifttick is still the same:
points = anglee * speed *speed/10000
However i have added an additional variable which begins to increment if the players angle goes out of the drift range(sort of like a timer). I use it to create a time gap in which a new drift can be started and added to the previous one creating a chained drift. Furthermore by chaining drifts for each additional one the multiplier goes up by 0.1. If no new drift is started in the time gap, then the total sum of all the drifts in the current combo is multiplied by the current multiplier and added to the total score. Some limitations i have implemented so far to avoid cheating and absurd scores in the 500k range, are the following. The multiplier has a max value of 2.0 otherwise clever players would continue chaining drifts for a whole lap getting a x50 multiplier and blowing up their score like crazy. Also the time gap between drifts is 1.2seconds long however in the first 0.2seconds you can not start a new drift, giving the player a 1 second gap after the initial 0.2seconds to start a new drift. This is done to eliminated the case of people doing quick slides from side to side getting their multiplier very high and basically cheating the system.
There are still some imperfections with the system i am working on fixing up, as well as making it a bit more compatible with the Racing components of the Lapper, since its not very friendly with the pitboard and the OnDrive event isnt called all the time but only when drifting. Let me know wat you think and if you have any additions you might want to see made.
1. The lapper doesnt provide real angle of the car as a variable, but rather AngleVelocity
2. The drift point calculation is based entirely on speed and angle.
3. There was no event that could give the user real-time data.
So after about a week of setting up my programming environment and looking through the source code of LFSLapper 6.0 curtecy of Gai-Luron, I have come up with this:
Othern than the obvious visual menus and Drift Meter i have changed a couple of things on the back end.
1. I made the absolute angle be an available variable for use in the .lpr files
2. Modified the drift calculation allowing the player for possible chaning of drifts and raising their multiplier. (I will give more details further down on how it works)
3. I have added a "OnDrive" event which is being called withing the UpdateState method of the infoPlayer.cs file (meaning it gets called 10 times a second)
4. Added a best drift feature which tracks down the single best drift done by any driver and displays it for all players on their personal drift meters
Drift System Details:
Ok so wat ive done with the drift calculation is this. The basic formula for calculating the drift points in a drifttick is still the same:
points = anglee * speed *speed/10000
However i have added an additional variable which begins to increment if the players angle goes out of the drift range(sort of like a timer). I use it to create a time gap in which a new drift can be started and added to the previous one creating a chained drift. Furthermore by chaining drifts for each additional one the multiplier goes up by 0.1. If no new drift is started in the time gap, then the total sum of all the drifts in the current combo is multiplied by the current multiplier and added to the total score. Some limitations i have implemented so far to avoid cheating and absurd scores in the 500k range, are the following. The multiplier has a max value of 2.0 otherwise clever players would continue chaining drifts for a whole lap getting a x50 multiplier and blowing up their score like crazy. Also the time gap between drifts is 1.2seconds long however in the first 0.2seconds you can not start a new drift, giving the player a 1 second gap after the initial 0.2seconds to start a new drift. This is done to eliminated the case of people doing quick slides from side to side getting their multiplier very high and basically cheating the system.
There are still some imperfections with the system i am working on fixing up, as well as making it a bit more compatible with the Racing components of the Lapper, since its not very friendly with the pitboard and the OnDrive event isnt called all the time but only when drifting. Let me know wat you think and if you have any additions you might want to see made.