1. Trouble with the game?
    Try the troubleshooter!

    Dismiss Notice
  2. Issues with the game?
    Check the Known Issues list before reporting!

    Dismiss Notice
  3. Before reporting issues or bugs, please check the up-to-date Bug Reporting Thread for the current version.
    0.37 Bug Reporting thread
    Solutions and more information may already be available.

Distorted rims on replay.

Discussion in 'Troubleshooting: Bugs, Questions and Support' started by ryankd2331988, Dec 15, 2022.

  1. Driveline Animations

    Driveline Animations
    Expand Collapse

    Joined:
    Sep 25, 2020
    Messages:
    162
    Stenyak started going down a surprisingly massive rabbit hole, realized he probably should be working on arguably more important stuff, and that's the last we've heard. I'm still having the issue, though I noticed it happening much less now. Maybe my laptop just likes me better now...
     
  2. stenyak

    stenyak
    Expand Collapse
    Programmer
    BeamNG Team

    Joined:
    Aug 6, 2012
    Messages:
    2,068
    Yep ^, until I can clone myself a bunch of times, this issue is going to have to wait I'm afraid.
     
    • Like Like x 1
  3. stenyak

    stenyak
    Expand Collapse
    Programmer
    BeamNG Team

    Joined:
    Aug 6, 2012
    Messages:
    2,068
    I had time to give it another go. I've found one culprit that triggers wheel corruption, and it will be fixed for v0.28 :)

    It's possible that more culprits exist (other than the one I found), but that they are not manifesting in all our testing so far. So if you see more similar issues after v0.28 update is made public, please let me know.
     
    • Like Like x 7
  4. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,541
    I'm curious what could possibly be causing a bug like this, is it some internal game engine thing or something with rendering?
     
  5. stenyak

    stenyak
    Expand Collapse
    Programmer
    BeamNG Team

    Joined:
    Aug 6, 2012
    Messages:
    2,068
    This was an issue with determinism on consecutive executions of the exact same code. Due to security concerns in modern computing, some aspects can vary from one run to another, sometimes even intentionally as part of anti-hacking countermeasures. This is sometimes done by the language interpreter itself (LuaJIT in our case), with or without additional measures done by the OS (Windows), etc. In this particular case, this is directly related to the hashing that is used internally by Lua in their implementation of tables.

    This lack of guaranteed ordering is often fine, because the order does not affect the final result. But sometimes the order does have an impact. BTW the lack of consistent ordering does not mean it will be varying 100% of the times. It only means that maybe it'll be ordered every time, maybe 99% of the times, maybe 1% of the times, maybe never. You just can't know. It could run just fine in a million computers, but affect this one particular user only. This is why the issue flew under the radar for very long, happening only to some people in certain situations, and to make things worse, it happens in a way that visually resembles a replay that is opened after a conflicting mod is installed or uninstalled. Luckily, with the help of all your reports, I could notice a trend that didn't fit any usual explanation.

    You might wonder, why not make all the code run deteministically, have it behave the same every single time? While this is technically possible to do (I temporarily converted our entire codebase like that, as part of my investigation), it has severe performance implications. Guaranteed determinism will lead to a big increase in stutter and spikes, and also reduced framerate. So I had tofind the needle in haystack, which happened to be in the vehicle spawner code, in the order of wheels and wheel nodes. And it's possible there could be other needles that do not show up in our testing after my fix, but might appear for someone out there in the community. We will see after the update is out.
     
    • Like Like x 6
  6. Agent_Y

    Agent_Y
    Expand Collapse
    Jbeam/QA support
    BeamNG Team

    Joined:
    Jul 10, 2020
    Messages:
    10,541
    Well this is definitely way complex than expected and I barely understand it lol. I thought it was a mistake in the game code but it was actually a side effect of an intentional feature in Lua that probably nobody ever expected to have such effect when first coding it lol. Reminds me of a saying that there is no way to write perfect code without bugs because even if you follow all rules and standards you will sooner or later run into an issue caused by a bug in a compiler or even the operation system that nobody was even aware of. Expect in this case it's even weirder because it was not even a bug but an intentional feature with a rare side effect. Big respect for managing to find something like this, like you said it's like a needle in a haystack when you don't even know where to look.
     
  7. stenyak

    stenyak
    Expand Collapse
    Programmer
    BeamNG Team

    Joined:
    Aug 6, 2012
    Messages:
    2,068
    Oh it was a mistake in our own game code for sure. It was just a tricky one that can be hard to reproduce, and would only be trivial to avoid by deciding we don't care about performance anymore (which is acceptable in other contexts, but definitely not in a game engine).
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice