x07x08 / TF2-Dodgeball-Modified

A modified version of the original YADB (Yet Another Dodgeball) plugin
GNU General Public License v3.0
19 stars 6 forks source link

Reflected rockets update team but occasionally do not update target #10

Closed MaddyUnderStars closed 1 year ago

MaddyUnderStars commented 1 year ago

I'm unsure if this issue is caused by the tfdb plugin itself, or the bot my server is using, but if I had to guess it seems like the title is somewhat right.

https://github.com/x07x08/TF2-Dodgeball-Modified/assets/46743919/635e621a-0d26-4685-884d-6eca3e4a151f

in the above video, the bug occurs at 0:17 and 0:25.

this causes lots of Fun Situations, such as the below:

https://github.com/x07x08/TF2-Dodgeball-Modified/assets/46743919/50a67e93-b5d6-4608-bdde-02cb30f4f638

this bug only occurs when the bot is set to 'unbeatable', i.e. it's given 'god mode' (the damage is just set to 0) https://github.com/lzardy/tf2db-advancedbot/blob/master/bot.sp#L535-L540

although when giving players godmode (via https://forums.alliedmods.net/showthread.php?p=979550), we weren't able to replicate the issue. granted, this plugin seems to use a different mechanism for disabling damage, so I guess I could just modify the bot to do the same.

when this occurs, players are able to airblast the trapped rockets to free them (although, they will immediately die as the bot reflects them again). there is another rarer case where the rocket team does not update but will still stay locked on the bot, thus preventing players from freeing it.

if it's useful, you can find the server configs at https://github.com/MaddyUnderStars/tfdb

thanks for all the work with the plugin, it's been really fun.

MaddyUnderStars commented 1 year ago

this was indeed an issue with the bot. modifying it to use the same mechanism as the godmode plugin to prevent damage fixed the issue.

MaddyUnderStars commented 1 year ago

nevermind. that only made it less common.

Silorak commented 1 year ago

Hello, is this current version of the plugin? And does the bug only occur when multiple rockets present?

While using nanobot, I haven't seen such behaviour appearing, that is if your are using single rocket or ffa with twenty rockets, however I am not to sure with multi-rockets without ffa usage.

It's possible, that the advanced bots behaviour is causing it to drop the target when there's just to many for it to handle. That's just a speculation.

I only used advanced bot in the past, however due of weird behaviours I had it removed. Such as moving to a one side of the map when deflecting and flying if no floor present. (That appears if the map is not in the hammers center, so the bot tries to use mirroring logic and walks to a corners of the map)

Keep in mind, that plugins code is merged with the other private bot prototypes... Not sure if the oracle bot was put in it, but Walgrims code snippet is there.

Anyways, I hope that x07 takes a look at it. Maybe, he has some ideas.

x07x08 commented 1 year ago

After thorough testing, it seems that the bot's "god mode" (it's actually more like a bounce mode and it cannot be disabled) is the issue. If you try using the /scary command to be invincible the same way the bot is and spawning like 10 rockets, you won't be able to deflect any of the spawn / 0 deflects rockets that have touched you (I only thought of using that command after I had wasted so much time trying to understand why the deflect event wasn't being sent in the first place...).

Explanation For every deflect, the game sends an "object_deflected" event. To make sure everything is fine, a check is done for the current deflector and the previous deflector to see if they're valid players. If this check fails, the event will not be sent. The dodgeball plugin uses that event to count deflects and change the targets accordingly. I assume that the bouncing or the repeated hooking and unhooking breaks the check in some way, but I don't understand exactly how. EDIT : I completely forgot about [this](https://github.com/x07x08/TF2-Dodgeball-Modified/blob/510b010e6d5a517bb07ff52eb6d7871ab1bb1292/TF2Dodgeball/addons/sourcemod/scripting/TF2Dodgeball.sp#L2719) hook which conflicts with the bot's SDKHook_StartTouch hook... The dodgeball plugin assumes the rocket is always going to explode if it touches a client and breaks the previous owner so there would be no points given for the spawn / 0 deflects rocket kill.
Solutions 1. Ignore the rocket if it's at 0 deflects whenever it touches the bot. 2. Make it so there is no collision between the bot (or /scary player) and the rocket (this can be achieved using the [CollisionHook](https://github.com/Adrianilloo/Collisionhook) extension or by changing the collision group)

If I'm wrong and this happens regardless of whether /scary is enabled or not, feel free to re-open the issue (Although if that is the case, I doubt I could fix the problem, since then it would be either SourceMod's or TF2's fault).

MaddyUnderStars commented 1 year ago

Thank you very much for looking into this! I really appreciate it!