-
Notifications
You must be signed in to change notification settings - Fork 811
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Example using Xonotic Dedicated Game Server
Utilises Xonotic.org's open source game to build and run an actual game on Agon. Closes #18
- Loading branch information
1 parent
fb11d70
commit 4c3c83e
Showing
7 changed files
with
359 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM debian:stretch | ||
|
||
RUN apt-get update && apt-get install -y unzip curl | ||
RUN useradd -m xonotic | ||
|
||
WORKDIR /home/xonotic | ||
RUN curl -o xonotic.zip http://dl.xonotic.org/xonotic-0.8.2.zip && \ | ||
unzip xonotic.zip && rm xonotic.zip | ||
|
||
RUN mkdir -p ./.xonotic/data && mv /home/xonotic/Xonotic/server/server_linux.sh /home/xonotic/Xonotic/ | ||
COPY ./bin/sdk . | ||
COPY run.sh . | ||
COPY server.cfg ./.xonotic/data | ||
RUN chown -R xonotic:xonotic . && chmod +x run.sh && chmod +x sdk | ||
|
||
USER xonotic | ||
ENTRYPOINT /home/xonotic/run.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Copyright 2017 Google Inc. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# | ||
# Makefile for building the Xonotic server | ||
# | ||
|
||
# __ __ _ _ _ | ||
# \ \ / /_ _ _ __(_) __ _| |__ | | ___ ___ | ||
# \ \ / / _` | '__| |/ _` | '_ \| |/ _ \ __| | ||
# \ V / (_| | | | | (_| | |_) | | __\__ \ | ||
# \_/ \__,_|_| |_|\__,_|_.__/|_|\___|___/ | ||
# | ||
|
||
REPOSITORY = gcr.io/agon-images | ||
|
||
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) | ||
project_path := $(dir $(mkfile_path)) | ||
agon_path := $(realpath $(project_path)/../..) | ||
image_tag = $(REPOSITORY)/xonotic-example:0.1 | ||
|
||
# _____ _ | ||
# |_ _|_ _ _ __ __ _ ___| |_ ___ | ||
# | |/ _` | '__/ _` |/ _ \ __/ __| | ||
# | | (_| | | | (_| | __/ |_\__ \ | ||
# |_|\__,_|_| \__, |\___|\__|___/ | ||
# |___/ | ||
|
||
# Build a docker image for the server, and tag it | ||
build: build-go-binary | ||
docker build $(project_path) --tag=$(image_tag) | ||
|
||
# build the go binary with Docker, so you don't have to install anything | ||
build-go-binary: MOUNTPATH="/go/src/github.com/agonio/agon" | ||
build-go-binary: | ||
docker run --rm -v $(agon_path):$(MOUNTPATH) golang:1.9.2 go build -o $(MOUNTPATH)/examples/xonotic/bin/sdk github.com/agonio/agon/examples/xonotic | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Xonotic Example | ||
|
||
Example using a [Xonotic](http://www.xonotic.org) dedicated game server. | ||
|
||
*Note:* This example doesn't directly integrate the SDK (yet), but calls it via a separate binary. | ||
|
||
You will need to download the Xonotic client separately to play. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright 2017 Google Inc. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
apiVersion: "stable.agon.io/v1alpha1" | ||
kind: GameServer | ||
metadata: | ||
name: "xonotic" | ||
spec: | ||
portPolicy: "static" | ||
containerPort: 26000 | ||
hostPort: 7345 | ||
template: | ||
spec: | ||
containers: | ||
- name: xonotic | ||
image: gcr.io/agon-images/xonotic-example:0.1 | ||
# imagePullPolicy: Always # add for development |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright 2017 Google Inc. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package main | ||
|
||
import ( | ||
"github.com/agonio/agon/sdks/go" | ||
"log" | ||
) | ||
|
||
// main cheats a little, and just declares the game server as ready | ||
// as soon as it fires up | ||
func main() { | ||
s, err := sdk.NewSDK() | ||
if err != nil { | ||
log.Fatalf("Could not connect to sdk: %v", err) | ||
} | ||
err = s.Ready() | ||
if err != nil { | ||
log.Fatalf("Could not send ready message") | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
# technically not _actually_ ready, but for this example - this is good enough | ||
/home/xonotic/sdk | ||
# run the dedicated server | ||
/home/xonotic/Xonotic/server_linux.sh | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,215 @@ | ||
// A setting needs to be surrounded with " if it contains special | ||
// characters like space, semicolon (seperates commands) or starts | ||
// with // (begins a comment for the rest of the line or next | ||
// semicolon). While just "" means 'no/empty setting'. | ||
// You can search for settings and read their descriptions using | ||
// the 'search' command in console. A list of cvars and commands in the latest | ||
// release is also available online here: http://www.xonotic.org/tools/cacs/ | ||
///////////////////////////////////////////////////////////////////// | ||
// Everything has some sensible defaults so you do NOT really need to | ||
// change anything. But here are some settings you SHOULD change to | ||
// make it 'YOUR' server. IF so remove the // from the line start and | ||
// change them to your liking. | ||
sv_public 1 // 0 if the server should not be on the public servers list | ||
//sv_status_privacy 1 // 1 hides IP addresses from "status" replies shown to clients, 0 shows them. Enables players to identify wellknown punks on your server OR is a thread to anonymity.. depending on your point of view :) | ||
hostname "Xonotic Agon $g_xonoticversion Server" // this name will appear on the server list (the $g_xonoticversion gets replaced with the current version) | ||
//sv_motd "" // this message (unless "") is displayed to players on connect | ||
maxplayers 8 // number of players allowed on the server | ||
port 26000 // the port used by the server | ||
//You are RECOMMENDED to change this value to a free port number on your server | ||
//above 1024. The reason is that some bad ISPs might filter "gaming" ports, and | ||
//changing the port your server runs on may make your server available to these | ||
//people. Changing the port breaks nothing, the default simply matches Quake as | ||
//we use a Quake-derived protocol and didn't do our own IANA port assignment yet | ||
//(if anyone wants to go through that process, we'd be glad). | ||
//log_file "server.log" // server console output will also be copied to this file. This: "${serverconfig}.log" uses variable substitution to make the logfile have the same name as your config file with .log appended which is useful if you run several servers | ||
//g_start_delay 15 // delay before the game starts to let players join the server first | ||
// List of maps to play on the server. Set to "" to autodetect (which would enumerate ALL maps. Maps that don't support the current game mode will be skipped, so you don't need to remove them here. | ||
//g_maplist "afterslime atelier boil catharsis courtfun dance drain erbium finalrage fuse geoplanetary glowplant implosion leave_em_behind nexballarena oilrig runningman runningmanctf silentsiege solarium space-elevator stormkeep techassault vorix warfare xoylent" | ||
//g_maplist_shuffle 1 // 0 always selects the next map out of g_maplist (but then better set g_maplist_votable 0 below to prevent repetitive votes), 1 will select random maps each time | ||
//g_maplist_mostrecent_count 3 // number of maps that have to be played before a map can be repeated | ||
// LIMITS: how long a match will last before the next map starts (-1 means use the map default, 0 = unlimited, please note that the variables fraglimit/timelimit can NOT be globally used for this but only DURING a match is being played) | ||
//timelimit_override -1 // global timelimit for all maps and gametypes | ||
//fraglimit_override -1 // global frag/point limit for all maps and gametypes | ||
//capturelimit_override -1 // capture limit for CTF | ||
//g_domination_point_limit -1 // frag/point limit for DOM | ||
//g_keyhunt_point_limit -1 // frag/point limit for KH | ||
//g_lms_lives_override -1 // lives for LMS | ||
//g_nexball_goallimit -1 // goals for NEXBALL | ||
//g_ctf_ignore_frags 1 // set to 1 to ignore kills except for FC kills | ||
// TEAMS for key hunt (change this to 2, 3, 4 to set a fixed keyhunt style) | ||
//g_keyhunt_teams_override -1 // teams for KH | ||
// GAME MODE: what type of server do you want to host? | ||
// possible values: dm (deathmatch), tdm (team deathmatch), dom (domination), ctf (ctf), ft (freeze tag), lms (last man standing), ka (keepaway), inv (invasion), kh (keyhunt), as (assault), ons (onslaught), rc (race), nb (nexball) | ||
gametype dm | ||
///////////////////////////////////////////////////////////////////// | ||
// Some settings you MIGHT want to change. Again IF so remove the // | ||
// from the line start and change them to your liking. | ||
//net_address 0.0.0.0 // ONLY change this if you have problems with your server. Specifies the network interface used by the engine. Set it you one of you internal IPs | ||
//rcon_password "" // you can use rcon if this password is set. you need to set the same password in your client if you want to issue rcon commands | ||
//rcon_restricted_password "" // put here the password for a "restricted" rcon user (see below) | ||
//bot_number 3 // number of bots to add | ||
//skill 4 // the bots skill level | ||
minplayers 4 // add bots if less then that number of players playing. MAKE SURE ITS LESS THEN maxplayers or people will get blocked by bots! | ||
//g_maxplayers 0 // above this player count, only allow spectators | ||
bot_prefix [BOT] // prepend this to all botnames | ||
//bot_suffix "" // append this to all botnames | ||
//g_maplist_check_waypoints 0 // set this to 1 to skip maps without waypoints if there aren't enough players to play without bots | ||
//g_maplist_votable 6 // number of maps to vote between. set to 0 to disable the map voting screen (please enable g_maplist_shuffle above when this is enabled, or votes will be repetitive) | ||
//g_maplist_votable_suggestions 2 // number of suggestions to accept using the suggestmap command | ||
//g_maplist_votable_abstain 0 // when 1, people get a "don't care" selection in the vote screen | ||
//g_maplist_votable_nodetail 1 // when 1, people can't see how many voted for what (to thwart abusive "influential" first votes) | ||
|
||
//sv_vote_gametype 1 // set to 1 to enable voting for gametypes after every match | ||
//sv_vote_gametype_options "dm kh dom jb mygametype" // the gametypes to vote for, custom gametypes are supported | ||
//sv_vote_gametype_mygametype_name "My Mode" // Name displayed for the custom gametype "mygametype" (replace "mygametype" with the name you set in sv_vote_gametype_options) | ||
//sv_vote_gametype_mygametype_type "ft" // the basetype that the custom gametype is derived from | ||
//sv_vote_gametype_mygametype_description "This is my custom gametype" // the description for the custom gametype | ||
//// Custom icons for custom gametypes are supported and have to be located in a server pk3 as gfx/menu/default/gametype_mygametype | ||
|
||
//sv_vote_commands "restart fraglimit chmap gotomap nextmap endmatch reducematchtime extendmatchtime allready kick cointoss movetoauto shuffleteams" // players can vote for those commands or use them if they are masters. You canm also add 'g_grappling_hook' for hook voting, and 'sv_fbskin_green sv_fbskin_red sv_fbskin_orange sv_fbskin_off' for fbskin voting. | ||
//sv_vote_master_commands "movetored movetoblue movetoyellow movetopink" // add commands masters can use if logged in or elected. You may want to put 'kickban' here, so masters can keep out punks. It may be good to also put "sv_status_privacy 0" then... | ||
//rcon_restricted_commands "restart fraglimit chmap gotomap endmatch reducematchtime extendmatchtime allready kick kickban \"sv_cmd bans\" \"sv_cmd unban\" status \"sv_cmd teamstatus\" movetoauto movetored movetoblue movetoyellow movetopink" // commands for the (stronger) rcon restricted | ||
|
||
//sv_vote_call 1 // 0 will disable the normal voting | ||
//sv_vote_master 1 // 0 will disable voting to become master, good if you prefer to use the master password instead | ||
//sv_vote_master_password "" // when set, vlogin PWD will allow people to become master to run master commands directly using vdo | ||
//sv_vote_majority_factor 0.5 // What percentage of the PLAYERS constitute a majority to win a vote? must be at least 0.5 | ||
//sv_vote_majority_factor_of_voted 0 // What percentage of the VOTERS who already voted constitute a majority to win a vote? must be at least 0.5 | ||
// note: to JUST support simple majorities, set these two factors equal | ||
|
||
//sv_maxidle 0 // idle time in seconds after which players will get kicked | ||
|
||
//sv_taunt 1 // 0 to disallow taunts | ||
//sv_autotaunt 1 // 0 to disallow autotaunts | ||
|
||
|
||
///////////////////////////////////////////////////////////////////// | ||
// Settings you MIGHT want to change for PRIVACY reasons. | ||
// | ||
// The settings here may impact your or your players' privacy and serve to | ||
// optimize the game for further releases. | ||
// | ||
// Change them, or comment them out to turn them off. | ||
// This line sends the following data to our servers: | ||
// - Date and time | ||
// - Your server IP address | ||
// - Your server ID hash, which is a fingerprint of the public key of your | ||
// server and does not impact security of your private key (use "crypto_keys" | ||
// on the console to show it) | ||
// - Your server name ("hostname") | ||
// - Current game type | ||
// - Current map | ||
// - Balance settings you have modified from defaults (only those that make | ||
// your server "impure") | ||
// - For each weapon pairing (A, B), separately for player-player, player-bot, | ||
// bot-player, bot-bot pairings: | ||
// - Number of hits of players/bots holding A against players/bots holding B | ||
// - Number of frags of players/bots holding A against players/bots holding B | ||
// - Total damage of players/bots holding A against players/bots holding B | ||
// | ||
// We use this data to: | ||
// - Optimize the game balance for future releases | ||
// - Identify problems in the bot AI and improving it | ||
// - Find settings that make servers "impure" that should not, so we can | ||
// whitelist them in future releases | ||
// | ||
// We will or might publish: | ||
// - Global weapon pairing statistics for players vs players, or bots vs bots, | ||
// or any vs any, on a selection of servers | ||
// - Per-gametype and per-map weapon pairing statistics players vs players, or | ||
// bots vs bots, or any vs any, on a selection of servers | ||
// - Lists of commonly changed cvars, together with counts on how often they | ||
// are modified | ||
// | ||
// No information about the players on the server is sent, so as a server admin | ||
// you need no permission of your players for this. | ||
// | ||
// No information about your server will be published - all published data sets | ||
// will include data from multiple servers. | ||
// | ||
sv_weaponstats_file http://www.xonotic.org/weaponbalance/ | ||
///////////////////////////////////////////////////////////////////// | ||
// Some more advanced settings. You probably are not interested in changing them at all. | ||
//sv_ready_restart 0 // 1 to allow players to restart the map when all of them press the ready button | ||
//sv_ready_restart_after_countdown 0 // if set to 1 the players and map items are reset after the countdown ended, otherwise they're reset already at the beginning of the countdown | ||
//sv_ready_restart_repeatable 0 "allows the players to restart the game as often as needed | ||
//sv_autoscreenshot 0 // 1 will force a screenshot for all clients when the map ends. Useful for competitions or the ladder. | ||
//g_antilag 2 // 0 to disable the antilag feature, 1 and 2 use different methods | ||
//sv_maxrate 1000000 // limits client connections to this rate in bytes/seconds | ||
// see Docs/mapdownload.txt for more info | ||
//sv_curl_defaulturl http://www.xonotic.com/contentdownload/getmap.php?file= //fallback download URL | ||
//sv_defaultcharacter 0 // 1 will force a specific model for all players | ||
//sv_defaultplayermodel models/player/erebus.iqm // this model will be used | ||
//sv_defaultplayerskin 0 // this skin number will be forced for all players | ||
//sv_defaultplayercolors "" // you can even force player colors here (16*shirt+pants) | ||
//g_fullbrightplayers 0 // 1 to make players fullbright | ||
//g_fullbrightitems 0 // 1 to make items fullbright | ||
//g_balance_teams 1 // 0 will show players the team selection menu after joining instead of automaticly putting them on the smaller team | ||
//g_balance_teams_prevent_imbalance 1 // 0 to prevent switchint to a bigger/begger team | ||
//g_ban_sync_uri "http://46.38.241.138/~xonotic/bans/" // sync bans using this ban list provider (disabled by default, uncomment this line to enable) | ||
//g_ban_sync_trusted_servers "" // accept bans that were initially set on the server IPs listed here (if not set, your bans are just sent to the sync URIs, but no bans are retrieved from there) | ||
//g_spawnshieldtime 1 // time for which players are protected after spawn | ||
///////////////////////////////////////////////////////////////////// | ||
// "Obvious" mutators that are allowed on a "pure" server | ||
//g_instagib 0 // set to 1 for InstaGib | ||
//g_weapon_stay 0 // set to 1, 2 or 3 for different weapon-stay modes (1 = traditional, 2 = no ammo but allow throwing, 3 = ghost weapon stay) | ||
//g_powerups -1 // set to 0 to turn off strength/quad and shield/invincible, and set to 1 to turn them on even in game modes that normally have them turned off | ||
///////////////////////////////////////////////////////////////////// | ||
// Overkill mod settings | ||
// To enable Overkill, put 'exec defaultOverkill.cfg' at the top of this file (above any other cvar changes), don't use 'g_overkill 1' directly. | ||
// You should also consider enabling 'g_fullbrightplayers 1'. | ||
///////////////////////////////////////////////////////////////////// | ||
// WARNING: anything below this line makes your server "impure"! | ||
// enable some mutators you'd like | ||
//g_cloaked 0 // set to 1 for transparent hard to see players | ||
//g_grappling_hook 0 // set to 1 to enable the hook (allowed on "pure" server in InstaGib) | ||
//g_jetpack 0 // set to 1 to enable the jetpack (allowed on "pure" server in InstaGib) | ||
//g_midair 0 // set to 1 to make only midair damage count | ||
//g_vampire 0 // set to 1 to give players the damage they cause as health | ||
//sv_gravity 800 // for low gravity, set this somewhere between 50 and 400 | ||
// select AT MOST one of these arena mutators (if you didn't select g_instagib) | ||
//g_nix is "0" ["0"] No Items Xonotic - instead of pickup items, everyone plays with the same weapon. After some time, a countdown will start, after which everyone will switch to another weapon, and so on | ||
//g_nix_with_healtharmor is "0" ["0"] when 1, health and armor still show up in NIX | ||
//g_nix_with_blaster is "0" ["0"] always carry the blaster as an additional weapon in NIX | ||
//g_nix_with_powerups is "0" ["0"] when 1, powerups still show up in NIX |