Jump to content
Sign in to follow this  
Polymath820

Extensive Guide for Multiplayer scripting?

Recommended Posts

I've been following you extensively Killzone_Kid, but the Multiplayer scripting you've posted is now out of date due to multitudes of new commands coming out.

Theres quite a few things I need cleared up such as, how to optimise and reduce the amount of network calls etc. To clients. I look at PublicVariable but was unsatisfied with it.

How the execVM works and a few other things I can't yet clear up, in addition to the several new entry init areas of scripts for multiplayer such as

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

The many different ways multiplayer works is both overwhelming and confusing.

I've also been doing experimentation with cfgfunctions.hpp and it's pre-init, post-init capabilities.

An testing "VM Multi-threads", with synchronization between each thread.

The question I've got to ask which one of all these is actually the right way to do it?

The reason I ask all of this is due to me writing a weather script that has each component separated into it's own function-as-file, and I wondered if

I would cause problems attempting to network propergate entire functions via publicVariable, or it's variants?

Edited by Polymath820

Share this post


Link to post
Share on other sites

Why propagate entire functions when all you need to propagate is setOvercast and setRain?

I don't believe anyone has written a super extensive guide for multiplayer, try just asking a few questions

Share this post


Link to post
Share on other sites

I think the members of Public Community Scripters' Lounge should make this. great idea.... I support it 100% :)

no really this would be like the only manual I would ever read....

Share this post


Link to post
Share on other sites

Really in the end, the only difference between MP scripting and SP is locality, if you get an understanding of that, your good to go. There isn't a "key" to MP scripting you just have to know where things are executed and where they should be executed.

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

cfgfunctions.hpp and it's pre-init, post-init capabilities

"VM Multi-threads", with synchronization between each thread

function-as-file

^All of that is truly unrelated to MP scripting as a whole, sure there are connections, but really isn't directly how you script for MP.

KK has a tutorial on locality if you haven't looked into it yet: http://killzonekid.com/arma-scripting-tutorials-locality/

EDIT: Really if you find out how to use BIS_fnc_MP to its potential, it will do the hard work for you. With it you can decide to broadcast to everyone, just a single client, to the server only, to multiple single clients, and whether or not it will be executed for JIP (join in progress) players and whether or not the code will be called or spawned. It's really one of the best tools out there for MP scripting.

And if your using file functions it's really as simple as:

[[function params],"YOUR_fnc_here",false,false,false] call BIS_fnc_MP;
//will be spawned only on the server, and only once

[[function params],"YOUR_fnc_here",true,false,false] call BIS_fnc_MP;
//will be spawned only on every currently connected client, and only once

[[function params],"YOUR_fnc_here",true,true,false] call BIS_fnc_MP;
//will be spawned only on every currently connected client, and for every newly connected client (JIP)

[[function params],"YOUR_fnc_here",player,false,false] call BIS_fnc_MP;
//will be spawned locally to the player object, and only once

//and it goes on

Edited by JShock

Share this post


Link to post
Share on other sites
The reason I ask all of this is due to me writing a weather script that has each component separated into it's own function-as-file, and I wondered if

I would cause problems attempting to network propergate entire functions via publicVariable, or it's variants?

Why don't you test it and then you will know?

Get an fps counter, a server monitor and bandwidth checker and play your mission.

We could sit here and talk about optimisation until eternity and it won't mean a thing next to test results.

Share this post


Link to post
Share on other sites

Well, event scripts have been there since forever, not something new, and as far as I know basic MP functionality hasn't much changed since me putting some of thoses tuts out. What changed is the implementation of headless client and some additional server security. Also weather changes are now synced from the server, trying to change it on clients yourself is not a good idea.

Share this post


Link to post
Share on other sites

There is no extensive guide ... A lot is designing the tools you require for your uses, then applying them ... for your uses.

Two 'pro tips':

1. Keep mind on understanding locality. That is, what should run on server or client, or both. What and when. For secure and stable, run on server. For performance and UI speed, run on clients.

2. Arrays. A3 is full of array manipulation and usage, and learning to effectively use arrays will make many jobs easier and give you a solid go-to plan for approaching script design. They also can help with maximizing structural performance and conform well to the reality of A3 CPU usage.

Any sort of guide would be huge and a lot of time investment. There is already plenty of free content that has had thousands of unpaid, free hobby hours put into it by people who know what they're doing.

Share this post


Link to post
Share on other sites
Well, event scripts have been there since forever, not something new, and as far as I know basic MP functionality hasn't much changed since me putting some of thoses tuts out. What changed is the implementation of headless client and some additional server security. Also weather changes are now synced from the server, trying to change it on clients yourself is not a good idea.

I am writing a weather script that is more advanced than the Bohemia version, which generates lightning around clients singular at a time, with varying degrees of repeated events etc.

Also are PublicVariable Event Handlers treated the same way as in "non-scheduled" just like other eventhandlers?

Share this post


Link to post
Share on other sites
I am writing a weather script that is more advanced than the Bohemia version, which generates lightning around clients singular at a time, with varying degrees of repeated events etc.

Still you cannot do anything about server sync, it is hardcoded, certain things about weather you just cannot change on clients as server will put them right back.

Share this post


Link to post
Share on other sites

I found a solution. The setTimeMultiplier works. put it on high speed till it reaches the desired value. Then slow it down again.

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
Sign in to follow this  

×