Sparks Replay FixIntroductionAfter, getting the wheels and suspensions of bikes to work in replays I set out to get sparks in replays. One of the two reasons why grinds in SA are so much lamer is that there are no sparks to show the friction of the body of the vehicle with the rail or ledge. The other being of course that grinds lose speed very quickly when FL is turned off.
Getting the sparks to work has been a real challenge. Once I got something to work something else would pop-up and would require twice as much work as needed before. In short these are the following bugs features I needed to implement. First of all the camera matrix did not update properly when using the replay system. This caused the sparks to always be flying towards the camera that was still at the position of the player outside of the replay. In SA sparks are dependent on the position of the camera and this is why they move when you rotate the camera.
Secondly, collision had been turned off when replays are playing. Collision detection is used to determine whether two objects are touching. Sparks are created inside this collision procedure, but only when certain speed limits are passed and some flags are enabled. This was understandable as enabling it causes all types of problems. When enabling it collision forces will still be applied when a collision is detected and because the replay system will update the position of the player every frame, this would give all sorts of weird interactions. After a lot of trial and error I was able to get it into a reasonably stable state. I hope the player does not go flying off in random locations anymore.
The sparks are only enabled for the player vehicle, when the player is riding it. I had to do it this way because of the aforementioned reasons.
All in all, I think I got it in a pretty decent state. It has taken many days and long nights of frantic disassembly scrolling and dealing with ASM bugs, and frankly I don't wish to work on this anymore.
ResultsHere you can see the results on some simple grinds I landed with the script.
https://www.youtube.com/watch?v=aFSE0QgbUmkCompatibility and BugsThe replays generated when using this fix are able to be played when the fix is not active. It would look exactly the same as before. It should work with replays not landed with this fix. No data is read from the replay in order to get the sparks and therefore any old replay will do.
With cars there can still be quite some bugs and it can appear unstable. In general it seems to work okay, but the collisions around cars and their wheels are more finicky.
For some down-hill rails no sparks are created and during RADs there aren't as many sparks as in game. I am not sure if I can fix this problem. It may happen that the game does not detect any collisions, there is not much I can do about this.
I have not tested if it is compatible with freeplay or other .asi scripts but I foresee no problems there.
DownloadYou can download it
hereInstructionsPut the .asi script in the GAME_FOLDER/scripts folder and use your favourite .asi loader to load it. I recommend Silent's which you can find
here.
DisclaimerI am not responsible for any corrupt replays if you choose to use this fix.
ThanksThanks people on the GTAS discord for their support along the way. I hope you can appreciate this work.