Lou Montana/Sandbox – User
Lou Montana (talk | contribs) m (Add See Also) |
Lou Montana (talk | contribs) m (Multiple fixes) |
||
Line 4: | Line 4: | ||
This article will try to be a general guide about improving your '''mission's''' performance.<br> | This article will try to be a general guide about improving your '''mission's''' performance.<br> | ||
As usual, moderation is the key; do not expect to find | As usual, moderation is the key; do not expect to find a magical solution that makes it possible to run thousands of AI at 144 FPS on this page. Everything comes at a cost, the tweaks on this page will simply allow you to calibrate your mission properly. | ||
Line 43: | Line 43: | ||
== Performance impact table == | == Performance impact table == | ||
{{Informative| | |||
{{colorball|red|1.125}} means a heavy impact on performance<br /> | |||
{{colorball|orange|1.125}} means an average impact<br /> | |||
{{colorball|green|1.125}} means little to no performance impact. | |||
}} | |||
{|class="bikitable" | {|class="bikitable" | ||
Line 52: | Line 57: | ||
|- | |- | ||
| | | | ||
==== AI | ==== AI unit quantity ==== | ||
| {{colorball|red}} | | {{colorball|red}} | ||
| {{colorball|green}} | | {{colorball|green}} | ||
Line 58: | Line 63: | ||
| | | | ||
* Use [[createAgent|Agents]] whenever possible | * Use [[createAgent|Agents]] whenever possible | ||
* The more units there | * The more units there are, the more network updates there will be - hence the impact on both CPU and network. | ||
* If a client has a low-end machine, they shouldn't lead a group of many AIs as these would then be locally computed. | * If a client has a low-end machine, they shouldn't lead a group of many AIs as these would then be locally computed. | ||
* [[Arma 3 Dynamic Simulation]] allows you to freeze AI that are distant from players. Many distance settings should be set according to the mission. | * [[Arma 3 Dynamic Simulation]] allows you to freeze AI that are distant from players. Many distance settings should be set according to the mission. | ||
Line 65: | Line 70: | ||
|- | |- | ||
| | | | ||
==== | ==== Object quantity ==== | ||
| {{colorball|orange}} | | {{colorball|orange}} | ||
| {{colorball|orange}} | | {{colorball|orange}} | ||
| {{colorball|orange}} | | {{colorball|orange}} | ||
| The less objects, the more FPS you will have. | | The less objects, the more FPS you will have. | ||
* Lower the mission | * Lower the quantity of objects in the mission, such as: | ||
** AI units, agents | ** AI units, agents | ||
** vehicles, simple objects | ** vehicles, simple objects | ||
Line 84: | Line 89: | ||
** {{arma2}}'s [[Garbage Collector]] | ** {{arma2}}'s [[Garbage Collector]] | ||
** {{tkoh}}'s [[BIS_fnc_GC]] | ** {{tkoh}}'s [[BIS_fnc_GC]] | ||
{{ Informative | | {{ Informative | Only the ''on-screen'' objects will strongly impact GPU. }} | ||
|- | |- | ||
| | | | ||
Line 92: | Line 97: | ||
| {{colorball|green}} | | {{colorball|green}} | ||
| | | | ||
Checking a condition too often is usually a source of poor performance. Does your code execution need to be frame-perfect, or can you afford a delay of | Checking a condition too often is usually a source of poor performance. Does your code execution need to be frame-perfect, or can you afford a delay of a few seconds? | ||
* A [[while]]-loop checking without a minimum loop-[[sleep]] time is usually a sign of bad conception.<code>[[while]] { [[true]] } {{codecomment|// already "bad" if you don't know what you are doing}}<br>[[while]] { [[alive]] [[player]] } {{codecomment|// better}}<br>[[while]] { [[sleep]] 1 ; [[alive]] [[player]] } {{codecomment|// perfect}}</code> | * A [[while]]-loop checking without a minimum loop-[[sleep]] time is usually a sign of bad conception.<code>[[while]] { [[true]] } {{codecomment|// already "bad" if you don't know what you are doing}}<br>[[while]] { [[alive]] [[player]] } {{codecomment|// better}}<br>[[while]] { [[sleep]] 1 ; [[alive]] [[player]] } {{codecomment|// perfect}}</code> | ||
* [[trigger|Triggers]] check their set condition '''every 0.5 second''' (hardcoded value). If a large area is covered or condition code is too complex, this can | * [[trigger|Triggers]] check their set condition '''every 0.5 second''' (hardcoded value). If a large area is covered or condition code is too complex, this can become an issue; the triggers should then be converted to scripts if possible. | ||
* [[trigger|Triggers]] can be made '''Server-Side only'''. | |||
|- | |- | ||
| | | | ||
Line 104: | Line 110: | ||
* Use [[publicVariable]] wisely; for specific cases, consider [[publicVariableServer]] / [[publicVariableClient]] | * Use [[publicVariable]] wisely; for specific cases, consider [[publicVariableServer]] / [[publicVariableClient]] | ||
* Creating [[createUnit|units]]/[[createVehicle|vehicles]] globally implies a network synchronisation, keep them to a minimum / at one-point in the mission. | * Creating [[createUnit|units]]/[[createVehicle|vehicles]] globally implies a network synchronisation, keep them to a minimum / at one-point in the mission. | ||
* | * Keep [[:Category:Commands with global effects|global effect]] commands to a minimum: e.g a [[setPos]] will synchronise the unit position to every client, a good practice is to use these commands punctually. If you need a frequent "set position" you may want to look at [[attachTo]] depending on your usage. | ||
* Lower client's [[viewDistance|view distance]] in order to lessen its object position update requests | * Lower client's [[viewDistance|view distance]] in order to lessen its object position update requests | ||
|} | |} | ||
Line 114: | Line 120: | ||
== What else? == | == What else? == | ||
If you have applied all these recommendations and your mission still doesn't run well in multiplayer (but does in singleplayer), | |||
it might be caused by '''mods''' that you are running which could be badly, or not at all, optimised. | |||
If you want to be sure, run the same mission with and without mods. If you have a big difference in performance, look no further. | If you want to be sure, run the same mission with and without mods. If you have a big difference in performance, look no further. |
Revision as of 16:19, 29 June 2019
Introduction
This article will try to be a general guide about improving your mission's performance.
As usual, moderation is the key; do not expect to find a magical solution that makes it possible to run thousands of AI at 144 FPS on this page. Everything comes at a cost, the tweaks on this page will simply allow you to calibrate your mission properly.
Before anything
Before optimising anything, make sure you do not have any performance issue running the game itself:
- Open the editor, place a unit in the area you like and test your computer.
- Arma 3 displays FPS when you go into video options
- Steam allows you to display FPS in a screen corner, in Settings > In game > FPS Counter
- Use (unofficial) Performance Guides to get better performances:
- Play your mission in singleplayer. If your mission runs fine, its network messages might very well be the issue. See Multiplayer Scripting for good practice tips.
- Usual bottlenecks:
- Lower your graphical settings (resolution, textures). If you get way better performances, at least your GPU limits you.
- If the game keeps having low FPS when running @ 1024×768/low textures then your CPU is most likely the issue. Mission scripts may be performance-hogging too.
Creating your mission
- Be sure to create your scripts with the latest available commands and functions.
- In Arma 3 use remoteExec / remoteExecCall and DITCH BIS_fnc_MP FOR GOOD! See Arma 3 Remote Execution for more information.
- In Arma 2 network communication is done using the Multiplayer framework.
- Use the available frameworks and functions for each topic, unless you replace them by third-party ones:
Performance impact table
Topic | CPU | GPU | Net- work |
Solution |
---|---|---|---|---|
AI unit quantity |
Template:colorball | Template:colorball | Template:colorball |
|
Object quantity |
Template:colorball | Template:colorball | Template:colorball | The less objects, the more FPS you will have.
|
High-frequency scripts |
Template:colorball | Template:colorball | Template:colorball |
Checking a condition too often is usually a source of poor performance. Does your code execution need to be frame-perfect, or can you afford a delay of a few seconds?
|
High-frequency network messages |
Template:colorball | Template:colorball | Template:colorball |
|
What else?
If you have applied all these recommendations and your mission still doesn't run well in multiplayer (but does in singleplayer), it might be caused by mods that you are running which could be badly, or not at all, optimised.
If you want to be sure, run the same mission with and without mods. If you have a big difference in performance, look no further.