Vehicle dirt emitters keep playing when vehicle is stopped

Issue #371 resolved
Andrew Theel created an issue

2015-08-08_00002.jpgSometimes the emitters that play when a vehicle is moving keep playing after it stops.

This seems to be client sided, as I could see the emitter, but Basnett couldn't. I believe this is an added 6.0 bug.

To replicate just drive vehicle and stop until the emitter is still going, it may not ever occur for the vehicle driver, and thus needs to be tested in MP with 2 people.

Comments (9)

  1. Andrew Theel reporter

    The logic for the dust and exhaust is heavily flawed, which is the cause for the issue. I experimented with how to replicate and tried to fix the logic...

    You can replicate this issue by having 2 people. The one drives a vehicle and before coming to a complete stop to exit the vehicle (can also switch spots then exit). The other player will continue to see the dust emitter. My logic "fix" caused more issues, but I didn't try very hard. Matt can you take a look into this?

    Basically something (tick,timer,etc) needs to constantly check if vehicle is moving like tick does, however tick is disabled when driver is not present. Therefore tick is never given a chance to end the emitter correctly. Perhaps a separation of the exhaust and dust will do the trick, but Matt you know much better how all this stuff works.

    This is important to me, simply because it bugs me to see that dust emitter (I'd honestly rather not have any dust emitter than to see it when vehicle is stopped).

  2. Matt Hands

    The fundamental issue is when/where Tick is enabled & disabled. From a look, this is what I think, and it actually appears to be a single, simple cause in a change from RO to DH gameplay, not the emitters system itself being flawed:

    In RO the key events for enabling/disabling Tick are when the player enter/exits the vehicle. When the player exits, the vehicle stops and so does the engine, so Tick can be disabled (no dust or exhaust emitters). It happens in event DrivingStatusChanged(), which gets called on server & clients whenever a player enters or leaves a vehicle.

    DH fundamentally changes this logic, because the engine does not stop on exit. So in DH the key events become engine on/off. If the engine is off we know we don't want exhaust emitters, but the code also brakes the vehicle, so we don't need dust either.

    DH code (from way back) changes where the emitters get enabled or disabled. But it still follows the same logic for enabling/disabling Tick, i.e. on enter or exit, which no longer matches the logic for controlling the emitters. The situation now is exactly the same as 5.1.

    So I think the solution is to re-align the two. Probably moving enable/disable Tick to either SetEngine() or to StartEmitters() & StopEmitters(). Will try it tomorrow morning, or maybe if I get some time later today.

  3. Andrew Theel reporter

    Tick isn't really doing much, I don't see an issue with leaving it on if the engine is on. Thanks.

  4. Matt Hands

    Fixed in commit 98ec0fc.

    Currently Tick is enabled or disabled in DrivingStatusChanged() event, which is called on all net modes when a player enters/exits a vehicle. I thought the main change would be to shift this functionality so the main trigger would be SetEngine() function, called on all net modes when the engine starts/stops.

    But on further investigation, it is still pretty much all about when the driver enters or exits, even though DH has removed the engine on/off functionality from DrivingStatusChanged() and made it so the wheel dust and exhaust emitters are only enabled/disabled when the engine starts/stops.

    If the engine is on, so the exhaust emitter is enabled, but the vehicle has no driver, Tick is not necessary. It sounds like it should be, because of the exhaust, but actually the exhaust emitter gets set to a minimum, idling setting when the engine is turned on in SetEngine(). Tick is not required to update the exhaust unless the vehicle is being driven, so if there isn't a driver we don't need Tick for that.

    And if the engine is off but there is driver, we do need Tick. Mostly because in DH, Tick is necessary to stop a vehicle being driven with the engine off. If we disable Tick, the vehicle can be driven even if the engine is off !

    So why is there this problem? The specific problem is when a driver exits while the vehicle is moving. The vehicle doesn't stop immediately, instead coming to rest naturally over 1 or 2 seconds. During this time, the dust emitter is still enabled and it needs Tick to reduce the effect down to zero as the vehicle comes to a halt.

    The solution? Make it so Tick is only disabled when there is no driver AND when the vehicle has come to a stop. The only relaible way to do this is in Tick itself. So at the end of Tick I've added a simple check on "if (!bDriving && ForwardVel ~= 0.0)", disabling Tick if that is true.

    Tick gets enabled when the driver enters, same as before. Even if the engine is off, we need Tick if we have a driver.

  5. Log in to comment