Jump to content

Working Dayz Epoch Headless Client for Zed Spawn and FSM


Goober

Recommended Posts

One quick question, How do you overcome the CD Key issue?

 

 From what I am reading, you have to own two complete copies of the software to run HC, and to play on the same machine.

 

Is there a way around this?

You could use a banned valid key for the server then your current key for the headless client.

Link to comment
Share on other sites

This is a fairly involved subject and there are various approaches.  I have tried a few and have come to my own conclusion in terms of what works best.

 

  1. Run everything from the HC.  You can get most function to work, but a pure HC only implementation will not work properly with a lot of functions from the various mission systems.  Especially when it comes to spawning objects into the game, and for those objects to persist.  In some cases you can get around this using anti-hack tweaks but that will weaken your protection.  This method also requires a lot of battleye exceptions, also not good.
  2. Run everything from server (ie, normal mission pack install) and use setOwner to assign the AI units to the HC.  Played with this option briefly, but has some known game engine limitation, such as waypoints being lost.
  3. Hybrid.  Run most code from HC, and offload certain tasks (such as spawning objects) to the server.  I used this method with reasonable success for some time but ultimately is more complicated and error prone than the next option.
  4. Hybrid.  Run the mission system from the server, and execute AI modules from the HC.  This for me has been the most stable method by some margin and allows all typical features to be used.  It requires very few (if any) anti-hack bypasses, all the mission logic runs on the server (which is usually as per the design of the mission pack) and only specific scripts are executed on the HC.

 

With the hyrbid options you do need to build a basic framework to enable the server and HC to work together well.  This is what I have done at a high level:

 

On the server

  • I took Goobers server side HC detection routine and adapted and simplified for my needs.  His code was better in that it could cope with multiple HCs however it did have some bugs.  Since multiple HC is a very niche requirement I decided to re-write it slightly but with the ability to detect only a single HC.  This is not a problem unless you plan to have over 200 AI (maybe more) and also would suggest you are running HCs from various machines (as you can only really run 1 per windows instance easily).
  • I installed and configured a mission pack of choice in the normal way in my server PBO.  Currently for me that is Wicked AI 2.1.x.
  • I then adjusted various elements of the mission logic so that it would check from the presence of an HC (see first point) and only start a mission if a valid HC existed.  Hint, there is more to this than just having an HC connected to the server, you also need to know that the HC has had a chance to precompile the necessary scripts.
  • I then modify all of the scripts that define the functions for spawning AI so that rather than actually doing anything, they parse all the parameters received from the original spawn request in the specific mission file and send it to the HC using <ID> publicVariableClient [spawn parameters]
  • I also do something similar for certain functions such as those that clean up AI when missions end (this bit is more complex, but not that bad actually).
  • You also should setup a routine on the server (mine runs every minute) that counts AI units controlled by the server and immediately deletes them.  This is because if the HC crashes whilst managing AI, the AI will remain and their control passes back to the server, instantly killing you server FPS!

On the HC

  • First, everything that runs on the HC does so via a specific client side addon (PBO) that I have signed with my own key.  They key is enabled on my server, so in theory anyone could connect to my server and run my addon, but I dont release my signed addon to the public so its a non-issue (unless i get hacked of course.  and by hacked this isnt an arma2 hacked, it would be a "proper" hack (well correct term is crack) of my dedicated server).  This way, the only reference to my HC anywhere in the mission file that all players download is a single statement in the init.sqf that checks for a !hasInterface and runs \z\addons\macdogHC\init.sqf.
  • First thing is to get the HC side of Goobers HC detection/management code installed in the custom HC addon described above working.  This is to let the server know an HC is attached, and I have adapted it for my purposes somewhat.
  • Then I install and configure the mission pack in my custom addon, making sure to set the configuration options that affect AI as I want them in the config file.  Then disable the actual mission system, so when launched (ie, via \z\addons\macdogHC\WAI\init.sqf) doesnt actually start launching missions.
  • I then setup a bunch of publicEventHandlers so that when the server executes a <ID> publicVariableClient spawn_group for example, the HC will run \z\addons\macdogHC\WAI\compile\spawn_group.sqf with the parameters originally specified in the specific mission definition running on the server.
  • I have to do something similar for the mission clean up scripts as I alluded to in the server section above, but this is more selective.

And that's it really.  It works very reliably IMO, yes very occasionally Arma2OA.exe can crash, and I don't have a monitoring system in place to detect and relaunch the client.  So if I don't spot it (usually the case now as I have alomst zero time for epoch these days) there are no missions until next restart.  I used to have the HC running as a service which did address this, but the move to steam only has really made running the client in a server like way much more difficult so I have to run the client interactively which is a shame.

 

I also have animated heli/c130 crashes running of the HC.  They dont suffer from the stutter that you get when you run them server side, and are indistinguishable from player flown aircraft.  I used to have jet crashes run this way, but it meant white listing them in my anti-hack.  I could have edited infistars code to allow the jet crashes but still catch illegal jet spawns, but would require me tinkering every time he released a new version so was just too much effort.

Hey macdog, would you be able to release your version of the AI HC?

 

Thanks

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...

I'm currently having an issue the HC i am trying to set up on my test-server. Seems like this was one of the few "proper" HC threads so might as well post here.

 

Whenever he connects he is instantly getting kicked off again. (and then it just keeps retrying)

Checked the local .RPT and this seems to be whats causing it:

Exe timestamp: 2014/07/17 03:35:12
Current time:  2014/12/05 08:08:00

Version 1.63.125548
Starting process failed.
//further down after Updating base class...
Warning Message: Picture dayz_logo_ca.paa not found
Warning Message: Files "C:\Program Files (x86)\Steam\SteamApps\common\Arma 2 Operation Arrowhead\@DayZ_Epoch\addons\aif_napfobjects.pbo", "C:\Program Files (x86)\Steam\SteamApps\common\Arma 2 Operation Arrowhead\@DayZ_Epoch\addons\asc_eu_lights.pbo", "C:\Program Files (x86)\Steam\SteamApps\common\Arma 2 Operation Arrowhead\@DayZ_Epoch\addons\buildings3.pbo", "C:\Program Files (x86)\Steam\SteamApps\common\Arma 2 Operation Arrowhead\@DayZ_Epoch\addons\csj_gyroac.pbo", "C:\Program Files (x86)\Steam\SteamApps\common\Arma 2 Operation Arrowhead\@DayZ_Epoch\addons\dayz.pbo", "C:\Program Files (x86)\Steam\SteamApps\common\Arma 2 Operation Arrowhead\@DayZ_Epoch\addons\dayz_anim.pbo", ... are not signed by a key accepted by this server. To play on this server, remove listed files or install additional accepted keys.

No real errors in the server .RPT.

Now i do of-course have the dayz_epoch1051.bikey in the \serverdirectory\keys folder.

This is the command line i am using to start the HC:

start "arma2HC" /min arma2oa_be.exe 0 0 -skipintro -nosplash -noPause -client -connect=127.0.0.1 -port=%ServerPort% -nosound -cpuCount=2 -name=Server -password=123 "-mod=@DayZ_Epoch"

And the server is being started with this:

start "arma2" /min "%ServerExecutable%.exe" -cpuCount=%ServerCores% -maxMem=%MaxMemory% -port=%ServerPort% "-config=%ServerSettings%\config.cfg" "-cfg=%ServerSettings%\basic.cfg" "-profiles=%ServerSettings%" -name=%ServerSettings% "-mod=%ServerMods%"

Used this tutorial here to originally set it up: https://github.com/DavidFrendin/epoch-hc

It's late and I just can't seem to see where I've gone wrong  :rolleyes:, any help would be much appreciated.

 

EDIT: FIXED IT - I seemed to have touched @DayZ_Epoch in a way that broke it for the HC, but server still used it fine..

Link to comment
Share on other sites

Hi Markokil, so did you get this working then? just following that tutorial? Are you live with it?

 

thanks

 

Yeah i did get it working, only thing i did was follow that tutorial and make some minor changes on the way. However just the tutorial should be fine.

My problem was that i had deleted dayz_logo_ca.paa and some other things from @DayZ_Epoch which were not necessary for our servers, but were required for the HC and they were both using the same @DayZ_Epoch.

Just reinstalled @DayZ_Epoch and all was fixed.

Link to comment
Share on other sites

Thanks. Sorry, but right now I don't even have time to manage my server properly let alone this. What I can do is send you the code and answer questions about how it all works etc.. Happy for you to then maintain the HC branch. I actually don't think it would add much overhead to maintain both, and eventually I think you could get to this being a add-on module configured from the global condig file all under the single master branch.

Would you mind sharing a bit of code with me? Pm is fine if you want.

"I took Goobers server side HC detection routine and adapted and simplified for my needs. His code was better in that it could cope with multiple HCs however it did have some bugs. Since multiple HC is a very niche requirement I decided to re-write it slightly but with the ability to detect only a single HC. This is not a problem unless you plan to have over 200 AI (maybe more) and also would suggest you are running HCs from various machines (as you can only really run 1 per windows instance easily)."

Is what I'm looking at. I had done this once before but I have lost everything from the last HC attempt.

Link to comment
Share on other sites

On config.cfg, the setting localclient[] = {"127.0.0.1"}; make MinError zero to all clients on the same machine of the host! I believe i can now put the HC on china and make it spawn bots on USA.

I have not used this setting by default because i was not able to figure out its purpose!

Son of a Daughter Headless Clients on the way!

How does it count a HC in China as localhost exactly?

Link to comment
Share on other sites

Man, Headless clients is just a way to sell more Keys. Without real support from the BI devs, and yes, they do not give any real support on that, it just make things worse than better.

 

Just for connecting the headless client i already lost 10 fps on server.

 

Until now i'm running HC on the server machine, 2 cores for the server and 2 cores for the HC.

 

Not sure why, but now i will try to run then on different machines, even if they are separated by a 200 ms latency.

Link to comment
Share on other sites

HOLLY DOLLY CRAP! The problem all the time was:

 

My "dedicated" server is not a dedicated server... this means i can't use 100% of it's processor power! So when i turn on HC, i LOST performance in all ways, because i hit the limit! (the server alone already consumes 100% of the processor power directioned to me).

 

Made a proper test in a real dedicated (my computer) and it was awesome! Back on road! With releases!

 

Long Live HC!

 

DZMS with 15 missions and 384 bots! Bots fast as hell! FPS perfect!

Link to comment
Share on other sites

Hi,

 

I have a .bat file to start the Server and the HC.

 

If i run the .bat file using Windows Task Manager, the HC stay stuck in the loading screen, back to looby, and keep trying to connect forever, without success. If i look at the db, i see a HC login attempts in player_login table wich a CharacterID of 0.

 

If i run the .bat file manually, double clicking in it, the problem does not happens, the HC connects and everything is ok.

 

I run player monitor on the HC client.

 

Anyone having this problem?

 

Thankyou.

Link to comment
Share on other sites

Hi,

 

I have a .bat file to start the Server and the HC.

 

If i run the .bat file using Windows Task Manager, the HC stay stuck in the loading screen, back to looby, and keep trying to connect forever, without success. If i look at the db, i see a HC login attempts in player_login table wich a CharacterID of 0.

 

If i run the .bat file manually, double clicking in it, the problem does not happens, the HC connects and everything is ok.

 

I run player monitor on the HC client.

 

Anyone having this problem?

 

Thankyou.

Share your Bat please, my HC wont event connect to my server o.O

Link to comment
Share on other sites

My .bat file:

 

@echo off
 
tasklist | find "arma2oaserver.exe"
if "%ERRORLEVEL%"=="0" Goto end1
timeout 5
start "arma2" /high "C:\servidor_hc\Arma 2 Operation Arrowhead\arma2oaserver.exe" -port=2302 -noPause -nosound "-config=instance_11_Chernarus\config.cfg" "-cfg=instance_11_Chernarus\basic.cfg" "-profiles=instance_11_Chernarus" -name=instance_11_Chernarus "-mod=@DayZ_Epoch;@DayZ_Epoch_Server;"
:end1
 
tasklist | find "ArmA2OA.exe"
if "%ERRORLEVEL%"=="0" Goto end2
timeout 5
start "arma2hc" /normal "C:\Program Files (x86)\Steam\steamapps\common\Arma 2 Operation Arrowhead\arma2oa_be.exe" 0 0 -port=2302 -noPause -nosound -skipintro -nosplash -client -connect=127.0.0.1 "-mod=@dayz_epoch;" -name=HeadlessClient -profiles=HeadlessClient
:end2
 
 
tasklist | find "Bec.exe"
if "%ERRORLEVEL%"=="0" Goto end3
timeout 5
start "Bec" /normal "c:\servidor_hc\Bec\Bec.exe" -f Config.cfg
:end3
 
Exit
Link to comment
Share on other sites

I found that when the HC does not connect its because its stuck on player_monitor.fsm on the state Loading, at the very begining, waiting for the global variable bis_fnc_init to be not nil.

 

This is the condition making the HC stuck:

!isnil "bis_fnc_init"

The HC stuck because bis_fnc_init, for some reason, stay allways nil.

 

I found the bis_fnc_init is defined and set to true in the file dayz_code\system\ca\functions\init.sqf, but i'm not sure how this file is executed... So i don't know why it's not executing.

waitUntil {!isNil "BIS_MPF_InitDone"}; //functions init must be after MPF init
BIS_fnc_init = true;
Link to comment
Share on other sites

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...