Rommel 2 Posted December 2, 2009 (edited) Description: Kills about 67% of AI related lag issues for the server. Eliminates up to 95% of AI related lag issues for the player (on a dedicated server). How? It removes all AI outside of specified ranges, and dependant on the players position, will spawn / de-spawn the AI groups when the player enters their radius. For example; The mission editor has defined the Reducer to have a range of 800m to spawn, and 1000m to de-spawn. If the player enters within 800m of any AI groups position, it will 'fill' the group with its original number of AI, re-filling vehicle crew positions. If the player then moves away and the distance between player and AI groups position is above 1000m, it will remove the AI again, leaving them with only drivers for their vehicles and their group leader. This does not work perfectly for AI placed in specific positions (ie within buildings), it is designed for mission editors who want to put well over 500 enemy on the map, anywhere, without worrying about potential lag issues. So it is perfect for roaming patrols, convoys, AI defending towns (but not static) etc. Example mission provided. Contents (mission folder): init.sqf mission.sqm scripts\init_Reducer.sqf fsm\Reducer.fsm RMM_Core Usage: To use the reducer, simply place down an object (I've used a Game Logic - Location, which is best due to its server locality and synchronisations) and put the following in the initialisation line: _h = [this, <Spawn range>, <De-spawn range>, <Debug mode>] execVM "scripts\init_Reducer.sqf" Optimum values lie in between 700-900 for the spawn range, and 800-1000 for the de-spawn range. If the de-spawn range is lower than the spawn range, it will reverse the values. The debug mode will enable the mission editor to see when groups are filled or reduced. Then synchronise any groups you wish to enable for the reducer to handle, with the game logic. (Shown in example mission) To use default values, simply use the following code in the game logic: _h = this execVM "scripts\init_Reducer.sqf" To add groups to the reducer during the mission, simply add the group to the RMM_Reducer_Groups array. Ie [RMM_Reducer_Groups, <GROUP>] call BIS_fnc_arrayPush; Dependencies: RMM_Core Functions BIS Functions Module Installation: Simple installation; copy and paste the fsm and scripts folder (and its contents) into your mission directory. Ensure the BIS Functions module is placed in your mission. Ensure RMM_Core is loaded correctly. Compatibility Issues: If any groups are killed whilst not spawned, they will remain with a count of 0 and are viable for deletion, therefore a group cleaner may kill groups that are simply waiting to be spawned. To get around this simply use the following code in your cleaner: if (!isnil "RMM_Reducer_Groups") then { _groupsToCheck = allGroups - (RMM_Reducer_Groups + RMM_Reducer_ReducedGroups); } else { This is only important for mission makers whom are using a group cleaner (uncommon amongst low level missions). Bug Report: If you find anything, just post here or send me an email: admin@australianarmedforces.org ... or forever hold your peace. Author: Rommel Date: 02/12/2009 (thats 12/02/2009 for the yanks) Revision: 1 ------------- DOWNLOAD ------------- Size: 7KB Type: 7zip | .7z Unpacker: www.7-zip.org Mirrors: http://www.4shared.com/file/163887890/aa3cbcad/RMM_ReducerChernarus.html Edited September 11, 2013 by Rommel Share this post Link to post Share on other sites
vmaclan 10 Posted December 2, 2009 Wow if this is anything like I think it is this will prove very useful in placing AI in missions. So if you place a group in the editor and then play a mission that group of AI gets "minimised" till the player gets in range and saves CPU time? Share this post Link to post Share on other sites
Rommel 2 Posted December 2, 2009 That in a nut shell sums it up correctly. Ensure a member of that group (to be reduced) is synchronised with the placed game logic. Refer to the example mission if you're not sure. Share this post Link to post Share on other sites
VanhA-ICON 11 Posted December 3, 2009 Holy shit Rommel, this sounds just the ticket for one of my missions (Fall of Czernobog). It's got hundreds and hundreds of troops defending the town. Since one of the objectives is to take over the town (When more friendly units present) does this affect it? I mean the shot groups will remain gone and not respawning? Share this post Link to post Share on other sites
Rommel 2 Posted December 3, 2009 Yes, it does not re spawn groups, it just caches them with their exact status from when you saw them last. They are player activated, so ensure you don't rely on AI to spawn them. The proximity is the range around the player(s), if you need an AI group to duke it out with an AI group somewhere on the map where a player isn't present (why? Well you never know) then don't add them to the reducer (ie don't sync them). Share this post Link to post Share on other sites
mcvittees 0 Posted April 7, 2010 This sounds dead mega. Will defo give this a go! Share this post Link to post Share on other sites
Leovelli 10 Posted April 8, 2010 The potential for this is astounding, hundreds of AI and no lag. Will definitely give this a go and report back. Good work mate. Share this post Link to post Share on other sites
manzilla 1 Posted April 8, 2010 (edited) Can you even test this? I get a dead link. The page says the DL isn't valid no more. It does sound cool though. Edited April 8, 2010 by Manzilla Share this post Link to post Share on other sites
Rommel 2 Posted April 9, 2010 I believe you can get it on ArmAholic, if you can't, relax, I'll be putting out a new version with my ACE 2 mission framework (soon). Share this post Link to post Share on other sites
Guest Posted April 9, 2010 For those of you who cant find it (unbelievable :p ) RMM Reducer Share this post Link to post Share on other sites
manzilla 1 Posted April 9, 2010 Ahhhh silly me, I did use this before. Found the example mission on my PC. Share this post Link to post Share on other sites
Skelt 10 Posted May 29, 2010 Armaholic link is down =/ sux exactly what I've been looking for, seems like it's better then my trigger method. Could someone just post the code? Thanks. Share this post Link to post Share on other sites
Rommel 2 Posted May 30, 2010 I am still working on this among other things, a new feature called the freezer, the alternative to the reducer, it deletes units completely and then restores them when you come near. This reduces load by 100% thanks to the new BIS beta patch. Having 2500 units on the map (in terms of logical presence) with 60FPS is fantastic. The new release will be soon, and in highly modular, it will be released as an addon, but I may make mission variants for simple plug and play. ;) Using both the reducer, and freezer is the best combination, reducer for roaming groups (such as whole map patrols), and the freezer for all other groups (which do not need to move as dynamically, ie defenders, town patrols etc). Share this post Link to post Share on other sites
groshnak 1 Posted March 15, 2013 (edited) Bringing this up to point out a possible error in the script, this is still the best script i have found for this purpose because i cant find the other versions that use gamelogics or other even more efficient methods for whole groups. Something that could be used for static enemies carefully positioned in towers would be cool too, something that saves that units position exactly and returns it there, maybe this script could be adopted to save units position x,y,z while it saves its weapons etc too, and to setpos it back there when it returns that units weapons..? Anyway, to the error. It gives this: Error in expression <CER) %1 Deleted --- time : %2", _group, _time];[_message, 3] call RMM_f_PrintF;> Error position: <_time]; [_message, 3] call RMM_f_PrintF;> Error Undefined variable in expression: _time And i think its this line here after "Delete_Group": "_message = format [""(RMM_REDUCER) %1 Deleted --- time : %2"", _group, _time];" \n" And it really is undefined, only _timewait is defined but everything else in the script uses "time" which doesnt need to be defined and changing it to "time" seemed to fix the error but i have no idea what im doing so im not sure. Just a headsup for anyone using the script :) Also UPSMON think the reduced/filled units are dead, propably because they dont have the same id when they fill, guess theres no way around this but not to use "react to dead bodies" in upsmon. Edit: I just noticed this script actually hurts performance compared to just using an array trigger to disable simulation of units in an area :( Edited March 15, 2013 by Groshnak Share this post Link to post Share on other sites