Jump to content

[Beta] New Kind of Headless Client


Recommended Posts

So, recently I was just browsing trough forums and I read about Headless Clients and I was like phew that would be a nice thing to have man. So I went straight to the Downloads, gave them a few Tests and decided screw this. I've seen "ARMA 2" Headless Clients using event handlers, that are for arma3 - not even sure, if they actually work in arma2 and then it's a mess (no offence thou, but it was very hard to read trough all that). Well, what Solutions did I have? Making my own one and share it with the Community to improve it to an acceptable Standard.

 

The following Video (Sound might be loud) shows an Example of the Headless Client

 

Spoiler

 

 

So, what's so Special about this...

Well first of all this works on any Map. Also it works with any Loot Table. Also it works without the need of a player. It has it's own "independent Area" where it interacts in. What I mean with that is, that you won't need to rely on any Functions, as everything that is needed is included. All Variables and Functions work outside of the normal "dayz stuff", as only the Headless Client loads it and it won't overwrite anything. Also it comes with a few features available.

 

  • You can fully customize the spawn Ratio between Zombies spawned on Buildings and in Wilderness, for Example you could have 3x as many Zombies in cities
  • You can fully customize the Loot Tables or integrate your existing ones just by changing a variable
  • You can fully customize which modules to use, like animal spawn, wild zombie spawn, building zombie spawn, loot spawn and custom spawn.
  • You can customize which Animals to Spawn
  • You can make AI Shoot at the Zombies
  • You can shuffle the Loot by setting permaLoot to false, as the server clean up will then clean it up and the hc will just re-spawn it.
  • You can ofc set how many zombies / animals / loot piles should max be spawned

 

For a full List, of available Options see the variablesHC.sqf.

 

The Performance

While you have the ability to use all those variables, you can tweak the performance of this. However, the script will only be as good as the code and I'm not perfect. I tried my best to check every tiny bit to make sure nothing ever goes wrong, but there's always that slight possibility. Also I'm not perfect and this is my very first attempt, so if I did something wrong or could've done it better just let me know. Also be carefully, when changing the Script Timers, as a to low value might impact dramatically on your FPS.

 

The Design

This Client is not meant to Tackle the common Problem of a Headless Client joining to early, etc. It is meant to be persistent, reliable and functional. It more a "spawning handler" for various things like the loot. If you want a "perfect" Headless Client this is not the thing you're searching for. This is the Basement of a Script that is living from user Input, user Feedback and user advices. It wants further improving (if possible) and optimizing (if possible). Regardless of the fact, that it is fully Stable you can however do things wrong - I personally have only limited methods to test this Client, while you or other maybe have a large player base that is willing to tackle a new world of Zombies - so.. If you find any Bug or have any more wishes just let me know.

 

The Installation

Please prepare for everything, that you'll need:

  • An Editor of your choice (OK, this was obvious)
  • Your mission.sqm (Located in your MPMissions\DayZ_Epoch_%INSTANCE%.%MAP%
  • Your init.sqf (Located in your MPMissions\DayZ_Epoch_%INSTANCE%.%MAP%
  • Your config.cfg (Usually Located in a Folder called "instance_number_mapName")
  • The Headless Client itself (See also: GitHub - Headless Client)

 

IF you do NOT have a Headless Client Installed or failed to install it before:

Spoiler

Open your mission.sqm and Press CTRL + F. That will bring up the Search. Type in the Search Box "side="LOGIC". It will jump to a Class, you will want to change that class Number and add one to it. So if you found SIDE=LOGIC in "class Item1" you will want to change it to "class Item2".


Next paste the following Code ABOVE your renamed class.

Spoiler


		class Item2
		{
			side="CIV";
			class Vehicles
			{
				items=1;
				class Item0
				{
					position[]={10154.729,0.4931505,-4593.6821};
					azimut=-17.083944;
					id=52;
					side="CIV";
					vehicle="Survivor1_DZ";
					player="PLAY CDG";
					skill=0.60000002;
					text="HeadlessClient";
					init="this allowDamage false; this setVariable ['mmHC',true,true];";
					description="HeadlessClient";
					name="HeadlessClient";
					forceHeadlessClient=1;
				};
			};
		};

 

Before you continue, check that the class name from the code that you just copied is correct. In most cases you will have to change it to "class Item1".

Once you checked everything (Did you check everything?) press CTRL + F again and search for "class Groups". It will take you to the class, where you then can locate a single Line saying "items = 2". Change this to "items = 3". NOTE: It doesn't necessary has to be items 2 for you, if you already added something else before! 


To fully isolate the HC from the rest of your files you will have to change quite a few bits and pieces in the init.sqf. Near the Middle you will see a few calls like:


call compile preprocessFileLineNumbers "init\variables.sqf";

These Lines we're going to wrap in an IF. For me the whole thing looks like:


//Load in compiled functions
if (isServer || hasInterface) then {
	call compile preprocessFileLineNumbers "init\variables.sqf";				//Initilize the Variables (IMPORTANT: Must happen very early)
};

//progressLoadingScreen 0.1;
call compile preprocessFileLineNumbers "init\publicEH.sqf";				//Initilize the publicVariable event handlers

if (isServer || hasInterface) then {
	//progressLoadingScreen 0.2;
	call compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\setup_functions_med.sqf";	//Functions used by CLIENT for medical
	//progressLoadingScreen 0.4;
	call compile preprocessFileLineNumbers "init\compiles.sqf";				//Compile regular functions
	//progressLoadingScreen 0.5;
	call compile preprocessFileLineNumbers "custom\scripts\rightclick\init.sqf";
};

You can put the "publicEH" in there to, that's totally fine, I only have it outside because I was doing something else with that to.

 

Underneath those calls we start our Headless Client:


if (!hasInterface && !isDedicated) then {
	//run on headless clients only
	
	call compile preprocessFileLineNumbers "headlessclient\variablesHC.sqf";
	
	call compile preprocessFileLineNumbers "headlessclient\compilesHC.sqf";
};

 

The next Part is finding


if (!isDedicated) then {

And replacing it with


if (!isDedicated && hasInterface) then {

 

 

The Last Bit is Optional, if you have Scripts that run on both server and client. You decide whether or not to Load them on the Headless Client, but I recommend not to. So you will want to put the bottom parts inside an IF again, for Example:


if (isServer || hasInterface) then {

	execVM "custom\scripts\weather\DynamicWeatherEffects.sqf";

	[7,true,true,15] execFSM "custom\fsm\core_time.fsm";
	
	#include "\z\addons\dayz_code\system\BIS_Effects\init.sqf"
	
};

 

 

IF you do have a Headless Client installed or managed to do so before:

Spoiler

Add This to your init.sqf


if (!hasInterface && !isDedicated) then {
	//run on headless clients only
	
	call compile preprocessFileLineNumbers "headlessclient\variablesHC.sqf";
	
	call compile preprocessFileLineNumbers "headlessclient\compilesHC.sqf";
};

 

 

The Last Step is simply to create a Folder inside your Mission named "headlessclient" (You can ofc define your own paths) and put all the HC Files into that Folder. Edit the Variables if you want to or just hop right into game and start the massacre!

 

PS: If I was unclear with the Instructions at any point let me know.

 

 

//EDIT:

Just out of interest I forced the HC to join the wrong slot, to see what happens. Apparently it can be in any slot, it doesn't differ ^^

 

Spoiler

 

 

 

 

//Edit
Apparently some files on Github got broken during the Upload, they have meanwhile been replaced.

Link to comment
Share on other sites

1 hour ago, J001 said:

noob question, how do you login as a client to the dedicated server.

Well a headless client is basically a "virtual player" who`s screen is black. In order to play the game you have to actually start it. You could do that with a batch file, so here is mine for example:

Save as "name.bat"

@echo off
start "HeadlessClient" /MIN /HIGH /B "E:\SteamGames\steamapps\common\Arma 2 Operation Arrowhead\ArmA2OA_BE.exe" 0 0 -skipIntro -nosplash -showScriptErrors -noPause -client -connect=127.0.0.1 -port=2302 -nosound "-mod=E:\SteamGames\steamapps\common\Arma 2 Operation Arrowhead\EXPANSION;E:\SteamGames\steamapps\common\Arma 2 Operation Arrowhead\@DayZ_Epoch1051" -cpuCount=2 -name=HeadlessClient -profiles=HeadlessClient

 

The main Important things are "-client" and "-connect"

 

//Edit:
You could also you a c++ Library to start the HC whenever somebody connects.

Link to comment
Share on other sites

3 minutes ago, J001 said:

ViseVersa

Thank your for your reply, i just tested it. and i had this message "signature timeout" by battleye and You were kicked off the game., any info how to solve this

 

You might want to validate your client files trough steam and also make sure, that you've started the game at least once.

If you've done those steps and it didn't help you still have to option to turn signature checks out in your config.cfg by changing "verifySignatures" to 0.

Link to comment
Share on other sites

15 hours ago, J001 said:

Ok, thanks ViseVersa, i changed verifysignatures to 0 and now its loading.

One more question, is it possible as you in the video, to login as a HC player to that CIV slot?

 

In the Video I've logged in as normal Player. It's the headless Client, that joined the Civil Slot. The HC was started from a c++ library in that Video, which is why it started automatically. Originally somebody wanted to give me Money for that Library, which is why it's not included, because it would've been unfair to let somebody pay for it while everybody else get's it for free.

Link to comment
Share on other sites

  • 3 weeks later...
  • 1 year later...
  • 2 months 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
  • Discord

×
×
  • Create New...