武装突袭3

武装突袭3

Freestyles Crash Landing
Leopard20 2020 年 9 月 18 日 上午 3:45
Performance Improvements
Hi. Thanks for this useful mod!

If you don't mind, I'd like to share some tips to improve the performance of your mod. There were a couple of issues I noticed at first glance:

1. You always execVM or call compile your code, which is a bit slow (especially compile preprocessFileLineNumbers, which is really, really slow).

I recommend that you define these codes as functions and use the functions instead:
https://community.bistudio.com/wiki/Arma_3_Functions_Library#Adding_a_Function

so Instead of:
[] execVM "someFile.sqf" [] call compile preprocessFileLineNumbers "somefile.sqf"
You can write:
[] spawn TAG_fnc_someFnc [] call TAG_fnc_someFnc

This can improve the performance a lot.

2. At the end of your FCL_effects.sqf file, I recommend using waitUntil instead:
waitUntil {!(alive _veh and (((getPos _veh) # 2) > 2))};

3. Instead of something like: private _veh = param[0]; write:
params ["_veh"];
It does the exact same thing and it is shorter.

I hope it helps.

Regards
最后由 Leopard20 编辑于; 2020 年 9 月 18 日 下午 3:27
< >
正在显示第 1 - 13 条,共 13 条留言
Freestyle_Build  [开发者] 2020 年 9 月 18 日 上午 5:24 
Thank you very much for your suggestions! I will look into improving my code in the next days.
I never thought that much about the performance... Thanks for reminding me!
Brazzer 2020 年 9 月 21 日 上午 1:30 
Hello,
nice mod! I would like to contribute by suggesting some more code optimization:

Since you're using CBA, you can filter out unwanted classes from your XEH. Moreover, I would switch to a "initPost" XEH in the case there are other "HandleDamage" kind EHs applied somewhere (because only the last one returns the damage to apply).

class Extended_InitPost_EventHandlers { class Air { class FSCL_customDamage { init = "(_this select 0) addEventHandler ["HandleDamage", {call FSCL_fnc_handleDamage})]"; exclude[] = {"ParachuteBase", "CruiseMissile1"}; }; }; };

This should work and prevent parachutes to show your custom effects. Please note that the form "addEventHandler ["type", {call myFunction}]" is faster than "addEventHandler ["type", {all my code here}]" and that I assume you implemented functions as suggested above (an alternative could be building your mod by following a CBA template so that your functions would be compiled at their manner).

Going on, when you set your "state" variable you should make its value public by setting the third parameter of setVariable as true (or again with CBA by using CBA_fnc_setVarNet). At the moment you set the variable where the aircraft is local and if there is a pilot change your variable would not exist for the new pilot causing the aircraft to potentially take more damage than the set treshold!

Lastly, you should set a default value when you use getVariable (private _state = _unit getVariable ["FSCL_state", 0];) and you should NOT remoteExec call or spawn since they could be blocked by battleye filters. Instead remoteExec a function (remoteExec is already scheduled when calling for functions, so suspension is allowed as for spawn).

Please consider adding your mod to github even if small in code amount :)

thank you!
最后由 Brazzer 编辑于; 2020 年 9 月 21 日 上午 1:36
Freestyle_Build  [开发者] 2020 年 9 月 21 日 上午 3:36 
@Brazzer, thank you for your sugestions! I will definetely look into optimising my code. Also I will upload the source code to github in the next days and publish the link here and in the mods description.
Freestyle_Build  [开发者] 2020 年 9 月 21 日 上午 11:18 
@Brazzer, here is the link to the mods GitHub[github.com]
Brazzer 2020 年 9 月 22 日 上午 2:24 
I made a pull request, please have a look at github :) I also sent you a friendship request
Freestyle_Build  [开发者] 2020 年 9 月 22 日 上午 3:08 
@Brazzer, thank you! It look really cool, I am already readign the documentation and trying out hemmt!
Freestyle_Build  [开发者] 2020 年 9 月 22 日 上午 3:56 
@Brazzer, when after building the addon using hemmt, which works fine, I got an error while launching arma:
'x\fscl\addons\main\functions\script_component.hpp' not found.
I fixed it by copying the script_component.hpp file into the functions folder. However I still receive an error about a misisng file called "XEH_preStart.sqf"
Brazzer 2020 年 9 月 22 日 上午 5:36 
that's my fault, let me fix it
Brazzer 2020 年 9 月 22 日 上午 5:41 
made a pull request, if you prefer, we can continue with private messages, anyway XEH_preStart is needed for function caching. Solved.
Freestyle_Build  [开发者] 2020 年 9 月 22 日 上午 6:04 
@Brazzer, I will look into it later, I changed some things myself already. There were some minor errors in the scripts (like < and > being swapped) which I changed already, as well as defining the settings inside the XEH_preInit.sqf file. I will push thoses changes tomorow, when I am sure everything works. Additionally I plan on creating a dev branch a GitHub, so that potential problems can be addressed before pushing it to the main/release branch
Brazzer 2020 年 9 月 22 日 上午 11:15 
seems legit to me :) thank you for considering my help. Have a nice day :)
VedKay 2020 年 10 月 15 日 上午 1:53 
I bloody enjoyed reading this.. Love this community, good on ya fellas! :steamhappy:
jjhhytt 2020 年 10 月 16 日 上午 9:47 
excellent feedback
< >
正在显示第 1 - 13 条,共 13 条留言
每页显示数: 1530 50