Jump to content
Sign in to follow this  
RAPT0R

Guide to mp optimizing

Recommended Posts

I am not exactly sure about that part.

Made mp mission, most things run fine but slowly start getting seriously trashes.

So I was wondering what things exactly need to be done.

Different public vars/scripts for both east and west ?

Server side functions?

Everything related to getting all things working nice and smooth for mp

I am not exactly sure about that part, thus I am looking for help regarding that matter smile.gif

thanks in advance.

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (RAPT0R @ Aug. 12 2002,21:43)</td></tr><tr><td id="QUOTE">Everything related to getting all things working nice and smooth for mp<span id='postcolor'>

Well, without knowing your mission, or what problems exactly you got, here's some hints what I do to to make missions more stable and reduce server load:

- Use only local variables (starting with an underscore) within scripts - that way you avoid conflicts with other scripts.

- When using public variables, have a list of them and what they do - that way you avoid using the same variable twice

- Use self-explaining variable names - that avoids confusion if your mission gets bigger (eg use "leaderteam1" instead of "L1")

- Use the init.sqs if possible instead of the init-line. That way you have to change stuff only in one script and not in many different init-lines (probably forgetting some of them when you apply changes)

- Keep things clearly seperated between units/teams/sides - be it by using different scripts (if really nescessary) or just adding visible seperators in the different parts of your scripts.

- Get used to include remarks for documentation and visible seperation of different parts of your scripts. Helps a lot if you have to change/fix a script you haven't just written yesterday...

- keep the number of scripts running/starting at the same time as low as possible.

- If you use loops in your scripts do include waits, so the script doesn't waste time processing when it doesn't really matter if it runs once each milisecond o just once a minute. Use the waiting time you think acceptable for a certain script, but don't just let them run wild...

Also:

- place units dynamically: insert one unit with waypoints, then add the rest of the squad once the players get near (or even create all units and the waypoints on demand using a script)

- remove units from the map that are not needed anymore (in areas where the players won't get to anymore). The deleteVehicle command does that.

Well. That's what I try to do when I work on my missions. It really reduces server load a lot and makes scripting and editing missions much easier.

Share this post


Link to post
Share on other sites

Thanks a lot, I was just looking for those kinds of pointers smile.gif

As I wasnt exactly sure about mp, and the first test with the map didnt run exactly perfectly biggrin.gif

exta guestion:

With something like this:

--------------------------------------

; Script to control t80's join process

?(side player == west): goto "end"

?(player == dude1): goto "dude1"

?(player == squad1): goto "squad1"

?(player == suqad2): goto "squad2"

goto "end"

#dude1

?(group tank2 == group dude1):goto "DROP"

_listunits = units dude1

_A = 12

_C = 1

#JOIN

[tank2] Join dude1

~2

goto "end"

#DROP

[tank2] join GrpNull

goto "end"

#squad1

?(group tank2 == group squad1):goto "DROP"

_listunits = units squad1

_A = 12

_C = 1

#JOIN

[tank2] Join squad1

~2

goto "end"

#DROP

[tank2] join GrpNull

goto "end"

#squad2

?(group tank2 == group squad2):goto "DROP"

_listunits = units squad2

_A = 12

_C = 1

#JOIN

[tank2] Join squad2

~2

goto "end"

#DROP

[tank2] join GrpNull

goto "end"

#end

Exit

-------------------------------

I think last time I had still some probs with it, as I have 4 similiar scripts just for all different vehicles(2 per side) they started kinda overlapping each other, so I added the ?West:exit line and ?east:exit lines

Though should I also try to use different vars for all the scripts ?

Or work more on the radio trigger to call the script and add extra checks there if the scruot us akright(propably aint)

Share this post


Link to post
Share on other sites

Here's another hint for creating mp missions.

It doesn't reduce lag, but is very useful though.

If you have a squad of let's say 8 soldiers, and all

of them are playable, this doesn't ensure, that the

squad leader will be used when the mission is played.

I mean, the squad leader could be disabled in player

selection screen. Now if the mission creater was using

any commands in the leader's init field, they never get

to work in this case; e.g: playergrp=group this, or

"_x moveinCargo vehicle" foreach units this

So hint one is: if you are boarding the playable group into

any vehicle at the start of the mission, don't use a playable

leader's init field for that (already seen that mistake in some

maps).

Hint two: If you want to create a groupname, where you

can take reference on it later in the mission - e.g:

"alive _x" count (units playergrp) == 0 -

then you can use a trigger right at the start of the mission

to do that.

Trigger A: side of squad/present

condition: this

activation field: playergrp=group thislist select 0

:note - the trigger needs to cover only the squad, you want

to interact with.

You can use the same technique for putting players into strings, to use them for sidechat messages, or other stuff

e.g: soldier1=thislist select 0; soldier2=thislist select 1

:note - also the other squad soldiers can be disabled, and

so there could be problems with some xchat messages, when

using their editor pre-game defined unit names.

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  

×