Jump to content
killshot

Multiplayer Performance Tips (CO-OPS)

Recommended Posts

Hey guys.

When there are ten, twenty or even more people who take their time to participate in your mission, the last thing you want is to waste it and be the jackass.

My greatest concern is to have server's or players fps drop to an unplayable level or at least low enough to kill the fun.

Maybe you have gained experience and want to share the way you set up your COOP missions in terms of performance.

Is it the best thing to have most or all objects and units spawned in via scripts (for example using xCam to prefab fortifications, townscapes, etc.) during the mission or is it better to find a balance between spawning and preplacing objects/units in the editor?

Or maybe it is even better to have everything preplaced and/or use enableSimulationGlobal false; on every relevant group/unit/object until your mates get near the hot spot/s?

Also would it make sense to preProcess prefab or unit spawn scripts?

What about using the startLoadingScreen command?

How many AIs vs. how many clients without also having the performance getting killed in action? 200 to 15? 100 to 30?

And is it really recommendable to use HeadlessClient already/anyway?

I would like to, but I read this post by jaynus in the UnitedOperations-forum and furthermore I seem to remember to have read about HC having problems with vehicles, HC getting kicked or crash so units will be moved back to the server, losing all their waypoints,etc.

Every advice and shared experience is highly appreciated. (Using CleanUp-Scripts, letting your mates stand still for a minute at mission start, etc.)

And here is an interesting experience report written by Jester814.

Unfortunately he didn't come up with an update yet.

Regards. :)

Share this post


Link to post
Share on other sites

Forget Jester, he may post videos on basic tutorials but not optimization.

I would suggest reading this page, it is very beneficial:

https://community.bistudio.com/wiki/Code_Optimisation

Also, take note that there are two types of variables, this includes:

- Global (runs on all computers)

- Local (runs on one computer)

To get or set a pos, its a lot faster to use ATL.

Finally, if you made a function and want to spawn it (don't use call as it does not work for custom functions somehow)...DO NOT USE execVM! This code may be friendly, but I avoid it as a plague. Use "compile preproccessFileLineNumbers" instead. (It will store the function as memory)

Hope it helps, ;)

Rawner135

Edited by Ranwer

Share this post


Link to post
Share on other sites

Server considerations:

- What island are you using? Larger area + more detail = less FPS.

- How many AI are generally spawned at any one time? Keep it under 100 if you can.

- How many of the AI are in Combat/Danger mode at any one time? 100 AI standing quietly have less FPS effect than 100 AI hiding from a players CAS jet/helo or engaged in urban combat. For this reason, it will drag down server/client FPS to allow your players to constantly fly over enemy territory in aircraft. Solution = provide your AI with anti-air technology to prevent this FPS drag :)

- How long has your server been up and running? A3 has memory leak which causes inevitable deterioration over time. #exportJipQueue command can give you indication on what is happening over time.

- Total number of objects. Anything which can't be interacted with (no hatches,doors,etc) should be enableSimulationGlobal FALSE. Total number of objects not too important. There are lots of servers with 10,000-12,000 mission objects which run at ~40 FPS, because they do not have any AI running around.

- Headless Client will help but do not offload critical objects/units/vehicles. Keep stuff which players are going to interact with (or shoot at) often on the server for stability and to avoid network-traffic related issues.

- Do not run client scripts on server. server root script should be 'initServer.sqf' unless you are an advanced scripter.

- Cleanup. Many more objects are created in a scenario than just dead bodies and dead vehicles. Ensure you are managing their number and pruning where necessary with a good cleanup script.

Client considerations:

- View Distance and object view distance. As low as you can get away with and still have fun = better FPS. In towns/cities, turn it down to under 1000.

- Terrain. Larger terrains like Altis = Less FPS than terrains like Stratis.

- Script errors. Kill them all!

- Do not run server scripts on client. client root script should be 'initPlayerLocal.sqf' unless you are an advanced scripter.

- Heavy client script commands like onEachFrame and Draw3D. Keep those to a minimum. While they are pretty and aesthetic, executing something onEachFrame sends a lot of evaluations into the CPU, while a slower evaluation loop will not burden the CPU as much. Think in terms of 'evaluations per minute'. Stick a diag_log or a systemChat line beside your code to see how often it is evaluating, if its in a loop.

- Weather. Limit your use of rain and fog.

comments:

the most important thing for server is # of AI, especially the # in combat/danger mode. Aim for under 100 AI total with under 50 in combat/danger at any one time.

the most important thing for client is view distance

Share this post


Link to post
Share on other sites

Great contributions so far, thank you! Hopefully there are more people willing to share their thoughts, opinions and experiences regarding their own Coop missions (10,20,40,50 clients).

I have to admit that I have never built a Coop for more than 12 clients due to my worries.

And actually for A3 I've only made a tank TvT for 24 clients. So my next step is to create a Coop mission for 18 clients.

For the 12 clients Coop back in A2 (F.A.T.A. map) I had about 100 editor placed units in 3 areas, each with one trigger to freeze and unfreeze AI, using the enableSimulation and disable commands and to execute UPSMON and Housepatrol. Each area had about 20 HousePatrol units and 4x 3-men UPSMON groups, maybe 1 or 2 units just positioned and maybe a hand full of enemy vehicles at all. There were heavy fire fights but also very good performance from start to end, everybody had fun and to me it was a great game night. So at least for 12 to 15 clients I can recommend this as one way to achieve a nice ratio between performance and action (if it's still working in A3 tho).

Share this post


Link to post
Share on other sites
- Headless Client will help but do not offload critical objects/units/vehicles. Keep stuff which players are going to interact with (or shoot at) often on the server for stability and to avoid network-traffic related issues.
?? Usually HC are on the same network (with 100 / 1000Mbps connections) or even in the same box. There shouldn't be no issues with offloading all the AI to the HC. Been using HC in all our missions since 3 or 4 months, and we didn't have any issues about disconnections or crashes. Use ASM to monitor both instances and check the FPS and CPS values. You should be safe if you mount the HC in the same box.
Finally, if you made a function and want to spawn it (don't use call as it does not work for custom functions somehow)...DO NOT USE execVM! This code may be friendly, but I avoid it as a plague. Use "compile preproccessFileLineNumbers" instead. (It will store the function as memory)

??Functions can be called or spawned, can't be execVM. Calling a function means it will be executed on the main thread and won't let anything continue until it has finished. Spawn means it will be executed in a paralell thread and share CPU cycles with the rest of the simulation. You shouldn't call anything CPU intensive. And it will give an error calling functions with "waituntil" or "sleep" commands, as by default the engine does not allow this (to avoid issues).

About scripts, you can use call compile to execute them instantly, providing the script is not a loop or anything you need running in the background. In that case execVM is imperative. There's a terminate command to end scripts or functions (for example, a trigger executes a script, and it waits for some user input...but the user is no longer in the area.)

A cleanup script helps, specially because they usually clean more stuff than the Arma 3 implementation. Arma 3 code for cleanup is faster though not because it is an FSM, but because it is compiled and executes in native C++ ?? code.

Check for other people code. F3 framework and Wavelenght fork of it are specially well done in terms of performance. The other suggestions are all good.

Also, addons can kill performance or cause crashes.

Share this post


Link to post
Share on other sites

Finally, if you made a function and want to spawn it (don't use call as it does not work for custom functions somehow)...DO NOT USE execVM! This code may be friendly, but I avoid it as a plague. Use "compile preproccessFileLineNumbers" instead. (It will store the function as memory)

Calling functions doesn't work? Of course it does. You're doing something horribly wrong if it doesn't for you.

Besides, you absolutely have to use call if you want your function to return something.

And you execvm a script file, not functions.

I admit, I don't do MP scripting, but I doubt these things work that much differently in SP...?

edit. Oh, Zriel already got this covered while I was just rolling my eyes. :)

Share this post


Link to post
Share on other sites
Finally, if you made a function and want to spawn it (don't use call as it does not work for custom functions somehow)

Rawner135

Call does work with custom functions. The difference between spawn and call is that spawn allows you to use delay commands in your function such as sleep etc. Spawn also means it could be executed before or after you intend. Call on the other hand makes sure to wait until that function has been completed.

Share this post


Link to post
Share on other sites
?? Usually HC are on the same network (with 100 / 1000Mbps connections) or even in the same box. There shouldn't be no issues with offloading all the AI to the HC. Been using HC in all our missions since 3 or 4 months, and we didn't have any issues about disconnections or crashes. Use ASM to monitor both instances and check the FPS and CPS values. You should be safe if you mount the HC in the same box.

.

Can provide more detail about your use?

number of clients in the session?

server uptime?

MCC/Zeus-based or scripted missions?

Share this post


Link to post
Share on other sites

Whoa, whoa, whoa, guys! Don't make me as if i'm the bad example here. :p (I'm just helping the poor fellow here)

The call commands randomly work for me, but I gained use to the spawn command as it appears to be reliable in SOME conditions. (Please don't throw another rule book at me, I feel like I'm a complete stuff-up :/ )

@Greenfist

Um...not sure what you were talking about with execVM, but you didn't look at my post properly. As I said, you would use execVM for non-functions, preproccessfilelinenumbers (or preproccessfile) for functions...

About scripts, you can use call compile to execute them instantly, providing the script is not a loop or anything you need running in the background. In that case execVM is imperative. There's a terminate command to end scripts or functions (for example, a trigger executes a script, and it waits for some user input...but the user is no longer in the area.)

I thought I already explained that in my post.. -_-

I already assumed that people would use call or compile with preproccessfilelinenumbers. (And..if you have a function and you execVM it, wouldn't it create more CPU in the engine? KK has already stated this back in the link I posted..)

Again, I am just simply sharing my experiences, didn't want people to use me as some kind of punching bag. :p ;)

Edited by Ranwer

Share this post


Link to post
Share on other sites

@Greenfist

Um...not sure what you were talking about with execVM, but you didn't look at my post properly. As I said, you would use execVM for non-functions, preproccessfilelinenumbers (or preproccessfile) for functions...

Sorry, I guess I misunderstood the "if you made a function and want to spawn it ...DO NOT USE execVM!". I thought you meant you can execvm a function, which you can't of course, since it's only for sqf files. :o

Edited by Greenfist

Share this post


Link to post
Share on other sites
Can provide more detail about your use?

number of clients in the session?

server uptime?

MCC/Zeus-based or scripted missions?

Arround 12 to 18 people. Server just started for the session (COOP Official missions on Sundays)

Scripted missions (Custom EOS or DAC Scripts to work over the HC instead of the server). An extensive array of addons (arround 20GB). People crash from time to time, but HC has never had an issue.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×