-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
[IMPROVEMENT] Manual Attack Optimization #94
Comments
I did something similar, but I grouped the infected every 32 distances, then sorted them, and finally did tracing. Apparently your method is simpler and faster.
my edit: edit.zip |
Thanks guys, give me some time to test it. |
Hey guys, i updated the /out version with this change but i made a little change to it. I removed minDist because i think in some cases it would have caused issues. Also, @MutinCholer can you add me on steam? |
In #76, the problem with performance came down to the
foreach
loop calling the trace line function more often than it should even with other statements preceding it. While I initially suggested that the trace line function should be called only once, it turns out that it can cause the survivor bots to occasionally not shoot the common infected if the visible one is farther away than the closer one that cannot be seen as you have pointed out in the previous issue.My new proposal would be to add all common infected to a local array and then sort all of the entities in the array from the closest to farthest distance before the trace line checks are performed in another
foreach
loop. This allows the next closest common infected to be targeted instead of ignoring the closer one that cannot be seen.From my testing, the performance improvements can be quite massive when dealing with a lot of common infected at once. This is most noticeable in some custom campaigns that spawn way more common infected than necessary (especially in Glubtastic 3's train chapter).
Here are two videos showcasing the difference in performance using two different methods when faced with 200 common infected.
https://github.com/smilz0/Left4Bots/assets/64824187/01aac2f6-1f6d-47a9-b809-c8a88c0ff21a
^Old Method (Trace line in one
foreach
loop)https://github.com/smilz0/Left4Bots/assets/64824187/d56156b4-a643-4a00-a955-daa31f9663de
^Proposed Method (Trace line in ordered
foreach
loop)And here is the ZIP file containing the
left4bots_afterload.nut
file if you would like to take a look at it.Manual Attack Optimization.zip
The text was updated successfully, but these errors were encountered: