# Towards

Game engine built as a modular monolith.

## Building

### Locally
Dependencies:
- Conan 2 (`pipx install conan`, or `pip install conan`)
- Vulkan SDK

The Vulkan SDK must be installed before building. Do not forget to set PATH on Windows.

On Linux, Conan builds SDL2 from source and still needs the system OpenGL/X11/Wayland/ALSA development headers present.

First time only, create a Conan profile describing your compiler:

```bash
$ conan profile detect
```

Install the pinned dependencies and generate the CMake toolchain + presets:

```bash
$ conan install . --output-folder=build --build=missing -s build_type=Debug
```

Configure and build using the generated preset:

```bash
$ cmake -S . -B ./build -DCMAKE_TOOLCHAIN_FILE="build/conan_toolchain.cmake" -DCMAKE_BUILD_TYPE=Debug
$ cmake --build ./build
```

For a release build, repeat both steps with `-s build_type=Release` and the
`conan-release` preset.

There are now two executables:

Server is at `build/modules/client/mmo_server`

Client is at `build/modules/client/mmo_client`

First run the server, so that client can connect. The server will try to use port 8080, but if it is already occupied, it will try use the next free higher one.

### Docker

It also possible to build the project using Docker. Advantage is that you do not have to set up the environment. The current Dockerfile also uses older linux distribution to be backwards compatible with older systems. To build everything, build the Dockerfile at `docker/Dockerfile` with until target `builder`:

```
$ docker build -f docker/Dockerfile --target builder -t tw_builder:jammy .
```

To easily export the built executables, run the target `export` of the same Dockerfile.

```
$ docker build -f docker/Dockerfile --target export --output type=local,dest=dist .
```


## Running

### Server

To run the system as inteded, run the `tw_server` executable first. It should output something like this:

```
[2026-08-05 16:43:53.806] [info] quicr-port=8101 cluster-port=8102 timescaledb=disabled
[2026-08-05 16:43:53.807] [info] Running on port: 8101
[2026-08-05 16:43:53.807] [info] ZoneClusterLink listening on port 8102
[2026-08-05 16:43:53.810] [info] Registered as zone 1 (-5000,-5000) (0,5000)
```

Note the `Running on port: 8101` as it reports on which port it is currently running. Use it when connecting the clients.

### Client

Run the `tw_client` for connecting to the game. It should open into a lobby, where you can input an address of the server. It should remember the last address used and you can make some favourites. This is useful for testing on multiple cloud instances for example.

### Mock Client

The `tw_mock_client` module is for stress testing the server. It simulates 300 connected clients and moves them randomly. All those simulated players are actual established connections, which means the bandwidth of the server will be accurate.


