-
Notifications
You must be signed in to change notification settings - Fork 148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SearchNearby Endless Loop #1544 #1545
SearchNearby Endless Loop #1544 #1545
Conversation
Proposed PR for issue #1544 |
Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com>
Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com>
Co-authored-by: Jouni Järvinen <rautamiekka@users.noreply.github.com>
Why?
Should not be a hard coded string in a local variable, but a QGVAR, i.e. QGVAR(SearchTimeout) Not sure about using |
// Create limiters for each unit | ||
private _timeout = (count(_positions) * 15) min 120; | ||
private _timetag = "CBASearchTime"; | ||
{_x setVariable [_timetag,time]} forEach units _group; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not below use getVariable default instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The units would eventually skip every building as the start time would never be updated. Perhaps the variable name is confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps QGVAR(StartSearchTime) would make more sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in aa63e9a
addons/ai/fnc_searchNearby.sqf
Outdated
if (_positions isEqualTo []) exitWith {}; | ||
if (unitReady _x) then { | ||
if (unitReady _x || {_starttime + _timeout < time}) then { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If lazy eval is used here, may as well inline the whole local variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As such?
if (unitReady _x || {(_x getVariable _timetag) + _timeout < time}) then {...}
Timeout should probably be a function parameter instead. Then it is opt in (default it would be off to keep the current behaviour), and tweakable. I would not make it dependent on group size at all. |
Co-authored-by: commy2 <commy-2@gmx.de>
This is not dependent on group size but is dependent on the number of positions in the chosen building. Unit timeouts are evaluated the same whether there are 2 or 100.
|
Regarding parameterizing the function, I agree and propose the following parameters: _timeoutcoef
|
…o skip timeout evaluation.
@commy2 - I need to test that latest commit some more. Please review and let me know if it resolves any of your concerns (especially the opt-out). |
I'm closing this PR for now. The more I dig into this, the more I see more opportunities for these units to get stuck. Another example in fnc_searchNearby.sqf
Once again, if the units are never ready, this "regroup" waypoint will never complete. I will open a new PR once I have a more comprehensive solution. @commy2 brings up a good point that this should be parameterized as to not change existing functionality, so I will keep that in mind. It is unfortunate so much reliance is put on the AI sim working as intended (especially since it's virtually impossible to account for every scenario). |
When merged this pull request will: