Source-1-Games icon indicating copy to clipboard operation
Source-1-Games copied to clipboard

[TF2] [Feature Request] Add a generic nextbot entity for vscript usage

Open treacherousfiend opened this issue 2 years ago • 2 comments

Right now, the go-to way for vscript programmers to make non-player bots from scratch is to use the base_boss entity, a leftover entity which is used as the baseline for the tank entity in MVM. While this entity does work fine for most uses, It comes with a number of annoying caveats and unwanted behavior. These often can be worked around, but the workarounds often come with caveats of their own, and the workarounds themselves are often long-winded as well as tedious and frustrating to write

It would be super helpful for vscript creators if there was a generic nextbot entity that has no AI or anything like base_boss does, but without some of these caveats. It also lacks some features which could be extremely helpful for vscript coders.

For reference, here's a list of all the caveats and issues I can think of that base_boss comes with, and their workarounds if they have one. due to how long the descriptions and workarounds text is, you will need to click on each issue in order to read it.

Bot disappears and flings MVM money into the air on death

This can be worked around be checking the `npc_hurt` game event, and if the damage would've killed the bot, setting the bots health to above that, and then destroying it manually.

In some cases, this workaround doesn't seem to work, occasionally on pl_spineyard, the mobster skeletons, which use base_boss, will explode into money instead of running their custom vscript code on death. This could be a bug with the vscript on Spineyard specifically, or an unrelated game bug. While maybe not useful for Spineyard, which needs to run its own on-death script to spawn spells from the skeletons, it would be very helpful for other coders. Plus, in my opinion, having the skeletons just die without dropping a spell instead of spontaneously turning into a bunch of pickupable money would be a LOT less confusing to players.

Bot destroys engineer buildings it collides with I'm not sure if this can be worked around aside from maybe disabling collisions altogether. For people who are using the bots to do things like have TF2 player bots that do not take up a player slot, it doesn't particularly make sense for every bot to destroy buildings
Bot forcefully pushes players outside of its bounding box, even with collisions disabled (FIXED AS OF 10/10/24 UPDATE) UPDATE: As of the Scream Fortress 16 update, base_boss now has the function `SetResolvePlayerCollisions()`, which allows this functionality to be disabled

~~This can be worked around by firing the "disable" input to the bot, but that also completely disables the nextbot locomotion system, forcing the coder to have to write their own code for movement (or use a library) instead of using the built-in one.~~

Bot does not set last hitgroup value For snipers, the game checks if the player hit the head hitbox to determine if it was a headshot or not. while `base_boss` has a slot on their datamap _for_ where they were last hit, it never sets this value. This can be worked around by setting up another entity, `generic_actor`, which DOES set these values.

However, generic_actor comes with a whole different set of caveats, it doesn't have nextbot locomotion, things like pyro's flamethrower flames travel right through them, it doesn't send events for damage numbers, etc. The best solution currently is to set up BOTH entities and have them working in tandem, which is tedious, annoying, and wastes edicts for entities.

This could be fixed for base_boss itself by just having it set these values, but it is a shortcoming with base_boss with a less than ideal workaround right now. So I figured I'd add it here as well.

Bot does not have "Eye Angles" This is more of a personal one, but players separate their angles into 2 different values, their angles, which control the model's angles, and their eye angles, which are where the player's crosshair is. The game uses these separately to animate player characters so that they can slightly turn without their feet awkwardly sliding to face where they're looking.

It's a neat feature that to my knowledge, no other entity supports. It can be faked, but doing so can be quite annoying to do, and it would be easier if the entities just supported the value outright.

treacherousfiend avatar Oct 20 '23 02:10 treacherousfiend

Game now exposed CTFBaseBoss::SetResolvePlayerCollisions in VScript to disable the functionality.

OfficerSpy avatar Oct 11 '24 05:10 OfficerSpy

well, thats one thing off the list, I've updated the issue post to reflect that.

treacherousfiend avatar Oct 11 '24 18:10 treacherousfiend