Home   Help Search Login Register  

Author Topic: Locals  (Read 1556 times)

0 Members and 1 Guest are viewing this topic.

duckwilliamson

  • Guest
Locals
« on: 09 Jul 2003, 23:20:49 »
Anyone have any lag reduction ideas??
- I was just wondering about limits of men/bodies/vehicles
- I used to have 130 men, 13 tanks, and constantly increasing copter bodies (copters spawn)
- This lagged like crap - playable crap
- All these units are about ¼ of the whole map I have (the rest doesn't lag)
- This mass of units is all placed on the small island at the top left of Everon

So my questions are:
-What would be say a good limit (in your opinion or experience) of units to have on the island ...?
 (I was going to change it so there were only 3 groups of 12 men and 2 groups of 4 tanks and the men would respawn to a certain limit - removing bodies of course)
-What do wp's do for lag (how constantly run & how laggy do more wp's make it)
-Are things like wp's and triggers only run on one computer, and if so how is that determined & changed
-How badly do dead objects affect the game
-Do objects out of your view range hurt lag at all - or memory or what?

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Locals
« Reply #1 on: 10 Jul 2003, 02:11:58 »
Create a gamelogic, name it "Server"

The name you gave "Server", has nothing to do with Servers, you could have simply named it "Hotchocolate" and it would do the same job

EG.

?(local server):
?(local Hotchocolate):

The above two line checks whether  the machine that the script  is run on is  the server


What the lines actually says is
Is "Server" or  "Hotchocolate" local (true) on  this machine?"
If it is, then it must be the server, because gamelogics are only present on server machines
_____________________________________________________________
You can then add further commands to the line
eg
?(local server): exit
The script will not run on the server machine
______________________________________________________________
?(local server): goto "Start1"

#Start1

The above line if run on the server will have the script jump to the "#Start1" line, missing any lines out inbetween
_____________________________________________________________
? !(local server): exit
The above line will cause the script to exit, if the script IS NOT being run on a server


Other lines of interest

?(Local Player):

Used to check if the machine that the script is running on is NOT a dedicated server

or if you want it run only on a dedicated server

? !(Local Player):

?(Local server): will run on a player/server machine as well as a dedicated server



Scripts or lines of scripts that are normally run on a server only are things like
Adding scoring
Vehicle respawn
______________________________________________________________


The rest is purely theory. I may be completely wrong here and i am sure if i am someone will blow this opinion away


My opinion is that
Triggers loop extremely quickly checking to see if its condition is true, probably the same speed as the @ command rechecks to see if the condition that follows it,  is met

Whereas Scripts loop or run at whatever speed you set
Majority of scripts that i have seen loop at 1 second or 0.5 seconds. This is relatively slow for a cpu to deal with as long as there arent too many lines to run in one go

I have seen some scripts written to loop at 0.01
The above loop speed i wouldnt particularly want to use, as i would expect this would stress the CPU too much

So in my opinion, if using a script can remove  triggers, use a script

The only advantage i see with triggers, is that they apparently help to synchronise with each other on the various clients and server

I stongly believe that scripts, correctly written and optimised cause far less cpu stress than triggers


Additionally, a lot of scripts i have seen, including some i have written are not optimised anything like as well as they could be

For instance, i have seen scripts written that have lines running on both the client and the server, when really there was only need to have them running on one or the other, but not both

So if you want to optimise your mission to the optimum, you have to look at each individual line and ask, where does this line need to be run, and then put the Server checkline infront of that line, to deal with it as you want


If you have a script that runs 20 lines all in one go, seperate them with a wait command, even a ~0.01 is a long enough wait to relieve stress on the cpu
(A question arises here (How quickly does a ~ command loop to see when time is up)

If a script doesnt need to loop every second, then slow it down so it doesnt

Another tip, and this i have no idea how it would affect efficiency

If you have global variables that are no longer used in thje rest of the mission, then at the point where they become redundant delete them by using the Variablename = nil. This gets rid of them from memory

Keep variable names as short as possible
Dont have ;;Commented lines in loops

other tips

Restrict the viewing distance
setviewdistance 1000

Dont use a lot of high firerate vehicles, eg shilka, vulcan
Dont have too high a density rain
Dont use fog
Have AI spawn when you get within a certain distance, dont spawn them before
Limit the number of fires you have on a night mission
Dont add too many objects, especially houses, bushes etc

The less textures that have to be drawn the better the framerate

Desert, no buildings = Great
Lipany with additional bushes, buildings etc, a killer

Run as much clientside as possible, reduce the net traffic between server and client as much as possible

Get rid of coloured smoke, just use white
« Last Edit: 10 Jul 2003, 02:19:51 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

duckwilliamson

  • Guest
Re:Locals
« Reply #2 on: 18 Jul 2003, 05:58:46 »
Just one note:

(it'll help a lot!)

the game logics are only on the server - right?
the server is the guy who hosts the game - right?

so if i were to run all the scripts on the 'server' then they would be running on the one comp that created the game with the (server) after the name in the load mission scectoin ...

that means i would make the fastest computer host as the server, run all the scripts and all is well ... ?

(if you were  wondering i just want a response (me="Feeling Retarded") to whether or not the host is always the server ...)

Note: it's funny how i deal with all the complex things and miss out on the simplistic things ...

Rubble_Maker

  • Guest
Re:Locals
« Reply #3 on: 18 Jul 2003, 10:43:15 »
Yes the server is the host.

btw triggers are a tad slower than the @-condition, which checks the argument each frame.

If you need many,many units on your map, use CreateVehicle and DeleteVehicle to create them dynamically. Unless your player is in an airplane or chopper, he won't have a chance to see all of them at once. So partition your map into regions, and assign scripts to them (via triggers) that spawn the enemies once the player enters the region, and deletes unused or dead units from other regions. A nice trick would be to delete all dead units once the player is, say, more than 1000m away from them (so he wont see them disappear).

And, like Terox mentioned, have your scripts run at the lowest possible frequency! For the "is-unit-dead" check, even a 10 seconds delay would be totally sufficient.

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:Locals
« Reply #4 on: 18 Jul 2003, 23:17:35 »
Just to add incase it causes confusion

The server can be

1) A dedicated server (Not having anyone playing on it)
2) A Player Server, where the player is hosting the game on his machine
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:Locals
« Reply #5 on: 19 Jul 2003, 13:16:33 »
I tell you what now:

a trigger's condition will be checked every 0.5 seconds

an @ condition will be checked everz 0.5 seconds too

The @ condition indeed seems to be faster than the trigger,
because of the following reason:

If a script is waiting for an @ condition, and this condition
becomes true it will go on executing the next line of the script.

If a triger is waiting on a condition and the condition becomes
true, it takes a few 0.xxx secs longer the the onActivation
field will be executed (e.g: a this exec "xxx.sqs" also takes
some time).

But basically @ conditions and triggers will be checked in
the same frequenzy.

~S~ CD
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

duckwilliamson

  • Guest
Re:Locals
« Reply #6 on: 22 Jul 2003, 01:15:02 »
ok well thx all ... this has been rather helpful ...