Page 1 of 1

Multiplayer mission editing basics

Posted: 2007-10-01 08:35:22
by Snake Man
This is multiplayer mission editing basics.

I wanted to add such topic as frankly its been ages since I did any OFP MP missions and now so much have changed that I'm out of the loop. So what I learn in the near future about ArmA MP editing goes to this topic. If anyone else has knowledge then please share. Finally I'll put article about contents of this topic into the PMC Editing Wiki too.

Basic stuff:
Server == The hosting machine, either dedicated windows or linux server, or the users computer who clicks Host in MP menu. "Professional" community teams/clans always run dedicated server as it gives better framerates overall for the mission (more stuff calculated on one dedicated machine).
Client == All the other computers running this mission, ie connected to the server machine.

But lets start with couple of questions/things. Questions meaning that if you find some information to be wrong, or that it can be done better or more efficient somehow, please correct me as it would be most appreciated.

Multiplayer description.ext

Description.ext in BIS Wiki

You can setup few configs in the description.ext for multiplayer, most important might be the respawn status.

Code: Select all

// VALUES: 0=None; 1=Bird; 2=Instant; 3=Base; 4=Group; 5=Side;
// Time delay in seconds for respawn to occur  (NEVER use 0)
In COOP missions its usually nice to have the respawn set to "GROUP" so when you die, you spawn into next group member and continue to do so until all members of this group are dead.

The complete list:
0 or "NONE" = No respawn.
1 or "BIRD" = Respawn as a seagull.
2 or "INSTANT" = Respawn just where you died.
3 or "BASE" = Respawn in base. Requires a marker named:
Vehicle respawn in base requires a marker named:
4 or "GROUP" = Respawn in your group (if there's no AI left, you'll become a seagull).
5 or "SIDE" = Respawn into an AI unit on your side (if there's no AI left, you'll become a seagull). With this respawn type, team switch is also available to any AI controlled playable units.

Code: Select all

onLoadMission="Vietnam: The Experience";
Shown on while the mission is loading.

Code: Select all

Show all these various map tools in the mission. Most usable is ShowGPS as its the thing that lets guys know where they are in the world.

Code: Select all

Removes all playable units which do not have a human player, this is useful in a mission which is mostly played "as many humans as possible" leaving all AI out. In mission setup screen all AI units are "disabled", but players can enter them by clicking on the player slot.

Code: Select all

class Header
	gameType = Coop; // DM Team Coop CTI
	minPlayers = 1; // Min Players
	maxPlayers = 75; // Max Players
	playerCountMultipleOf = 1;
With this you hosted mission will display some information about the contents like what gametype it is and how many players. countmultipleof is some ofpelite thing.

In the recent 1.12b linux dedicated server (maybe earlier patches too) it gives RPT error if the number of player slots dont match with the "maxPlayers" value.

Here is the full gameType list:
DM = Death Match
CTF = Capture the Flag
FF = Flag Fight
Coop = Cooperative Mission
Team = Team Mission
Scont = Sector Control
Hold = Hold Location
Unknown = Unknown - is used when no class header is defined.

Code: Select all

titleParam1 = "C2 Difficulty:";
valuesParam1[] = {0,1};
defValueParam1 = 0; 
textsParam1[] = {"Normal","Hard"};

titleParam2 = "Visibility:"; 
valuesParam2[] = {500, 1000, 1500, 2000, 2500, 3000, 3500, 4000, 4500, 5000, 5500, 6000, 6500, 7000, 7500, 8000, 8500, 9000, 9500, 10000};
defValueParam2 = 2000; 
textsParam2[] = {"0.5  km","1    km","1.5  km","2    km","2.5  km","3    km","3.5  km","4    km","4.5  km","5    km","5.5  km","6    km","6.5  km","7    km","7.5  km","8    km","8.5  km","9    km","9.5  km","10  km"};
These are some setups for the selection on mission setup screen, this apparently sets mission difficulty and viewdistance. In the mission param1 and param2 have the values of the chosen options. Many people will assign a variable in the init.sqs file to param1 for simplicity, an example of this would be to assign variable timelimit = param1.

Running scripts on server vs clients

If you want to run a certain script in server only you must start the script by this kind of command:

Code: Select all

if (!isServer) exitWith {}
If its ran on client the script exits, if its ran on server or single player, the script proceeds.

For example you would not want to run createVehicle scripts for units or tanks and such in the clients, only on server.

Certain commands are local or global

Global commands are commands that when run on 1 machine, every other machine is sent / receives that data.

Local commands are commands that do not send data to other machines.

setPos, is actually a global command, which means only 1 machine needs to run this code, as all the other machines will receive the data of the objects new position and reposition it. If you run this code on all machines, then every machine will tell every ,machine where to setpos the object, and the last machine that runs the code, will be the one that overwrites the rest.

setDir is local, meaning if you setdir an object on 1 machine, the others wont see it placed in the new direction, until some other code updates it.

It takes time, but eventually you will discover which commands are local and which arent and the workarounds to create a global from a local.

Eg, to make setdir into a global command, first setdir the object then setpos it, the setpos sends the direction of the object, thus setdir has been sent globally.

A new command that comes in both Global and local flavours is the setMarkerPos, with it's local varient setMarkerPosLocal.

creating units & vehicles

There is now new command called createVehicleLocal which means that if you have specific cases where you want to create something only locally so no network traffic is caused by sending the info on all other computers, this is your command to use. For example if you have airstrike bombing script where the bomb falls to the ground and then creates nice explosion effect by this script, before we used like camCreate to create the local effects so there will be no desync-storms everytime someone bombs, but now we can use createVehicleLocal in its place.

Persistent missions

The Persistent missions mean that the mission will run in the dedicated server even as all human players has logged off, it is very cool idea and atmosphere to think that when you go to work/sleep/etc, the mission keeps running, the AI keeps fighting (depending on the mission). It is so cool to joing back on into a mission and see the mission clock say like duration: 500 minutes.

First you need to activate the persistent mission support in the dedicated server by editing the server.cfg file (or what ever name you use) by adding this line:

Code: Select all

That makes the server to run in persistent mode. Next as you create missions, the basic requirement for persistent mission is to activate the respawn by adding respawn=4; into description.ext file and placing respawn points, ie two markers of names respawn_east and respawn_west, which of course can be any side like guerrilla or civilian too, I'm not sure if this works with ony one respawn marker like human BLUFOR respawns agains all AI OPFOR.

This mission will then keep on running when the last human player has disconnected, however if someone gets voted to admin and he changes the mission then obviously the mission ends and if admin quits from the mission (again naturally) the mission ends. So if you have a long mission running like this, be careful not to let any outsiders be admins and when admin wants to stop playing, he has to do the "#logout" command to step down from admin position before disconnecting. Killswitch suggested to user dedicated server config voteThreshold=2; to disable anyone to vote himself for admin, this would help to prevent anyone ending the mission.

(more to come as I learn heh, especially I want to learn how to make Persistent missions)...

Posted: 2007-10-05 00:47:25
by Snake Man
Added small bit about creating stuff. Its on the first post, but for quick read I have pasted it here too;

creating units & vehicles

There is now new command called createVehicleLocal which means that if you have specific cases where you want to create something only in the client so no network traffic is caused by sending the info on all other computers, this is your command to use. For example if you have airstrike bombing script where the bomb falls to the ground and then creates nice explosion effect by this script, before we used like camCreate to create the local effects so there will be no desync-storms everytime someone bombs, but now we can use createVehicleLocal in its place.

Posted: 2007-10-06 01:00:43
by Snake Man
In first post I added the bits about persistent missions, I hope the information is correct and ask anyone to post if they can find errors.

Posted: 2007-10-08 09:39:17
by Snake Man
I'm not sure how the viewdistance is handled on dedicated server and clients, well I mean its propably no matter for server but how is it set for all clients at the same time, my limited experience is that the command is local?

Another issue is perhaps more larger, but how is random weather scripted correctly so it will be same for all clients?

Posted: 2007-10-25 04:12:44
by Snake Man
I had a script to create units and vehicles, in SP I ran the script from init.sqf like this:

Code: Select all

[] execVM "war.sqf";
Quite simple.

However in MP that didn't work, the script was not ran for some reason, perhaps the init.sqf is used somehow differently now with the JIP and stuff. So I had to create a trigger, set its activation time to 0, condition True and activation line I put:

Code: Select all

handle = execVM "war.sqf";
And it launched ok in MP dedicated linux server.

If anyone have any finer details why this happens like this, feel free to share. I guess I'm just happy I can run now my createUnit script succesfully.

Posted: 2007-10-29 05:27:26
by Synide
hmmm... haven't ever had a problem running execVM in either SP or MP.

the syntax i always use irrespective of it's usage context is...

Code: Select all

_handle=[<some>] execVM "blah.sqf";

Posted: 2007-11-19 06:06:03
by anzacsas
Snake man,
I was sure i just posted some info regarding MP mission endings here not long ago .

Did it come through?

It was a complex post and i would prefer not to write all again but if it didnt come through i will.


Posted: 2007-11-19 08:22:44
by Snake Man
Nope, as you can see there is no post from you (what you mentioned).

This very very good tip if you have unrealiable net connection or just in case anyway: write your long post with your favourite text editor instead of the forums small post a reply box. When you're done, paste the text into the forums post a reply box and hit preview to see it. Small posts came out fine with it, but anything important and long / tedius writing should be done locally so when you press submit and you get like 404 error, you wont lose all of the text.

Posted: 2007-11-19 10:09:51
by anzacsas
Thats a good idea m8 .will do.

Posted: 2007-11-19 10:34:12
by anzacsas
Hi all, steve here again.

Thought i would post this as i havnt seen it mentioned before anywhere.

This is about End triggers in MP missions.

As far as i know in the init .sqf file of the mission the following lines are required for all players regardlees of when they joined will be syncronised with the server and each other.

in the init.sqf put this-


if !(local Server) then {exit};
onPlayerConnected "publicVariable ""end1"";publicVariable ""end2""";

I am not 100% on this so if anyone knows anymore about this could they please fill us all in as this is essential for even the most basic of MP missions.

thnx. :)

Posted: 2007-11-30 06:25:01
by anzacsas
The above lines of code was supposed to be for a SQS file NOT an SQF.
Sorry for the inconveniance. :)

If anyone knows of a tutorial for this stuff or another thread where this has already been explained could they please post a link. :)

Re: Multiplayer mission editing basics

Posted: 2009-05-11 08:12:37
by Snake Man
Our linux dedicated server gives errors on some missions like this:

Code: Select all

mission_name: Missing 'description.ext::Header'
When I'm looking at the description.ext, I cant see anything wrong. What might be the cause of this error?