Skip to content

Quick Start

Gulvan edited this page Sep 21, 2023 · 5 revisions

1. Install IDE and Plugins

When it comes to Haxe projects, VSCode is almost always the preferred IDE.

One also needs to install a few extensions:

2. Install Haxe

The latest version can be found here.

3. Install HashLink

This is a virtual machine for Haxe, which can be downloaded here. While the client's target is HTML5, the server targets HashLink.

4. Install required libraries

To do this, simply execute the following:

haxelib git haxeui-core https://github.com/haxeui/haxeui-core
haxelib git haxeui-html5 https://github.com/haxeui/haxeui-html5 --never
haxelib install howlerjs
haxelib git polygonal-ds https://github.com/polygonal/ds
haxelib install format
haxelib install haxe-strings
haxelib install lzstring
haxelib git argparse https://github.com/MattTuttle/argparse
haxelib git hxWebSockets https://github.com/ianharrigan/hxWebSockets
haxelib git yaml https://github.com/Gulvan0/hx-yaml
haxelib git hscript_template https://github.com/filt3rek/hscript-template

5. Clone GitHub repositories

It is assumed that Git is already installed. GitHub Desktop is also a convenient app, but having it isn't mandatory.

Both client-side and server-side repo should be cloned.

6. Create a junction for shared project core

Since both frontend and backend are written in Haxe, they share some common code. Making a separate haxelib for it was considered an overkill, so, for that purpose, junction is being used. Basically, server-side net.shared package points to a client-side net.shared package.

To create such junction, execute the following:

mklink /J "<path to local server-side repo root>/src/net/shared" "<path to local client-side repo root>/src/net/shared"

7. Create configuration files

In the local clone of the client-side repo, create file build/html5/config.yaml with the following contents:

host: localhost
port: 5000
secure: false
keep-alive-beat-interval-ms: 2500
keep-alive-timeout-ms: 10000
min-server-build: 1676305984

Analogically, in the local clone of the server-side repo, create hl/config.yaml:

host: localhost
port: 5000
keep-alive:
  beat-interval-ms: 2500
  timeout-ms: 10000
min-client-build: 1676305984
elo:
  default: 1200
  max-logslope: 7.0
  normal-logslope: 4.0
  calibration-games: 12
rules:
  secs-added-manually: 15

You can learn more about the parameters of both configs (there are actually more of them) in the respective section.

8. Start coding

After that, you're ready to go!

Client-side code can be compiled by executing the batch file located in the repository root:

./build.bat

This is also possible (and works on MacOS/Linux), but may require cache cleanup:

haxe html5.hxml

To test the result, open the build\html5\index.html page with the Live Server. You can edit the host, port and secure parameters to switch between connecting to a prod and a local server.


Server-side code can be compiled simply by using this command:

haxe build.hxml

After that, the server may be launched like this:

hl hl/app.hl -i -d -l