Yup, that’s the type of ticket that gets (ret)titled when it slowly but surely remains in the product over a few development cycles (sorry HR).
The bug in question is this….
in case you missed it….
As in the beautiful world of procedural programming, tweaking variables to create harmony is the challenge. It’s a balancing act and in some cases we get unintended outcomes… comical at the very least 🙂
For this one we space the spawned movable vehicles by the amount of vehicles in that specific lane. Low and behold the spacing equation was using the wrong variable to do it! The fix is to spread out the vehicles along the lane (vehicleNumber/totalVehicles * laneWidth) as well as proper casting to float, which renders the output to less discrete numbers (the game lives in a small world, give me a break! -.-).
A little note on procedural code, it is sometimes good to add safeguards instead of looking for the impossible right variable constant balance…. For example, another fix for this bug would be to do box intersection detection and space hot and bothered tractors apart (after all, when coding, we needn’t have emotions!!!!!! xP). Of course this solution is more costly than the equation, but leave it in the toolbox to keep good code churn momentum.