Jump to content
Sign in to follow this  
logitrust

To many units/AI's on the map. Scripting solution?

Recommended Posts

Hi! I have searched through the forum and other simular sites for a critical problem in a mission we are making for a newly started public server. The meaning here is more a hybrid between Domination and Warfare as we all know well. I am quite fresh in terms of scripting, and have chosen to use good functioning scripts from different people out there when my knowledge stops, all good so far :pray:. The idea is more like a ''warfare game'' without pvp. Style of play is in other words coop(dom.)(AI's spread throughout the hole map) with different missions on the way.

Used some time to placing multiple AI's/groups in editor, with and without waypoints around over the map based on different missions, but now I need a spawn function who can solve my BIG headache this days, with other words lag and bugs when game is running on the server.. I've tried several scripts, and even decreased the number of AI's, but have not achieved usable stability. When playing the mission with 3 players, it takes about 5 mins to get up the action menu(change view dist. grass details etc.) hehe :D .

The one i use now, but unfortunately does not solve the problem is the

"Cached Units with Vehicle Support script"

http://www.armaholic.com/page.php?id=10103&highlight=CACHED

Understand here that I have have to mutch stuff / Enemy AI's spread out on the map course(Chernarus). I think its about 800 units over the hole map when using a counter. But this should not be a problem i think :confused: Is there something(script/trigger's/code) to solve my problem out there? Server running an i7 960 @ 4,0Ghz, so there should be more than enough cpu power anyway.

Appreciate your input in advance!

Cheers

Edited by Logitrust

Share this post


Link to post
Share on other sites

Hi Logitrust,

Im not expert for this, but im sure 800 units are much to much for all kind of PC. May be pentagon has appropriate one :).

compute 800x AI, 800x shadows/ light effects ... i think its to much.

So i think you should create most of enemy units when player/playerside is

reaching a "trigger defined area".

for example: you could share the hole map with... 4 or 8 trigger. in trigger where no one of player side is present , you could delete all AI/units.

I all trigger where playerside is present, you could create unts with or without waypoints.

Edited by davincy81

Share this post


Link to post
Share on other sites

800 is a lot even for a leet CPU like yours. Try more like 300-400 and even then I'm not 100% sure it'll work well. Remember AI only use 1 thread/core so the fact your i7 has 4 cores doesn't really help the situation (though having it at 4GHz and the sheer fact it's an i7 should, if it was a more "normal" server I'd say to even reduce to ~200 enemies).

Also, moving enemies require a lot more, and enemies in combat require even more, especially if it's in an area with enterable buildings. At least it seems to work like that based on my experience.

Share this post


Link to post
Share on other sites

Couldn't you take a game engine style approach and have a trigger spawning them when you or other players are within range via scripts.

Normally sandbox games will have an area around the player that the peds will spawn within to give the feeling of life going on in the game world, with ARMA 2 it would be a similar method.

Say a town ,Rasman,for example has a trigger radius that you find acceptable for civilians etc appearing within that will reduce or negate visible pop in altogether.

Then just have the trigger check if yourself or another player is with the radius and have it trigger the RasmanCivSpawn.sqf.

Then have it destroy those civilians when no one is within that area for a set time, to prevent loading and reloading needlessly when players are on the borderline of the area.

Then keep any story driven characters separately from the spawn scripts to keep them active and avoid having to create variable registries to store their stats, positions etc. Although that can be done so you can remove their AI when not in use as well. Not sure where the system load would be more appropriately used between keeping them alive and storing a lot of variables would cross over though.

This would reduce load times as well because all the AI wouldn't be kicking off right at the start but coming in dribs and drabs instead.

Again if every character you create is an individual with a name(RPG style) you could have a variable checking if they are alive etc to prevent them spawning if they have been killed, same for their vehicles etc.

Of course multiple players could easily break it as well by splitting up and having someone go individually to each town. But you can have checks to either prevent spawns once the max AI is already reached or even separate spawn scripts depending on amount of players in area, or lots of triggers within a town to split the spawns up some more etc.

Sorry for no actual script code as I am new to ARMA mission editing but not scripting, but that is the logic I would take about your situation to reduce the AI load.

I might give this a go myself now as it has given me something to think about.

Edited by Liquidpinky

Share this post


Link to post
Share on other sites

If some of these AI are on bases and things you can despawn them as you drive away as well as spawning AI enemies as you get nearer to them

Share this post


Link to post
Share on other sites

Thanks for quick answer here guys :)

@ Liquidpinky

I agree with you, have thought about exactly what you mention here as a possibility. And with this im sitting now at the moment and try to merge a script in to my mission that i think might solve the problem. I have almost zero knowledge of scripting, but begins to see connections to a certain understanding of what things in script's & coding are doing. When, what and where :P

Chek this out. Trigged areas is the way to go here i think.

http://forums.bistudio.com/showthread.php?t=84854

@davincy81

trigger defined area is the way to go. agree

Edited by Logitrust

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×