Through this PHP programmed website you are watching, pilots and commanders each side can check the front and all information related to the battle, clicking through here Campaign and entering the corresponding key. But how does it really works? And how is this web project installed? How does it communicates with the machine launching the mission...? Let us see.
WARNING! Minimal knowledge of PHP and general operation of a web server like Apache are assumed.
It should be noted that the web began as a circustancial support to the campaign and finally has become basic. The campaign could function without the web but it allows you to visually explore the battlefront and schedule orders and movements, which have become an almost indispensable tool. Therefore, because it was born as a simple unpretentious tool and was developed in a record time, it is not as complete as it should, and its development as a "web" is quite poor, as it is programmed with only 2 or 3 php modules without frameworks ... it is a shame for any professional web developer :)
First thing is to download the website from the download section here and uncompress it on your local htdocs root directory (if you have a home apache + php installation) or in any other place to understand what comes next.
Once it is decompressed, go to the proyects root directory and find a configuration file called:
Open it and you will see a number of global variables that are used throughout the project. The variables that you can modify to suit your needs are:
$CFG_LANGSAn array of available languages and their names.
$CFG_LANGString with default language.
$CFG_URL_HOMEAbsolute URL where the project is hosted, including the ending slash, for example: http://www.mydomain.com/hrcodwar/
$CFG_CLAVE_ACEPTA_ENVIOSThe key used to communicate the IL2 Cliff of Dover game server and this website. It must be the same as the
web_script_passwordof its conf.ini.
$CFG_DIR_DATOS_BATALLAThis is the path that refers to the directory where all sensitive data referring to the current campaign are stored. Note that the directory should not be accessible via http because a simple typing change in the url could allow to download files and spy enemy data.
$CFG_DIR_ORDENESIt is the path of the directory where the web programmed orders are stored. Obviously here we must have the same concern about security as before.
$CFG_CLAVE_ROOTIt is the general admin password, the one who can enter the Campaign Configuration section here, and change the strategic map passwords both for troops and commanders.
$CFG_MAPAIt is the name of the background picture of the strategic map, located in the web proyect directory /maps.
$CFG_MAPA_COORD_INI_XBattle Area initial "x axis" coordinates. It is the highlighted value in the BattleArea line in the hrcodwar.mis
$CFG_MAPA_COORD_INI_YBattle Area initial "y axis" coordinates. It is the highlighted value in:
$CFG_MAPA_COORD_FIN_XBattle Area ending "x axis" coordinates, are the sum of
CFG_MAPA_COORD_INI_Xand the highlighted value in:
$CFG_MAPA_COORD_FIN_YBattle Area ending "y axis" coordinates, are the sum of
CFG_MAPA_COORD_INI_Yand the highlighted value in:
$CFG_MAPA_LONG_SECTORIt is the length of a single sector, as defined in the battle area, set by the value:
$CFG_N_CENTRALES_POR_BANDORequired minimum number of power plants per side. Its value should match with
numero_centralesin the conf.ini.
$CFG_N_TURNOS_REPARACION_FABRICASNumber of turns needed to rebuild factories and shipyards. Its value should match with
reconstruccion_fabricas_jornadasin the conf.ini.
$CFG_N_TURNOS_REPARACION_REFINERIASNumber of turns needed to rebuild refineries, value set by
$CFG_N_TURNOS_REPARACION_CENTRALESNumber of turns needed to rebuild power plants, value set by
$CFG_PRECIO_PUNTO_CREACIONReference purchase price of Creation Points according to international markets, value set by
$CFG_DISTANCIA_UNIDADES_CERCANASThe visibility in meters of each identity to make recons.
As you have read before, it is very important to name correctly the directories
$CFG_DIR_ORDENES and its location. It is also a very common mistake in those web installations where external data is received, not to grant permissions for the anonymous user in the place where it is supposed to be stored. The web server (Apache or IIS or whatever) operates as an anonymous user when it runs the script and records the data in the directory. Therefore, you must ensure that the server directories allow writting to all users or the scripts will fail receiving data when the game ends.
As we have explained before, the map shown in the Running Campaign section here must be stored in the directory with the same name /mapas, wich is the same name you saved in
$CFG_MAPA in the config.inc.php. The map is The map is closely related to the battle area defined in the hrcodwar.mis.
The lower left corner must match with the battle area coordinates you set in
$CFG_MAPA_COORD_INI_Y, and the upper right corner must match withe
Creating the map shown in the running Campaign is very easy. Simply take screenshots of the map in the mission editor of the game (remember to always use the same zoom level!) covering the whole battle area, and merge them all into a single image using your favorite image editor program.
Using high zoom levels will produce accurate maps in your screen, but you will need several screenshots to assemble the puzzle. Using low zoom level will make it difficult to show accurate coordinates in your screen. You will have to decide it depending on the size of the battle area you have chosen.
No matter the zoom level you choose, the really important thing, is that the lower left corner and the upper right corner must match EXACTLY with the coordinates we have explained before, otherwise all the objects in the map as airfields, factories, etc... will be shown in a wrong place.
There is a directory named /datos_sistema. You must write there the same data you will have in the server computer, in a directory with the same name (missions/hrcodwar/datos_sistema). These are the json configuration files that, along with the conf.ini are used to run the campaign set its rules and conditions. Any change you want to make in a yet running campaign must be written here too, otherwise the web will show wrong information.
Passwords are stored in a .ini file in the
$CFG_DIR_DATOS_BATALLA, called claves.ini. If you open it you will find something like this:
; Password to web access CFG_PASS_ALIADO = CFG_PASS_EJE = CFG_PASS_ALIADO_COMANDANTE = CFG_PASS_EJE_COMANDANTE =Variable meaning:
$CFG_PASS_ALIADOUniversal Allies Troop Password.
$CFG_PASS_EJEUniversal Axis Troop Password.
$CFG_PASS_ALIADO_COMANDANTEThe Commander Password defined by every allied squad must begin with their TAG and must be separated by commas so that it is possible to identify them. For example, two squads flying in using tags like SQUAD1 and SQUAD2, should have passwords like this: SQUAD1_password1, SQUAD2_password2
$CFG_PASS_EJE_COMANDANTEThe same for the Axis.
$CFG_CLAVE_ROOTin the config.inc.php.
Passwords are stored and sent using plain text format, so they are not very secure. Maybe, in future versions they will be encripted.
The campaign system communicates with the web twice, first when loading the mission and later when it is over. Let us see what happens in each connection.
To allow communication between the server computer and this web, the following variables must be set:
$CFG_CLAVE_ACEPTA_ENVIOScreating a password that shall be checked in every operation.
[GENERAL]section. They control this communication:
web_activa_soporte = true
web_script_url = http://[ url to the web proyect ]/ajax/services.php?a=datos
web_script_clave= the same password that the one stored in
And that is all. If a communication failure with the server happened, the game would continue without trouble, simply the pending orders would not be received nor the data would be sent at the end of the game. However, there is a manual way to refresh them.
At the end of the battle, all data to be sent to the web are saved by the campaign in /datos_batalla/web, The web administrator can manually upload them via FTP in his working directory, obtaining the same result. Easy! :)