No announcement yet.

AI Reducer or other AI load reduction methods - pitfalls?

  • Filter
  • Time
  • Show
Clear All
new posts

  • AI Reducer or other AI load reduction methods - pitfalls?

    I'm planning on making a large, long co-op on Duala. 50-odd slots plus the amount of AI needed to ensure everyone has something to shoot at sounds like it might cause server load problems, so I might have to use either Rommel's AI Reducer, which I saw used in Op. Swagger, or dynamic spawning.

    I'm worried about possible "thrashing" with Rommel's AI Reducer, as there will be air assets (probably an A-10) in this mission, and I'm imagining a big circle around the plane constantly loading and freezing AI which seems like it might cause problems - also, the pilot might not be able to target armor if it's beyond the Reducer range which makes sense for infantry. There's also the question of what is a good Reducer range for Duala, as it seems there's a number of places you might have engagements over more than a kilometer.

    Mike's Fall of Saigon also made me think about just dynamically spawning a certain town's garrison only when the players are supposed to attack it - though, since they have air assets, they might go poking their nose in those towns before I spawn the AI in. Not a big loss, but it could look strange. Also, the fact that the units aren't in the editor makes triggering guard positions, responding to triggers and so on a bit hard...

    Being on Duala, I can try to railroad everyone towards certain objectives, but there's no real way of knowing what the commander might decide to do first, especially with such a large force - unless, say, I "force" it by placing a note in the briefing.

    Does anyone have any suggestions? This won't necessarily be the next mission I release, as I'll probably have to learn several new things in the course of creating it, but I'd like to know what approach would give me the less headaches.

  • #2
    Re: AI Reducer or other AI load reduction methods - pitfalls?

    Smart triggers are first and foremost the best way to reduce server load.

    Step one is to synchronize each waypoint of a squad to a trigger that activates under two conditions: BLUFOR proximity and detected by BLUFOR. This means cycles are saved when players are outside of the engagement range, but whenever the AI detect targets they activate to engage them, even if it's outside of the trigger's proximity setting.

    Step two is to set a deactivation timer on the trigger. This is a safety in case a BLUFOR player activates a unit but does not engage/destroy that unit, usually an aircraft.

    A number I seem to have in my head says that pathfinding accounts for about 85% of an individual AI's stress on the CPU. Even if that number were as low as 15%, multiplied by however many units you intend on having it's no small number. Even low-population missions could stand to be improved by the intelligent use of triggers!


    • #3
      Re: AI Reducer or other AI load reduction methods - pitfalls?

      AI management should seriously be considered for a Mission Making class. Correct me wrong if I'm wrong, but you could have TON's of AI in a mission but knowing when to actually have them live in a given time during a mission is key! Knowing when to realistically have units live during a mission is key to improving the dynamics of a mission. Letting loose 100's of AI all at once during a mission is suicide to the server, but providing means of activating them depending on the mission could mean that 10% of them are active and yet still create a great experience.

      In your case cctoide in worrying about how a commander will tackle your mission, using AI activation triggers still offers them a challenge. Let's say you designed it to have the commander take approach A. He think's nope, I assume that the defenses would be too much so he takes approach B. You could in return just place a few enemy pockets that activate upon BLUFOR presence and now you've added a new aspect for the commander.

      I think this idea of triggering AI in key locations could prevent commanders exploiting a mission and sometimes completely going around the mission builders intent. This tool could become very powerful and you could possibly see a revolution in how mission's are built. You could even make a mission "smart" where it detects if a mission commander is using armor. If he/she is using armor, then you can set it so the objective has plenty of Anti-tank and armor. If the commander decides not to, then you can limit the armor presence at a given objective. This kind of thinking can really produce great missions instead of throwing all kinds of crap into a mission and not really thinking of why you put that in the mission.

      Spartan 4


      • #4
        Re: AI Reducer or other AI load reduction methods - pitfalls?

        Thanks for the input. The smart triggers sound quite useful. I assume it is possible to combine it with BLUFOR-sensitive dynamic AI spawns as there is a synchronizeWaypointTrigger command, even if it that might be a bit tedious... though I suppose if it's getting spawned because BLUFOR is in the area there's a good chance they're going to meet at some point.

        I'm open to collaborating with other missionmaker(s) on this, by the way, as I'm planning on adding a few extra gameplay elements and polishing it to the best of my ability.


        • #5
          Re: AI Reducer or other AI load reduction methods - pitfalls?

          Essentially one can have an unlimited amount of AI in a mission. It all depends on smart AI management (as described a lot above), and garbage collection (i.e. removing corpses once you reach a threshold). The larger the mission, the more important garbage collection gets. Especially if the mission supports JIP, since without garbage collection there'll be a TON of data to syncronize to the JIP client.


          • #6
            Re: AI Reducer or other AI load reduction methods - pitfalls?

            In Swagger I had a big open area to fill with enemies(up to about 400 in total if you choose AI level "Insane" from parameters), so I decided to employ a three-fold system for reducing the load:
            • Rommel's reducer, which you already mentioned
            • Spawning more AI to "reinforce" the editor-placed units in an area coming under attack. This is detected via scripting, not triggers. There's a couple of "bases" on the map which have different patrol areas assigned to them, and as the patrol areas come under attack their respective bases start sending in reinforcements. Certain units types like air-units can be excluded from detection if necessary. These are groups of AI, can be anything from infantry to air although just infantry and a bit of motorized inf is used in Swagger, automatically spawned from config and given either a patrol or defend task in their area. Sort of a poor-mans Ambient Combat Manager, with the benefit of enemies not just appearing but actually moving into the area. The system is of my own work and took a while to code, but now requires a sub-5 min set up for practically any kind of missions.
            • Body removal

            By far the most effective of these is not having the AI there at all. If it's not there it doesn't use ANY resources. Rommel's script also seems pretty good. It reduces each group to just one guy, the groupleader, so all their waypoints with their synchronizations etc. still stand while the load is reduced to a fraction of what it was. Body removal is just "extra", nice to have but I'm not sure how big of an effect it really has. You are entirely right about Rommel's script being affected by air units, although it shouldn't be a big problem as even the modified version does it's checks every 2 seconds without much of an FPS hit, but that's the problem with any system. An A10 covers huge distances in seconds, so whatever system you decide to use the air units is going to be acticating stuff beforehand unless it's excluded from acticating stuff.


            • #7
              Re: AI Reducer or other AI load reduction methods - pitfalls?

              I've more or less decided what I'm going to do and a similar three-fold approach, plus "smart triggers", will hopefully be enough to keep it running smoothly.

              Fincuan, I noticed over at OFPEC you said you modified the reducer to handle large player counts - as my mission is going to have an even higher maximum player count than Swagger, is it okay if I use your modified FSM? Properly credited, of course.


              • #8
                Re: AI Reducer or other AI load reduction methods - pitfalls?

                Sure, go ahead. The newest one is in both Swagger v3 and 4, so if you have either one you have the FSM.


                • #9
                  Re: AI Reducer or other AI load reduction methods - pitfalls?

                  I will have a new version of the reducer soon, aiming at breaking the desync caused by sudden spawn/de-spawn (ie a delay was introduced to spread the bandwidth load).

                  It has tonnes of other fixes too.

                  As mentioned above, the reducer helps a LOT. But the key thing to remember, is load is based on the amount of groups. ~75 infantry in individual groups is as bad as 25 groups with 10 AI in each.

                  Spawning AI groups is a great method, then add them dynamically to the reducer after they are activated.

                  For example:
                  NEWgroup = [POSITION, SIDE, COUNT] call BIS_fnc_SpawnGroup;
                  rmm_sys_reducer_groups set [count rmm_sys_reducer_groups, NEWgroup];
                  Done :).




                  TeamSpeak 3 Server


                  Twitter Feed