Sibolo 10 Posted March 1, 2012 I'm trying to improve my mission optimization knowledge by studying other well known missions like the Valhalla (from Dao.nu) or the AAS series especially for large player count games. I am focusing on how the code is structured through the mission when you need to launch several scripts that will be running for the entire game. The way this is done in those missions is that all the scripts are sqf files that are precompiled at game start and stored into functions. Then you have a main thread (big loop) that calls (or spawns) those functions in sequence throughout the whole game. Something like: _a =precompile a.sqf; _b =precompile b.sqf; _c =precompile c.sqf; ... //Main thread while {true} do { call _a; call _b; call _c; ... }; Opposed to this style of mission creation, often you find simply calling the scripts in sequence, and each script is an infinite loop. Something like: _a= execvm "a.sqf"; _b= execvm "b.sqf"; _c= execvm "c.sqf"; ... where each script contains its loop: while {true} do { blah; blah; blah; ... }; I would like to discuss the pros and cons of these two styles and how important it is in terms of difference in mission performance. Thank you. Share this post Link to post Share on other sites
riouken 15 Posted March 1, 2012 The general rule that I stick by and I have seen others say this as well is, if your going to run it more than twice, then you should pre-compile it and call it as a function. A call from memory is always faster and more rescource efficient than reading a file.(As long as you have enough memory to hold your data and still have some overhead). But scripts will always be on the low priority for server performance due to the scheduler in-game.http://wiki.ace-mod.net/wagn/Breaking_out_of_the_scheduled_scripting_prison There for most of your gains to mission performance are going to come from, Amount and skill level of AI, Number of objects on the map and thier proximity to each other,if these objects are moving then this complicates it even further do to the increase of net traffic. Then you have to worry about how much data you are sending out with things like publicVariable and RE. You will find much better gains in misson performance if you can optimize these areas vs scripting. Share this post Link to post Share on other sites