Jump to content

Headless Client Guide and Tips


BACONMOP

Recommended Posts

Since there are so few sources on getting Headless Client to work for Arma 3 I thought that I would make a topic about it here with hopefully some helpful links and tips. please feel free to ask any questions or post any tips that you have here.

So first off here are a few links that I found to be the most useful.

 

The BIS wiki on headless client - https://community.bistudio.com/wiki/Arma_3_Headless_Client

 

and the PDF from clearbackblast - http://www.clearbackblast.com/Files/HCtutorial.pdf

 

the clearbackblast is a little dated but still very useful.

 

For now I will just be using I&A as the example for setting up your mission for headless client. This means Headless Client controlling AI spawned from script. For AI placed in the editor I would recommend reading the tutorial from clear backblast

 

The very first thing that you will need to do is in the editor place down the Headless Client unit and make it playable. It is under the virtual entities unit type.

 

So first off you will need to tell the server to be able to run the mission with or without the headless client connected to the server. If it is a simple mission that handles all of the scripts from one main init.sqf you will want to put this block of code in

 

if !(hasInterface or isServer) then {
HeadlessVariable = true;
publicVariable "HeadlessVariable";
execVM "Script_to_run_on_HeadlessClient.sqf";
};

 

However in case of a more advanced mission like I&A that spawns in AI from sqf's further down the line you will want to make that block of code look like this 

 

if !(hasInterface or isServer) then {
HeadlessVariable = true;
publicVariable "HeadlessVariable";
};

 

You may want to put that block into a sqf that handles scripts for clients that run on the player's local machine.

 

In case you are setting up a Headless Client for something more similar to I&A you will want to now put this block in to where you would normally spawn in the AI

 

if (isServer) then {
if (isNil "HeadlessVariable") then {
execVM "Script_to_run_on_HeadlessClient.sqf";
};
};

 

 

 

I&A uses this exact block

 
if (isServer) then {
if (isNil "HeadlessVariable") then {
hint "works";
_enemiesArray = [currentAO] call QS_fnc_AOenemy;
};
};

 

That should do it for setting up the mission for headless client to use AI spawned from script. Now we will have to set up the server and Headless client itself.

 

First what you will need to do is create a batch file for the client to launch the Headless Client. So create the batch file in the same folder that your server is in as long as there is an arma3.exe file there. in the batch file put this line in with your server's ip and port numbers.

 
arma3.exe -client -connect=127.0.0.1 -password=YourServerPassword −cpucount=2 −nosound −mod=ModsForHCtorun
 
in your server config file you will need to put in this line
headlessClients[]={"127.0.0.1"};
 
That should be it for getting Headless Client up and running. Please leave any questions that you have and if you have any tips please post them as well.
 
If you have set everything up correctly the headless client should connect to the server and be put into its slot automatically a few seconds after joining the server.
 
A few important notes are that the Headless Client slot and client will only be visible when you are logged in as admin.
The second is that headless client will not solve all of your problems and you will still need to find the right balance of things that are passed off to the Headless client and things that stay with the server.. 
Link to comment
Share on other sites

Something that I found out today while trying to release an update is that if you try to put in dialog boxes with something like an ok button to continue(i.e. an intro popup placed in the initPlayerLocal) the headless client will get hung up on it because it can't press ok. So you will have to come up with some way to pass the headless client through. What I did was to call up the dialog box to all clients then put in this block

 

if (isServer) then {
if (isNil "HeadlessVariable") then {
closeDialog 1;
};
};
 
This still needs some testing on our server with the headless client though at the time of posting this I think it should work fine.
 
THIS MAY NOT WORK. look a couple posts below.
Link to comment
Share on other sites

So after a bit of testing it would seem that if the Headless Client joins a mission in progress with the block of code in an innitPlayerLocal it seems to but out and the Headless Client does not seem to create things globally. I need to do a bit more working on this and see if I can figure out a way to not have this happen. Or it may still be a thing with the dialog boxes(but i think it's the innit thing).

Link to comment
Share on other sites

  • 7 months later...

Just wanted to inquire about this process.

 

Do yall currently run a Headless client for I&A Servers?  I am curious about how to set this up for my own server that is being hosted but wanted to run the headless client from a machine at my house.  

 

Getting a little confused about the whole process in general.  Still reading over some guides but just wanted to see if yall were utilizing it currently and if you had any insight as to how it should be ran with a hosted server but a local client.

 

 

SO in regards to your line above ----

 

 

if (isServer) then {
if (isNil "HeadlessVariable") then {
hint "works";
_enemiesArray = [currentAO] call QS_fnc_AOenemy;
};
};
 
 
You have the headless client unit on the map,  and its named HC... But im also a little confused by this line...
 
   if (isNil "HeadlessVariable")
 
Would this need to read -    if (isNil "HC")   - or dies it not matter what the headless client unit is named in the editor/map?
 
 
In the current init.sqf,  do you simply just add this at the bottom? Considering i dont see this code in your current version of the init.sqf file,  im just wondering if this was placed elsewhere instead.

 

Thanks

SQIRL

Link to comment
Share on other sites

ok,  I "Think" I got the headless client set up using the code that you posted as to what yall use and its running on a second computer.

 

HC is connected and what not,  but it doesnt seem to be actually doing anything.  The server performance looks great right now...getting 48 fps server side when using monitor 10

 

Is there a way to confirm the HC is actually controlling anything?  The cpu usage on the HC Client is only 4-5% but we are seeing just normal troop warping around like the server is under heavy lag or something.

Link to comment
Share on other sites

Totally sorry about that.  I saw the topic was pinned so i thought this was still relevant. :(

 

Back to digging around :)

 

Was just re-examining the current download again,  and dont see where the HC is setup.   I had been working on this version already but never saw the code in the init.sqf which is why i was wondering if its currently in use.  (not sure where the param option would be to enable it.  the other config params in the description.ext i see,  but not a hc.)

 

Was this configured in a different file?

 

edit - ok a bit of an idiot here... Every example kept pointing to putting this info in the init.   i just noticed you have an actual headless.sqf.  in a different folder.  should i assume this is where its coded and move on? lol

 

Also, is there a way to confirm its doing its job?  one of the videos showed tons of popup info in the upper right when the client was taking over something.  should i see this when logged in as admin as well?

Link to comment
Share on other sites

  • 6 months later...
Sqirl, This post is out of date. I believe the current version of I&A has HC intergration built in already. I think i had got it working. It is a pain in the ass. I think it is a parameter option in the 2.83 versions

 

Could you clarify this parameter option?

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
  • Forum Statistics

    11.1k
    Total Topics
    66.4k
    Total Posts
×
×
  • Create New...