Dadido3 / D3bot

A very primitive AI for GMod bots designed to work with Jetboom's Zombie Survival gamemode.
38 stars 28 forks source link

Barricade aim for bots #103

Closed LuckyLuke9542 closed 1 year ago

LuckyLuke9542 commented 1 year ago

Anyway to have bots target barricade props while in close proximity? In their current state, they just randomly swing around, hoping to hit the barricade. You can really cheese their system by placing thin props like a door in an archway and they will have a tough time hitting it to the point where some bots even suicide, thinking they are stuck on something. I attached a video demonstrating this.

https://github.com/Dadido3/D3bot/assets/138544955/f81f748d-a8f8-4b69-87b9-b25348b881b4

Dadido3 commented 1 year ago

I just added some code that lets bots attack close by nailed props when they are stuck. This is probably not perfect and opens up other exploits.

The bots will target the center of the prop, which means that props that have no collision hull near their center (Like shelves) can be used to exploit this behavior. Also, i didn't tweak the bots aiming inaccuracy, so it may still miss the prop it is attacking sometimes.

The code is in its own branch, as i don't know if it will break normal gameplay. Download it from here. Once it is more tested, i may move it to the main branch.

Dadido3 commented 1 year ago

70 is related to this issue.

Another solution would be to not change the bot's target, but to just make it rotate towards the closest nailed prop when a bot attacks. This would prevent an exploit where you nail a prop close to the ceiling and the bot would try to attack the prop from the floor above the ceiling...

ghost commented 1 year ago

Yeah, because of this there is a cade known as a "Bot-God Cade" which consists of 1 singular prop for an entire round of ZS, hopefully this can be fully implemented at some point.

LuckyLuke9542 commented 1 year ago

Just tested the same scenario on the new branch. The code does work and it seems it doesn't break normal gameplay. Bots can target barricade props but can still miss them. This can be tweaked as you said. The main issue is bots don't immediately lock onto props, which can lead them to not hit anything, resulting in their suicide shortly after. Here are some clips showing this, including a bot POV.

https://github.com/Dadido3/D3bot/assets/138544955/0ebfd9f7-62e0-4054-bec4-e73bc60c80c5

https://github.com/Dadido3/D3bot/assets/138544955/3fe3fc69-2097-4823-b457-cff67c55ea45

Dadido3 commented 1 year ago

I just pushed a big update to this branch.

If bots are hindered by something and are not able to do any damage, they will actively search for barricade entities. But compared to the previous solution, bots will not change their target.

Which means that now bots don't get distracted by single nailed objects, which was the case before. And they will also try to hit humans if they gete to close. And if there is a way around barricade entities, they will take that instead of trying to fully destroy any entity first.

This also changes and improves a lot of other things, if you find something unexpected, let me know.

Again, you can download the current version of this branch here. Once it's a bit more tested, i'll move it to the main branch.

LuckyLuke9542 commented 1 year ago

Did some testing with the new update and it seems to work really well. I didn't run into any game-breaking bugs with it nor did any errors occur. Although I did find something unexpected. There are certain types of props the bots can't target. These are the ones I found.

"prop_physics_multiplayer" - On some maps, all props are this type. - This is a big one "func_physbox" - These were custom props I found on abandonedmall_v9 . "prop_dynamic" Sometimes bots can target this type, sometimes not.

that's all I found after testing.

Dadido3 commented 1 year ago

Ok, I made the "is barricade prop" check more generic, it should now account for all things that players can use as a barricade object. Including aegis boards.

Dadido3 commented 1 year ago

Ok, i assume everything is working as expected now, so i'll close it.

If there are any problems write them here or open a new issue.