sp-tarkov / server

University of Illinois/NCSA Open Source License
16 stars 4 forks source link

Investigate possibility of choosing PMC specific spawn points for bot waves that have type `sptBear` or `sptUsec` #718

Open refringe opened 2 days ago

refringe commented 2 days ago

Would be a modules patch


Originally written by chomp

refringe commented 2 days ago

I did some looking into this and have a very nascent debug patch with a method I thought might work: f129eb6749

I'm caling the SpawnSystem's SelectSpawnPoint method to produce a player spawn point with the wave info that gets passed to ActivateBotsByWave. The current logic does produce an ISpawnPoint.

I need to sit down and do more looking into the spawn system to get any further. Going to keep looking into these next:


Originally written by Spoony

refringe commented 2 days ago

Rather frustrating BotsController has two ActivateBotsByWave methods with one param called wave :D

I'll put GClass1463 on the list of classes to be remapped


Originally written by chomp

refringe commented 2 days ago

Looked further into this: the SpawnSystem is probably not the most elegant way to pull spawn points mid round because the list of players it holds is not expected to change and game state after round start is (probably obviously, in hindsight) not considered.

I think my next tack will be to pull the PMC spawns from the location data and write a helper class or function that identifies spawns a suitable distance away from the player and then selects n of them at random.


Originally written by Spoony

refringe commented 2 days ago

I had some more time to work on this further.

The updated WIP patch in 1a4ffda39d spawns PMC AI waves at PMC spawn locations. I've commented where it still needs work, but I also need to actually test it on locations other than Factory. Will follow-up.


Originally written by Spoony

refringe commented 2 days ago

Two thoughts.

1: Is it possible to allow some config that only spawns max number of PMCs possible at the start of the raid? Perhaps as a boss wave using this idea?

2: Could this be adapted to spawn the Player Scav at Scav locations instead of PMC spawns like how it currently works?

Really great work!


Originally written by PhantomInTime

refringe commented 2 days ago

1: That's a good callout. I'll look at the other patches to see if there's a good way to expose configs for this. In terms of letting only n PMCs onto the map at a time, my hunch is that we could accomplish that through a custom BotZone that has a different MaxPersonsOnPatrol equal to the location's player count. I need to trace that logic through to see how it's used and updated when bots die.

2: It'll probably a new patch, but I could defintely extend the spawn helper class to generate player scav spawn points as well.

Also, thank you!


Originally written by Spoony

refringe commented 2 days ago

Hey Spoony, thanks for this work, it's quite interesting!

Something I noticed related for corePointId - I've found that I've been able to use the AICorePointHolder class to get a corePointId given a Vector3 position, i.e.:

                var closestBotZone = botSpawnerClass.GetClosestZone(spawnPosition, out float dist);
                var closestCorePoint = CorePointFinder.GetClosest(spawnPosition);
                botCacheElement.AddPosition(spawnPosition, closestCorePoint.Id);

(botCacheElement is GClass588 here)

however, I have 0 idea on what affect corePointId has on spawn points, especially since this is a new object in 3.8. I'd love to help on any investigating work on this on this param specifically for AddPosition.

your commit for ref: https://dev.sp-tarkov.com/Spoony/Modules/src/commit/1a4ffda39da47049017d78120c7316d1541d3bdf/project/Aki.Custom/Patches/PMCBotSpawnLocationPatch.cs#L86-L88


Originally written by nooky

refringe commented 2 days ago

Hi, nooky. In my testing, I noticed that providing a null (which I started with: all of the PMC spawn points I saw had a null CorePointId in the spawn data) or invalid CorePointId resulted in NREs when a bot group hearing method was called. It seemed like this hearing method was tied to bot activation. The behavior I witnessed was spawned-in PMC bots that didn't move and didn't react to shooting.

With a CorePointId of 1, I had PMC bots spawning in at every point in factory_day that activated correctly.

That method looks promising though. It might be enough to just call that on the selected spawn point.

I should finally have some more time to look at this again over the weekend so I'll update if I find anything.


Originally written by Spoony

refringe commented 2 days ago

Do we want to do this? Mandates using something like Questing Bots to get pmc bots to anywhere worthwhile on the map. Think this is only feasible if there are also changes to how the AI behaves as a whole which is more mod realm.


Originally written by Shibdib

refringe commented 2 days ago

We should ensure the patch calls into server to check if functionality should be enabled/disabled


Originally written by chomp