Skip to content

Commit

Permalink
Merge branch 'main' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesIves committed Jul 15, 2024
2 parents 81bf4e3 + 3951cea commit dcd2e35
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docker-compose.local.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
services:
hlds:
build:
context: .
args:
- GAME=${GAME}
volumes:
- "./config:/temp/config"
- "./mods:/temp/mods"
ports:
- "27015:27015/udp"
- "27015:27015"
- "26900:2690/udp"
environment:
- GAME=${GAME}
command: +maxplayers 12 +log on
50 changes: 50 additions & 0 deletions docs/BUILDING_AN_IMAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Building an Image

If you want to build an image yourself, follow the steps below. This can be useful in cases where you want to make changes to the build scripts or add custom functionality. It is also useful for testing changes before submitting a contribution to the project.

1. Clone this project locally.
2. Define the game you want the server to run. You can do this by setting an environment variable on your command line.

```bash
export GAME=cstrike
```

Before continuing to the following steps, verify that the environment variable is set by running `echo $GAME` in your terminal. It should send back the variable you just set.

> [!TIP]
> Available options include the following, these names are recognized by the `app_set_config 90 mod` command in `hlds.txt`.
>
> - `valve` ([Half-Life Deathmatch](https://store.steampowered.com/app/70/HalfLife/))
> - `cstrike` ([Counter-Strike](https://store.steampowered.com/app/10/CounterStrike/))
> - `czero` ([Counter-Strike Condition Zero](https://store.steampowered.com/app/80/CounterStrike_Condition_Zero/))
> - `dmc` ([Deathmatch Classic](https://store.steampowered.com/app/40/Deathmatch_Classic/))
> - `gearbox` ([Half-Life Opposing Force](https://store.steampowered.com/app/50/HalfLife_Opposing_Force/))
> - `ricohet` ([Ricochet](https://store.steampowered.com/app/60/Ricochet/))
> - `dod` ([Day of Defeat](https://store.steampowered.com/app/30/Day_of_Defeat/))
> - `tfc` ([Team Fortress Classic](https://store.steampowered.com/app/20/Team_Fortress_Classic/))
3. Build the image.

```sh
docker compose -f docker-compose.local.yml build
```

4. If you want to modify the server startup arguments, you can provide a `command` property within `docker-compose.local.yml`; [for a list of available arguments, visit the Valve Developer Wiki](https://developer.valvesoftware.com/wiki/Half-Life_Dedicated_Server).

> [!NOTE]
> In most cases, you'll need to specify `+map` for the server to be joinable.
```yml
services:
hlds:
command: +maxplayers 16 +map cs_italy
```
5. Start the image. Once the Half-Life Dedicated Server client starts, you'll receive a stream of messages, including the server's public IP address and any startup errors.
```bash
docker compose -f docker-compose.local.yml up
```

6. Connect to your server via the public IP address by loading the game on [Steam](https://store.steampowered.com/). To play, you must own a copy of the game on Steam.
7. _Optional_: If you want to start a custom mod, you can modify your `$GAME` environment variable once the image is built before running `docker compose -f docker-compose.local.yml up`. This allows you to add custom scripts to the server image while telling the dedicated server client what mod to use.
19 changes: 19 additions & 0 deletions docs/CUSTOM_MODS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Custom Mods

If you want to run a custom mod, you can do so with the `mods` directory.

> [!NOTE]
> The startup examples posted in the project README already have this directory volume mapped accordingly. If you've strayed from the suggested setup, [please refer back to it to get started](../README.md).
1. Create a folder called `mods` that lives alongside where you would normally start the server process.
2. Add your mod files as a sub-directory of `mods`. For example if the mod name is `decay`, you'd place it in `mods/decay`.
3. Define the `GAME` environment variable for your mod name. The dedicated server client will use this to ensure that it starts a server for the correct mod, which corresponds with the directory name that was just created.

```bash
export GAME=decay
```

4. Start the image as you normally would, either with `docker run` or `docker compose up`. Most Half-Life mods require specific startup arguments. For more details, refer to the [Valve Developer Wiki](https://developer.valvesoftware.com/wiki/Half-Life_Dedicated_Server) and the instructions for the mod you're trying to run.

> [!TIP]
> When using a pre-built image, you'll likely want to use the `valve` image (`jives/hlds:valve`), but this ultimately depends on the mod.
17 changes: 17 additions & 0 deletions docs/SERVER_CONFIGS_AND_PLUGINS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Configs and Plugins

If you wish to add server configurations, such as add-ons, plugins, map rotations, etc, you can add them to the `config` directory.

> [!NOTE]
> The startup examples posted in the project README already have this directory volume mapped accordingly. If you've strayed from the suggested setup, [please refer back to it to get started](../README.md).
Any configuration files will be copied into the container on start from the `config` directory and placed within the folder for the specified game. For example, if you set the game as `cstrike`, the contents of the `config` folder will be placed within the `cstrike` directory on the server.

> [!TIP]
> As an example if you have `config/mapcycle.txt`, on the server that will be placed in the `hlds/cstrike/mapcycle.txt` directory which is where the Half-Life Dedicated Server client expects these types of files to be placed. You can use this to install server plugins such as AMX Mod, Meta Mod, etc, as the directory can handle nested folders too, for example these can be placed in `config/addons/amxmodx` etc.
1. Create a folder called `config` that lives alongside where you would typically start the server process.
2. Add your config files to the directory.
3. Start the image as you normally would, either with `docker run` or `docker compose up`.

For a list of all the available server configuration types, [refer to the Valve Developer Wiki](https://developer.valvesoftware.com/wiki/Main_Page).

0 comments on commit dcd2e35

Please sign in to comment.