So I'm currently working on a project where a city full of Civilians (original unit of SC2) is attacked of a lot of zombies. The problem is that when the amount of zombies reaches about 200 lagg starts for not all players but some, while this seemingly is a CPU issue I need the cheapest way for the Ai to work.
**My current system:**
This is based on a Behavior that triggers every 15th second, if the Zombie Is Not Moving and Not in Combat (checked via validators) the unit is issued to use a dummy ability that triggers an event. Inside the trigger the event triggers is where the zombie is issued the order to move with a polar offset towards a random players position.
What the Ai should do:
- Constantly Attack-move towards any of the players position.
**Factors that may cause lagg:**
- The magnitude of issued orders.
- The frequency of the magnitude.
- The Zombie's "Aggro Range" (Weapon Acquisition Range)
- The pathfinding algorithm.
- The distance the pathfinding algorithim calculates.
- The Zombie's Leash Range (how long it will take unitl the zombie loses interest when chasing a target)
Now, I do not have a single idea how to approach this, I need to optimize this to the fullest since my map is to handle around 500 units at most.
I've put some serious amount of time in this project and I really need help, this is so elementarily crucial for my map that if I don't solve it the whole map will faulter - and I many hundres of hours will be of waste.
Your approach seems pretty complex.
Im not quite sure what exactly you want to achieve, but take a look at this example:
zombie becomes idle
Events
Unit - Any Unit Becomes idle
Local Variables
Conditions
(Unit type of (Triggering unit)) == <Zombie>
Actions
Unit - Order (Triggering unit) to ( Move targeting (<your function>) (Replace Existing Orders)
I like the way you have the behavior triggering the zombies new commands.... because the unit actually has to idle for awhile before being issued new commands
other wise the zombies will be constantly searching for players everything they go idle/ or as soon as they reach their destination and there's nothing to attack
I would do it like this
shouldnt really cause any lag..... im thinking what lags is your ai logic stuff
Event
Unit uses Dummy Idle ability
Action
issue order to triggering unit to move attack to postion of random players unit
Dont do any pathing logic or anything.... let the game handle it
- The Zombie's "Aggro Range"(Weapon Acquisition Range)
- The pathfinding algorithm.
- The distance the pathfinding algorithim calculates.
- The Zombie's Leash Range (how long it will take unitl the zombie loses interest when chasing atarget)
You don't need any of that shit
If you want more advanced features speak with me in private I can discuss much better ways to handle picking targets, ignoring targets, picking the closest targets, units leashing back to thier original positions and so on.
To help you regarding your existing logic we would need to actually see those parts of your code. Cause I imagine they are not that efficient.
I've had a really busy week at school but I will try this out as soon as I can, I'll come back to you as soon as I've tested it SouLCarveRR.
While I like the idea of having the unit idling for a while before getting new orders I believe that I will take whatever method that is most efficient.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hello there everyone!
So I'm currently working on a project where a city full of Civilians (original unit of SC2) is attacked of a lot of zombies. The problem is that when the amount of zombies reaches about 200 lagg starts for not all players but some, while this seemingly is a CPU issue I need the cheapest way for the Ai to work.
**My current system:**
This is based on a Behavior that triggers every 15th second, if the Zombie Is Not Moving and Not in Combat (checked via validators) the unit is issued to use a dummy ability that triggers an event. Inside the trigger the event triggers is where the zombie is issued the order to move with a polar offset towards a random players position.
What the Ai should do:
- Constantly Attack-move towards any of the players position.
**Factors that may cause lagg:**
- The magnitude of issued orders.
- The frequency of the magnitude.
- The Zombie's "Aggro Range" (Weapon Acquisition Range)
- The pathfinding algorithm.
- The distance the pathfinding algorithim calculates.
- The Zombie's Leash Range (how long it will take unitl the zombie loses interest when chasing a target)
Now, I do not have a single idea how to approach this, I need to optimize this to the fullest since my map is to handle around 500 units at most.
I've put some serious amount of time in this project and I really need help, this is so elementarily crucial for my map that if I don't solve it the whole map will faulter - and I many hundres of hours will be of waste.
I implore you, please help!
Yours Sincerely, Ice_bane @ EU
Use "Enable/Disable suicide for unit group (idle units)".
So you're saying that idling units sohuld die? That's not a good solution for me if that's what you are implying :)
Thanks for reply in either case.
Your approach seems pretty complex.
Im not quite sure what exactly you want to achieve, but take a look at this example:
zombie becomes idle
Events
Unit - Any Unit Becomes idle
Local Variables
Conditions
(Unit type of (Triggering unit)) == <Zombie>
Actions
Unit - Order (Triggering unit) to ( Move targeting (<your function>) (Replace Existing Orders)
WHAAT, there is an event for unit becomes Idle... Oh god! :D
Thanks a lot that will probably optimize thigns quite a lot!
Sadly enough, it didn't help me very much. I'm all in despair again damnit!
@Ice_bane: Go
I like the way you have the behavior triggering the zombies new commands.... because the unit actually has to idle for awhile before being issued new commands
other wise the zombies will be constantly searching for players everything they go idle/ or as soon as they reach their destination and there's nothing to attack
I would do it like this
shouldnt really cause any lag..... im thinking what lags is your ai logic stuff
Dont do any pathing logic or anything.... let the game handle it
You don't need any of that shit
If you want more advanced features speak with me in private I can discuss much better ways to handle picking targets, ignoring targets, picking the closest targets, units leashing back to thier original positions and so on.
To help you regarding your existing logic we would need to actually see those parts of your code. Cause I imagine they are not that efficient.
@Ice_bane:
If it lags, it doenst have anything to do with the trigger i have posted.
Overall the game will ALWAYS lag with 200+ units no matter what you do.
Make sure you have removed your data stuff properly (the behavior etc).
@Mille25: Go
It should not lag with just 200 units....
I could make 500 zombies hunt players with no lagg pretty damn sure... Maybe Ill make a test case example just for shits and giggles.
Thanks a lot for the replies!
I've had a really busy week at school but I will try this out as soon as I can, I'll come back to you as soon as I've tested it SouLCarveRR.
While I like the idea of having the unit idling for a while before getting new orders I believe that I will take whatever method that is most efficient.