Closed Kiskadee-dev closed 1 year ago
Placing vehicles near huge buildings is a problem since the distances are calculated from the center of the object, could calculate the intersection of bounding boxes or check the distance of the nearest corner but these bounding boxes are innacurate and might filter out whole cities... so, big buildings are prone to explosions if there are no free roads near (Don't place 30 vehicles in the same road and it's ok).
Did some brief testing, I'm consistently getting an undefined variable error for _avoidanceDistance in ALiVE_fnc_findFilteredSafePos.
I noticed 1 case of a helicopter (garrisoned, engine off) spawning underground. I also noticed 2 vehicles (2 vehicles of a 3-vehicle group) that had spawned inside eachother leading to a demonic possession esque event.
Repro is just putting down ALiVE required, Virtual AI System (debug on), Military placement (civ obj) with force size 400 for BLU_F, Military placement (mil obj) with force size 400 for BLU_F on Altis
@DavisBrown723 I've made a change today to make the functions private, aside from a few mistakes you noticed (the error spam), this led to some erratic behaviour like vehicles spawning inside each other..
I'll mark this as WIP until a priest arrive and help me solve these shenanigans
tl; dr -> 3b0cb8b0e170328dc2804cdf79e78f43469f942a is broken as i'm a potato
Please can I have a status update on this. Is it in a state where it can be merged?
Should be ok, tested with this mission
Thank you. I will test it asap.
I'm finally getting happy about how the spawning is turning out, I'm testing with massive motorised and mechanized units on Fallujah and Stratis, managed to reduce the number of explosions to a minimal.
I've kept the priority of spawn on roads, as the default were, and added a new heuristic search of safe positions for when there's no available road near, which is quite slow in crowded areas, although it seems ok. (Commonly you'll have wide clean spaces where vehicles can spawn and then it's quick.. the worst case scenario would be trying to spawn an army of trucks inside a forest, that would make it give up and spawn in the default position, also would be painfully slow.
The heuristic is just BIS_fnc_findSafeArea extended to allow for filtering static and dynamic objects...
I've also fixed the groups of vehicles as there was a problem with the way
fnc_profileVehicle
andfnc_profileGetGoodSpawnPosition
communicate, the later currently sets the good position into the profile, which gets outdated as soon as the leader spawn, now they'll be treated as single vehicles once spawning, then will calculate the next safe position one after the other limited by distance so they don't get very far apart.In my opinion
fnc_profileGetGoodSpawnPosition
should only return a new good spawn position for an individual thing, not actively set for a group, as it doesn't spawn them.This is a WIP as i'm deciding what to do with static weapons, they do seem ok as they were, but i've got to filter them as the code is updating their direction, and I also must disable the debug messages.
(I've noticed an oopsie mine where after the spawned vehicle is set, the profile stays at the old position until it moves, gotta fix that, or leave like that as it would act as an anchor for the new position so they don't travel very far away by just despawning and respawning)
Also the bridges seem to be fixed, vehicles should spawn at the road segment section position.
Testing will be appreciated :)