Jump to content
Sign in to follow this  
laggy

MP versus SP scripting

Recommended Posts

Hi everyone.

I'm starting this topic because I'm really into MP mission editing and even if though there are MP tutorials, I still find that some things are vague. The PublicVariable command works really well in my opinion, but I have some trouble understanding what commands (read script functions) should be run on all computers, just server or even just client. Obviously one could always try it with experiments including two computers, but that is not very practical and what I'm looking for is some fundamental understanding of how things really work. I think the easiest way to start is to ask some specific questions and hope that someone will answer.

1. "do"Commands like: doMove, doFire etc. Do they work if they are executed on just the server? Will I get unwanted multiple effects or conflicting commands if they are executed on all computers?

2. SwitchMove and PlayMove. Are there any differances in how they have to be executed? My experience with Flashpoint was that SwitchMove had to be executed on all computers but PlayMove only needed to be done on one clients computer and everyone would see the effect.

3. When referring to units or objects like: unit1 domove getpos unit2, or unit1 setpos getpos unit2. Will that cause conflicts between computers if the clients don't have the units referred to within viewdistance? or will the server override all confusion?

4. When I create a #lightpoint. Is that a vehicle like any other meaning that it can be created even on just a clients computer and everyone will get the light effect?

5. Eventhandlers (killed and hit) can they start a PublicVariable? If so which computer will initiate the PublicVariable if the i.e killed unit is not a player?

That's all my questions for now, but I will have others later. I already know that things like units talking, radiosound, objectives, cutscenes etc. has to be executed on all computers to work properly, but the things above are still a mystery to me. Hopefully some MP guru will pick up my topic.

Sincerely

Laggy

Share this post


Link to post
Share on other sites

1,2.: almoust all comands are running (works) only on 1 machine - in which unit is local

look: http://community.bistudio.com/wiki/Locality_in_Multiplayer

3. clients and server synchronize positions of their local units, that is why your arma "knows" about every units on map, even it is 20km far.

Response: there will be no conflicts, server won't override anything

4. -

5. Eventhandler can run PublicVariable. This will be running by machine in which unit/vehicle is local (unit/vehicle from unit/vehicle addEventhandler XXXX).

Share this post


Link to post
Share on other sites

Thanks alot for the fast reply.

I'll check the locality link. The "local" aspect has never made any real sense to me yet.

Laggy

Share this post


Link to post
Share on other sites

Re: eventhandlers:

Some eventhandlers execute on all machines (like dammaged), and some only where the unit is local (like killed or hit). If you have a publicvariable in a handler that is executed on all machines, all machines will send out a publicvariable. If it's local, it'll just be sent from the one machine.

For example, I use dammaged for my vehicle damage script so the effects are 'global'. If I used hit or killed, I might need to use a publicvariable in the handler to notify the other computers that said unit was hit or killed...

The wiki list of arma eventhandlers notes which are executed globally or locally.

Share this post


Link to post
Share on other sites

Hi again.

So how about this one. Might seem like a stupid or annoying question, but it's really making me wonder.

If I place a trigger with condition "OPFOR - Not Present". This trigger will activate on all computers except the server even though OPFOR is present, if the OPFOR units are outside viewdistance. How is that possibile if all unit positions are coordinated between all computers?

If a trigger on a clients computer says that OPFOR is not present when they really are, it seems like triggers are counted for outside viewdistance but not units.

An easy way to overcome this problem is obviously to include "AND local server" in the activation field and follow it with a PublicVariable in OnActivation, but I'm trying to understand a basic structure in how things work in MP.

Share this post


Link to post
Share on other sites

Yes that is exactly what you would do to limit the activation to working on the server only: only I would probably use IsServer instead.

--Ben

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  

×