Jump to content

Working Dayz Epoch Headless Client for Zed Spawn and FSM


Goober

Recommended Posts

What this is:

1)  Customization at the mission folder level (e.g. \MPMissions\Dayz_Epoch_<number>.<mapname>).  It is changes and additions to mission files that are loaded at server startup and when each client connects.

2)  It is a method of dynamically tracking connected Headless Clients and maintaining a list of available ones on the server.

3)  It is changes to the way the player client runs the player_spawnCheck->building_spawnCheck->zombie_generate->zombie_agent.fsm/zombie_loiter chain to make zombies spawn and behave the same  INDEPENDENTLY (no reliance on the variable "player") of which client spawned them.

4)  It is a way (in theory) of reducing zombie location lag by having all zeds controlled by low latency clients.

5)  It furthers experimentation in using targetted publicVariableServer and publicVariableClient message semaphores.

6)  It is TLDR ... (if you got this far .. good for you).

7)  HC keeps zeds from disappearing just because a player disconnects (doesn't affect 25m radius on player connect)..

 

What this isn't:

A)  Well tested.  My test bed is an 8 core computer on which I developed the scripts without BE operational so that I could run my player client and headless client off the same key without Arma throwing a fit.

B )  This scripting doesn't address the occasional problem of headless clients joining the server and landing in the wrong slot.  This is usually a problem when the HC joins before the server processes mission.sqm.

C)  This is not hooked into animal spawning so it doesn't offload animal spawning.

D)  The code does not have the "hint" and "diag_log" lines commented out that I used for development.

E)  This is not a step by step set of instructions in how to make it work on your server.  I authored it and got it to work on mine using vanilla Dayz-Epoch 1.0.3.1 on the 1.5 Lingor map (the larger one).  If you do not understand function overloading and what instruction to change to make it work with another mod, then this is not for you.

 

edit 2: (the file attachment is not working, so use this external link instead)

http://www.mediafire.com/download/zyrzrs05x1um0mn/HC.zip

 

my server startup options:

"Expansion\beta\arma2oaserver.exe" -port=2325 -cpuCount=4 "-config=instance_7_Lingor\config.cfg" "-cfg=instance_7_Lingor\basic.cfg" "-profiles=instance_7_Lingor" -name=instance_7_Lingor "-mod=%_ARMA2PATH%;Expansion;ca;Expansion\beta;Expansion\beta\Expansion;@lingor;@DayZ_Epoch;@DayZ_Epoch_Server;"

 

excerpt from config.cfg:

requiredBuild = 103718;
localclient[]={"127.0.0.1"};
 
headless client startup:  (sorry, still some steam path stuff here ... but you should get the idea)
"%_ARMA2OAPATH%\Expansion\beta\ARMA2OA.exe" -skipIntro -nosplash -showScriptErrors -noPause -client -connect=127.0.0.1 -port=2325 -nosound "-mod=%_ARMA2PATH%;EXPANSION;ca" "-mod=Expansion\beta;Expansion\beta\Expansion" "-mod=@lingor;@dayz_epoch" -cpuCount=2 -name=HeadlessClient -profiles=HeadlessClient
 
----------------------------------------------------
least painful way to try to assure the HC goes into the CIV slot
1) start server
2) start player client - connect to lobby of server
3) start headless client
---------------------------------------------------
HOW it does it:
 
1) Server listens (via publicVariableEventHandler) for heartbeats from headless clients and updates and administers list of currently connected HCs.
2) Headless Clients send publlcVariableServer message once every 3 seconds as a heartbeat signal.
3) Player's player_spawnCheck function sends a publicVariableServer to request a zed and loot spawn cycle
4a) Server checks for presence of active HCs... if available, it sends publicVariableClient message to do zed and loot spawn to a random HC.
4b) If no HC in Server's list, then Server sends publicVariableClient message back to player client to do its own zed and loot spawn.
 
PROPS:
Some parts (HCsignals.sqf) inspired by (but not copied from) Unit Caching and Distribution Script by Dylan Plecki (Naught).
Of course a lot of the code I mangled is the Dayz-Epoch and by extension all the Dayz code that went before it, but all the changes I wrote myself (not bragging ... this forum category requires original code only)
 
edit1:
p.s. Forgot to mention I also have a pet peeve fixed in the "fixes\player_spawn_2.sqf" file.  It corrects the speed and weight carried effect on hunger.  Without this fix, your hunger would seem to go nuts based on travel speed while in a vehicle.  This makes sure that when you are doing 200kph in a Mi17, you are not starving at the end of your 2 minute heli ride across the map.  The _thirst calculation corrects for vehicle travel so I thought the _hunger calculation needed it also.
	_hunger = +((((r_player_bloodTotal - r_player_blood) / r_player_bloodTotal) * 5)) * 3;
	if (!_inVehicle) then {
		_hunger = _hunger + (_speed + dayz_myLoad) *3;
	};

 

edit 3:  if you see a file attachment below, it doesn't seem to be working.  Use the link above in the middle of the post.

Link to comment
Share on other sites

i dont get it, what does this do?

To really understand what this does, you have to understand the limits of the Arma2 server/client operation and how it impacted Dayz design.

Rocket wrote Dayz in a way that offloads some processing from the server to each player's computer.  Arma is notorious for not making good use of multiple CPU cores, so to handle the load of such a large amount of custom scripting, he put zombie spawning and control on player's computers.  This increases some performance aspects of the server while bogging down client machines.

 

Recently (1 year?) ago, Arma developers patched the Arma2 (and thus also Arma3) code to allow server administrators to connect clients without graphical displays (so called "Headless Clients") to their servers and offload traditional server tasks to them.  When configured and scripted properly, this is like adding CPU cores to the server and it increases server performance.

 

Most of the work up to this time has been in adapting normal AI units (not the weirdly behaving zombie scripts) to work with Headless Clients so that adding such packages as DZAI, SARGE AI, and WICKED AI would have minimal impact on server performance.

 

This set of scripts does two things:

1)  Allows tracking and dynamic connection and disconnection of any number of Headless Clients.

2)  Offloads loot spawning, zombie spawning and zombie control scripts to Headless Client control.

 

Ideally (or theoretically) it will affect Dayz overall performance in two ways:

A)  Reduce zombie positional lag

B )  Improve player computer performance and thus make the graphical performance smoother.

Link to comment
Share on other sites

Another thought, how do the normal clients get their maxlocalzombies settings? Wouldn't we need to add an else statement in the init? Something like:

if (!isServer && !hasInterface) then { // headless client processing this 
dayz_maxLocalZombies = 80; // Default = 40 // HC Sapwns Zombies in much greater numbers
dayz_maxGlobalZombiesInit = 80;
dayz_maxGloabZombiesIncrease = 20;
dayz_maxZeds = 1000;
};  
else { 
dayz_maxLocalZombies = 30; // Default = 40 //Normal Zed numbers
dayz_maxGlobalZombiesInit = 40;
dayz_maxGloabZombiesIncrease = 10;
dayz_maxZeds =1000 ;
};

Might this work?

Link to comment
Share on other sites

Another thought, how do the normal clients get their maxlocalzombies settings? Wouldn't we need to add an else statement in the init? Something like:

if (!isServer && !hasInterface) then { // headless client processing this 
dayz_maxLocalZombies = 80; // Default = 40 // HC Sapwns Zombies in much greater numbers
dayz_maxGlobalZombiesInit = 80;
dayz_maxGloabZombiesIncrease = 20;
dayz_maxZeds = 1000;
};  
else { 
dayz_maxLocalZombies = 30; // Default = 40 //Normal Zed numbers
dayz_maxGlobalZombiesInit = 40;
dayz_maxGloabZombiesIncrease = 10;
dayz_maxZeds =1000 ;
};

Might this work?

 

 

The \z\addons\dayz_code\init\variables.sqf already has initialization code with default values:

if(isNil "dayz_maxLocalZombies") then {
        dayz_maxLocalZombies = 15;
};
if(isNil "dayz_maxGlobalZombiesInit") then {
        dayz_maxGlobalZombiesInit = 15;
};
if(isNil "dayz_maxGlobalZombiesIncrease") then {
        dayz_maxGlobalZombiesIncrease = 5;
};
if(isNil "dayz_maxZeds") then {
        dayz_maxZeds = 500;

By declaring variables for the HC initialization code before the variables.sqf is call compiled, the HCs will have different values than player machines.  This "should" keep player machines from bogging down to a crawl IF all the HCs go offline unexpectedly.

 

Also, please feel free to modify the values to suit your taste.  Those values for the HC can be changed, deleted, whatever ... so you can experiment with how much of a load your HCs and server can handle.

 

I don't presently operate a test server (other than my development machine which gets loaded up with 1 player ... me), so, unfortunately, the brave admins who want to mess with this code are going boldly where no admin has gone before.

 

To be pedantic and answer your question directly, I think the idea will work, but you have a part of your code that states "}; else {" when it should be "} else{".  The extra semicolon might cause ArmA to issue you a lot of strange errors ... or it may just plain not work, ignoring your player client defaults in the "else" portion of your code and leave you frustrated.

 

There is a program called Squint that can help to figure out whether your code is legal before you try it out on a server.  I think you can find it on the armaholic website.

Link to comment
Share on other sites

Could the HC run on the same machine as the server and connect internally or would that adversely affect performance?

 

Actually, if you look closely at my initial post you can see that my server and headless client are in fact the same machine (hint: localclient[] = {127.0.0.1}; in the config.cfg and -connect=127.0.0.1 in the client startup line.)

 

 

my server startup options:

"Expansion\beta\arma2oaserver.exe" -port=2325 -cpuCount=4 "-config=instance_7_Lingor\config.cfg" "-cfg=instance_7_Lingor\basic.cfg" "-profiles=instance_7_Lingor" -name=instance_7_Lingor "-mod=%_ARMA2PATH%;Expansion;ca;Expansion\beta;Expansion\beta\Expansion;@lingor;@DayZ_Epoch;@DayZ_Epoch_Server;"

 

excerpt from config.cfg:

requiredBuild = 103718;
localclient[]={"127.0.0.1"};
 
headless client startup:  (sorry, still some steam path stuff here ... but you should get the idea)
"%_ARMA2OAPATH%\Expansion\beta\ARMA2OA.exe" -skipIntro -nosplash -showScriptErrors -noPause -client -connect=127.0.0.1 -port=2325 -nosound "-mod=%_ARMA2PATH%;EXPANSION;ca" "-mod=Expansion\beta;Expansion\beta\Expansion" "-mod=@lingor;@dayz_epoch" -cpuCount=2 -name=HeadlessClient -profiles=HeadlessClient

 

 

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

 

Performance effect:

I could write a diatribe on this, but you wouldn't read it.  So I tried to be concise.

1)  Same machine = no lag due to network speed issues.

2)  Same machine = server and client have to share computer resources.  Reduce this problem by setting cpu affinity if you notice that the server and the HC are both using same CPU(s) and there are some unused still on your computer.

     Ideally you can use the "/affinity" switch with the "start" command to assign as many cores to the server and HC as you want.  I haven't noticed that more than 2 cores per server or HC improves performance any.

     Don't forget -cpuCount=???

3)  Different machines =  possible ethernet bottlenecks or hiccups even if the server and HCs are on the same router/switch

4)  Different machines = fewer worries about CPU and memory issues.

5)  Different machines = startup synchronization problems.  I do not know of a simple way to batch file startup and shutdown across different machines.  This may take a MS network guru to address.  Worst case is that every time the server restarts you may have to login as admin and kick the HC (no kick off ... just the simple kick) until it slots into the civilian slot correctly.

Link to comment
Share on other sites

5)  Different machines = startup synchronization problems.  I do not know of a simple way to batch file startup and shutdown across different machines.  This may take a MS network guru to address.  Worst case is that every time the server restarts you may have to login as admin and kick the HC (no kick off ... just the simple kick) until it slots into the civilian slot correctly.

 

You'd use psremote command available from the Microsoft SysInternals package (it's free)

 

http://technet.microsoft.com/en-us/sysinternals/bb545021.aspx

Link to comment
Share on other sites

  • 1 month later...

I have server and client on the same machine 

8gb ram , Core i5 2500 3.3Ghz CPU 

how do you recommend me to share resources between client and server ? 
 
 
 
 

"%_ARMA2OAPATH%\Expansion\beta\ARMA2OA.exe" -skipIntro -nosplash -showScriptErrors -noPause -client -connect=127.0.0.1 -port=2325 -nosound "-mod=%_ARMA2PATH%;EXPANSION;ca" "-mod=Expansion\beta;Expansion\beta\Expansion" "-mod=@lingor;@dayz_epoch" -cpuCount=2 -name=HeadlessClient -profiles=HeadlessClient

when i write this ,  i get the following error :
211945e12c81.png

Link to comment
Share on other sites

Skyway,

 

The point to this: %_ARMA2OAPATH%\Expansion\beta\ARMA2OA.exe      is to put the path and name of your ArmA2 install.  If it is not a Steam based install, then you must change it from what I wrote because the %_ARMA2OAPATH% is a registry entry for Windows put there by Steam during normal Steam installation.

 

So, if your Arma2 directory is e.g.  D:\Program Files(x86)\Epoch Client      then substitute %_ARMA2OAPATH% with it:

D:\Program Files(x86)\Epoch Client\Expansion\beta\ARMA2OA.exe -skipintro -nosplash .......

(that is assuming that ALL the files needed to run Arma2 server or client have been installed or copied to D:\Program Files(x86)\Epoch Client)

 

You are running into more of an operating system issue and basic understanding of a modern computer than an issue with headless client setup and operation.  I suggest you examine the concepts of absolute and relative file paths to understand more about what can be done in batch files and on command lines https://en.wikipedia.org/wiki/File_path

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

 

As for sharing resources, 2 CPUs and maximum 2GB RAM for server and HC each.  I think Arma2 is hard limited to 2GB anyway.  If you keep the -cpuCount=2, then you should be ok.

Link to comment
Share on other sites

  • 2 weeks later...

When I found this post I read for the first time about this headless client.

I'm excited and want to install it on our server so.

I searched via google for a comprehensible instructions, but without success.

So we tried to install itself.

The HC files from Goober we put the folders in our mission and the mission.sqm was adjusted.

Here our Start Parameters from the batch files:

Server:

start "arma2" /min /wait /realtime /affinity 03 "Expansion\beta\arma2oaserver.exe" -port=2302 "-config=instance_11_Chernarus\config.cfg" "-cfg=instance_11_Chernarus\basic.cfg" "-profiles=instance_11_Chernarus" -name=instance_11_Chernarus "-nosplash" "-world=empty" "-skipIntro" "-noPause" "-cpuCount=4" "-exThreads=7" "-mod=@DayZ_Epoch;@DayZ_Epoch_Server;"

HC:

start "" /min /wait /realtime /affinity 0C  "E:\Headless Client\ArmA 2\Expansion\beta\arma2oa.exe" "\Expansion\beta\ARMA2OA.exe" -skipIntro -nosplash -showScriptErrors -noPause -client -localhost=127.0.0.1 -connect=localhost -port=2302 -nosound "-mod=EXPANSION;ca" "-mod=Expansion\beta;Expansion\beta\Expansion" "-mod=@DayZ_Epoch;" -cpuCount=2 -name=HeadlessClient -profiles=HeadlessClient

what to do with this red ones?

When starting the Server, i join the lobby after that i saw the HC is in the civilian slot, but without that we have started the client?

N16xh.jpg

If we start the HC, shows up an error Message, opens the console but only the Time without text.

wnsNb.jpg

Lor3d.jpg

We know that we missing something in a config, but where and what i have to put in and wich name use this config? 

?-name=HeadlessClient -profiles=HeadlessClient?

I have done everything as I could get out here and read it from the installation instructions of the DZAI-HC folder.

We need here a Helping Hand, of course we have more questions about putting other stuff on the HC.

And thanks alot to Goober for this Posting, but I miss to read how to install it exactly.

Thanks in Advance!

Ace

 

Link to comment
Share on other sites

that is alot of line to start a HC, this one below is mine see if u can learn from it.

 

start "arma2" /REALTIME "Expansion\beta\ARMA2OA.exe" -skipIntro -nosplash -showScriptErrors -noPause -client -connect=127.0.0.1 -port=2302 -nosound "-mod=EXPANSION;ca" "-mod=Expansion\beta;Expansion\beta\Expansion" "-mod=@DayZ_Epoch" -cpuCount=4 -exThreads=1 -maxmem=2047 -noCB -name=HeadlessClient -profiles=HeadlessClient

 

-name=HeadlessClient this gives the HC a name.

-profiles=HeadlessClient this makes that folder in the HC directory where you can find the RPT log

Link to comment
Share on other sites

Would be great to get this download link fixed.

 

Have been thinking about coding the same sort of thing although with multiple clients centered around the map with varying densities of spawns.  Would like to know what sort of volumes each client can handle.

 

The original post also mentions multiple headless clients.  Is there a way to get multiple clients working on a dedicated host (i.e. multiple legitimate CD keys).  Not sure when the key check occurs or if it could be rotated in the registery as a new client is brought online.

 

Ideally a startup option to provide the key as a parameter would be a nice and fairly easy solution if BIS were to be so kind to us server operators.

 

One of the biggest issues with the DayZ mod and mods with the same base is the ease players can be tracked based on zombies spawned in by them.  This may be able to help with that although, I suspect, not with a zombie train chasing someone ;) .

 

Thanks

RB

Link to comment
Share on other sites

I test in my server in work and very good FPS. 

But test server not use battleye.

 

 

I put in main server use with batteye.

I get batteye kick 20.03.2014 12:25:30: HeadlessClient (127.0.0.1:2328) a75072c41e416c064860d7ac7741c175 - #0 "HCsignal" = <NULL-object>

 
How to fix this?
Link to comment
Share on other sites

Why it work in map lingor only.

I test epoch map napf it not work.

 

Some log

 

  Error Undefined variable in expression: _target
Error in expression <!(isNull _target)>
  Error position: <_target)>
  Error Undefined variable in expression: _target
Error in expression <!(isNull _target)>
  Error position: <_target)>
  Error Undefined variable in expression: _target
Error in expression <!(isNull _target)>
  Error position: <_target)>
  Error Undefined variable in expression: _target
Error in expression <!(isNull _target)>
  Error position: <_target)>
  Error Undefined variable in expression: _target
Error in expression <!(isNull _target)>
  Error position: <_target)>
  Error Undefined variable in expression: _target
Error in expression <!(isNull _target)>
  Error position: <_target)>
  Error Undefined variable in expression: _target
Error in expression <!(isNull _target)>
  Error position: <_target)>
  Error Undefined variable in expression: _target
Error in expression <!(isNull _target)>
  Error position: <_target)>
  Error Undefined variable in expression: _target
Error in expression <!(isNull _target)>
  Error position: <_target)>
  Error Undefined variable in expression: _target
Error in expression <e = alive _agent;
_target = _agent call zombie_findTargetAgent;
 
_agent forceSpe>
  Error position: <zombie_findTargetAgent;
 
_agent forceSpe>
  Error Undefined variable in expression: zombie_findtargetagent
Error in expression <!(isNull _target)>
  Error position: <_target)>
  Error Undefined variable in expression: _target
Error in expression <e = alive _agent;
_target = _agent call zombie_findTargetAgent;
 
_agent forceSpe>
  Error position: <zombie_findTargetAgent;
 
_agent forceSpe>
  Error Undefined variable in expression: zombie_findtargetagent
Error in expression <!(isNull _target)>
  Error position: <_target)>
  Error Undefined variable in expression: _target
Error in expression <!(isNull _target)>
  Error position: <_target)>
  Error Undefined variable in expression: _target
Error in expression <!(isNull _target)>
  Error position: <_target)>
  Error Undefined variable in expression: _target
Error in expression <!(isNull _target)>
  Error position: <_target)>
  Error Undefined variable in expression: _target
Error in expression <!(isNull _target)>
  Error position: <_target)>
  Error Undefined variable in expression: _target
Error in expression <!(isNull _target)>
  Error position: <_target)>
  Error Undefined variable in expression: _target
Link to comment
Share on other sites

I know you guys are reporting problems with maps and battleye scripts. The script changes I posted to do headless client are limited in scope. I did not address map differences, but I did report on which map I developed the changes. Additionally, it is beyond the scope of my work to make it battleye compatible.

Obviously the ideas expressed in the original code need further development to fully interface with a wider variety of server configurations. I hope someone is inspired to help adopt it into a fully supported option for epoch and other dayz flavors. At this time, however, it is a working proof of concept released with tecnically proficient dayz scripters and experimental server admins as the target. I apologize if this was not well communicated during initial distribution.

If you are banging your head on your keyboard in frustration, you are not alone. I did the same, wondering how Bohemia ever got anyone to ever make mods with such stone-age tools.

Link to comment
Share on other sites

  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×
×
  • Create New...