January 17, 2020
HFFWS Generation System
Fixing Pulley Scenario Foundation
Pulley Scenario Issues
Not Producing Designated Number of Scenarios
This was working before, so it was weird that the issue came up for all three pulley options after updating, including the original scenario I worked on, HeavyDoor. I found that the wheel positioning method was getting an array index error, so I focused around there.
Instances where just one wheel needed to be created seemed to actually work fine, so there was something about creating multiple wheels that was causing an issue. I looked into what was happening after the first wheel was created, and there is a method dealing with the list of weighted ranges that can remove a range without adding any new ones after choosing a position (this option exists for when a chosen position is within the buffer range on both sides of it to other taken positions, or ends).
It would make sense that we get an indexing error if we started with one range (which it always does), but then because of the chosen parameters, removed that single range from the list. This appeared to exactly be the case. The generated ropes weren’t long enough, so choosing a single position with the given buffer ranges was effectively taking up the whole rope, so there were no valid positions left, giving an error and ending the cycle of generating scenarios.
As a quick fix just to continue testing, I simply changed the parameters to only give longer ropes and this removed the error completely. To at least help notify the user of this problem in the future, I added a Debug.LogError if the range list is empty but the system tries to find a new position. This will be something I will need to come back to later to increase the intelligence of the system to so that it itself modifies either the length of the rope to fit the chosen number of wheels, or reduces the number of wheel options depending on the rope size (most likely the latter choice).