PDA

View Full Version : Hpw to disable AI to save processing power?



NGagedFX
Nov 22 2010, 23:52
I've build a FOB and placed a lot of other stuff around Shapur, and it shows 60 fps. I place all the enemy AI that's needed for my mission, and I drop down to 20 fps. I don't want to use spawn-scripts since you're not able to accurately position units that way. I want to pre-place units in the editor, but have them inactive until someone comes in at 2km range. They should then be enabled and fight back, and when a player leaves that area, they should become absent/inactive/disabled or whatever to save processing power.

I hope I explain it clear. Does anyone know of this is possible or even know how to do that? It should be MP compatible and any help is GREATLY appreciated, since this has been bothering me since my very first mission.

Das Attorney
Nov 23 2010, 02:05
There is a way to accurately position spawned units.

Go into your mission.sqm and find the enemy units. It should look something like this:


side="EAST";
class Vehicles
{
items=5;
class Item0
{
position[]={12095.668,158.97591,12705.023};
azimut=174.959;
id=52;
side="EAST";
vehicle="RU_Soldier";
skill=0.2;
};

Then add the script commands


_unitname setVehicleInit "";
processInitCommands;

to your spawned units script file.

The using setPos, you can add the exact position (and setDir for direction if you like) into the setVehicleInit field. For the above unit, it looks like this:


_unitname setVehicleInit "this setPos [12095.668, 158.97591, 12705.023]; this setDir 174.959; doStop this; this allowFleeing 0; this unitSetPos 'MIDDLE'";
processInitCommands;

(I added in doStop, setFleeing and unitSetPos to make the unit crouch and stay stationary, with no chance of running off. It is free to turn on its axis however). You can leave these out or do whatever you want; just like putting code into the init field of a editor placed unit.

Granted, it is more fiddly for setting up large numbers of troops, but possible (if exact positioning is crucial to your mission). I'm not convinced that writing a script to check for distance between every player and every enemy unit repeatedly would save any processing power at all.

NGagedFX
Nov 23 2010, 18:16
Thanks for you reply.

It looks like a pain in the ass though. Having to do it that way is feels like going back to the Stone Age... It's like searching for wood and other stuff to make a fire while it's to damn obvious to use lighters. I know the ArmA Editor is kinda outdated, but no way that BIS did it that way.

It would be far more logical, to place a unit in the editor, have it's ''Presence Condition'' false, and use a script/trigger command to set this condition to true in order to 'spawn' something. :mad:

It doesn't matter if the AI is visible, as long as your CPU hasn't got be bussy calculating the AI's 'brains'. :)

sowens
Nov 23 2010, 20:02
Look into this mission located HERE (http://forums.bistudio.com/showthread.php?t=106584) It dynamically spawns troops, vehicles and static guns on top of roofs. I have adapted it for use in my missions as the majority of my AI with just a few static spots for AI in key areas with various amounts of troops. Works like a charm.

Zonekiller
Nov 27 2010, 00:42
also have a look at this one , everything is created on the fly
http://forums.bistudio.com/forumdisplay.php?f=86

VIPER[CWW]
Nov 27 2010, 01:42
thats just links to a list of threads zonekiller. that sowens mission is pretty good, nothing placed in the editor though cept the starting players

Demonized
Dec 2 2010, 22:39
I've build a FOB and placed a lot of other stuff around Shapur, and it shows 60 fps. I place all the enemy AI that's needed for my mission, and I drop down to 20 fps. I don't want to use spawn-scripts since you're not able to accurately position units that way. I want to pre-place units in the editor, but have them inactive until someone comes in at 2km range. They should then be enabled and fight back, and when a player leaves that area, they should become absent/inactive/disabled or whatever to save processing power.

I hope I explain it clear. Does anyone know of this is possible or even know how to do that? It should be MP compatible and any help is GREATLY appreciated, since this has been bothering me since my very first mission.

Look at this one, basically you place all your squads as normal in your editor, then when game starts it will save all units down to only 1 member and when player within any range you specify it will spawn full group back on leader, i myself use them to spawn in at 2500 from player when playing infantery role, you can ofcourse set it to less or more.

http://www.armaholic.com/page.php?id=10102&highlight=CACHE+UNITS