mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-01-22 14:59:25 +08:00
Adding server config functionality
This commit is contained in:
parent
6042f292c4
commit
7456ea3dcb
@ -4136,10 +4136,10 @@
|
||||
"build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/35/65/12d682473b0092cfc423146e4100",
|
||||
"build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/94/33/a0dbcd5d1f77bde4bf1a8952d329",
|
||||
"build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/aa/f3/253f73cf509c39a930ca041eb455",
|
||||
"build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/fa/4d/83dd706c3ea327cbf89504130197",
|
||||
"build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/33/f0/9687bdb5b1dac0dbb934261e987b",
|
||||
"build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/f0/d4/ef1e004aefe9a2a45cfb98d53df1",
|
||||
"build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/f3/d3/189e54e5de63411b66dae4851add",
|
||||
"build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ab/00/6a2e0c4979c73483057bf7c05b69",
|
||||
"build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/e2/ab/b22ebe07c4342beb4dba33d5f7a5",
|
||||
"build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/80/24/b24a5a26ce61719456479f0c452d",
|
||||
"build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/13/5f/7dff6b239258c1a1151df24eec19",
|
||||
"build/prefab/windows-server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/f1/41/8203dd42e85b8cfde0141715de3b",
|
||||
"build/prefab/windows-server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/56/46/86ea1b38475a43dc95a65db0623a",
|
||||
"build/prefab/windows/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/8f/28/7d7560edfe6b862003a699cd72d9",
|
||||
|
||||
7
.idea/dictionaries/ericf.xml
generated
7
.idea/dictionaries/ericf.xml
generated
@ -610,6 +610,7 @@
|
||||
<w>firebase</w>
|
||||
<w>firestore</w>
|
||||
<w>firetv</w>
|
||||
<w>firstline</w>
|
||||
<w>flac</w>
|
||||
<w>flagmat</w>
|
||||
<w>flagmaterial</w>
|
||||
@ -853,6 +854,7 @@
|
||||
<w>inet</w>
|
||||
<w>inext</w>
|
||||
<w>infileb</w>
|
||||
<w>infilename</w>
|
||||
<w>infos</w>
|
||||
<w>infotextcolor</w>
|
||||
<w>inidividual</w>
|
||||
@ -931,6 +933,7 @@
|
||||
<w>langs</w>
|
||||
<w>langtarget</w>
|
||||
<w>langval</w>
|
||||
<w>lastline</w>
|
||||
<w>lastplayer</w>
|
||||
<w>lastpoweruptype</w>
|
||||
<w>laststand</w>
|
||||
@ -1237,6 +1240,7 @@
|
||||
<w>outdata</w>
|
||||
<w>outdelay</w>
|
||||
<w>outext</w>
|
||||
<w>outfilename</w>
|
||||
<w>outname</w>
|
||||
<w>outpath</w>
|
||||
<w>ouya</w>
|
||||
@ -1547,6 +1551,7 @@
|
||||
<w>servercmd</w>
|
||||
<w>serverdialog</w>
|
||||
<w>serverget</w>
|
||||
<w>servermanager</w>
|
||||
<w>serverput</w>
|
||||
<w>serverutils</w>
|
||||
<w>sessionclass</w>
|
||||
@ -1910,6 +1915,7 @@
|
||||
<w>vmshell</w>
|
||||
<w>vmware</w>
|
||||
<w>vmwarevm</w>
|
||||
<w>vname</w>
|
||||
<w>vnums</w>
|
||||
<w>vobj</w>
|
||||
<w>voffs</w>
|
||||
@ -1921,6 +1927,7 @@
|
||||
<w>vstr</w>
|
||||
<w>vsync</w>
|
||||
<w>vsyncs</w>
|
||||
<w>vtype</w>
|
||||
<w>vval</w>
|
||||
<w>waaah</w>
|
||||
<w>wanttype</w>
|
||||
|
||||
82
Makefile
82
Makefile
@ -183,15 +183,22 @@ prefab-mac-server-debug: prefab-mac-server-debug-build
|
||||
prefab-mac-server-debug-build: prereqs assets-cmake \
|
||||
build/prefab/mac-server/debug/dist/ballisticacore_headless \
|
||||
build/prefab/mac-server/debug/ballisticacore_server \
|
||||
build/prefab/mac-server/debug/config_template.yaml
|
||||
build/prefab/mac-server/debug/config_template.yaml \
|
||||
build/prefab/mac-server/debug/README.txt
|
||||
@${STAGE_ASSETS} -cmake-server build/prefab/mac-server/debug/dist
|
||||
|
||||
build/prefab/mac-server/debug/ballisticacore_server: \
|
||||
assets/src/server/server.py
|
||||
assets/src/server/ballisticacore_server.py
|
||||
@cp $< $@
|
||||
|
||||
build/prefab/mac-server/debug/config_template.yaml: \
|
||||
assets/src/server/config.yaml
|
||||
assets/src/server/config_template.yaml \
|
||||
tools/batools/build.py \
|
||||
tools/bacommon/servermanager.py
|
||||
@tools/snippets filter_server_config $< $@
|
||||
|
||||
build/prefab/mac-server/debug/README.txt: \
|
||||
assets/src/server/README.txt
|
||||
@cp $< $@
|
||||
|
||||
build/prefab/mac-server/debug/dist/ballisticacore_headless: .efrocachemap
|
||||
@ -207,15 +214,22 @@ prefab-mac-server-release: prefab-mac-server-release-build
|
||||
prefab-mac-server-release-build: prereqs assets-cmake \
|
||||
build/prefab/mac-server/release/dist/ballisticacore_headless \
|
||||
build/prefab/mac-server/release/ballisticacore_server \
|
||||
build/prefab/mac-server/release/config_template.yaml
|
||||
build/prefab/mac-server/release/config_template.yaml \
|
||||
build/prefab/mac-server/release/README.txt
|
||||
@${STAGE_ASSETS} -cmake-server build/prefab/mac-server/release/dist
|
||||
|
||||
build/prefab/mac-server/release/ballisticacore_server: \
|
||||
assets/src/server/server.py
|
||||
assets/src/server/ballisticacore_server.py
|
||||
@cp $< $@
|
||||
|
||||
build/prefab/mac-server/release/config_template.yaml: \
|
||||
assets/src/server/config.yaml
|
||||
assets/src/server/config_template.yaml \
|
||||
tools/batools/build.py \
|
||||
tools/bacommon/servermanager.py
|
||||
@tools/snippets filter_server_config $< $@
|
||||
|
||||
build/prefab/mac-server/release/README.txt: \
|
||||
assets/src/server/README.txt
|
||||
@cp $< $@
|
||||
|
||||
build/prefab/mac-server/release/dist/ballisticacore_headless: .efrocachemap
|
||||
@ -257,15 +271,22 @@ prefab-linux-server-debug: prefab-linux-server-debug-build
|
||||
prefab-linux-server-debug-build: prereqs assets-cmake \
|
||||
build/prefab/linux-server/debug/dist/ballisticacore_headless \
|
||||
build/prefab/linux-server/debug/ballisticacore_server \
|
||||
build/prefab/linux-server/debug/config_template.yaml
|
||||
build/prefab/linux-server/debug/config_template.yaml \
|
||||
build/prefab/linux-server/debug/README.txt
|
||||
@${STAGE_ASSETS} -cmake-server build/prefab/linux-server/debug/dist
|
||||
|
||||
build/prefab/linux-server/debug/ballisticacore_server: \
|
||||
assets/src/server/server.py
|
||||
assets/src/server/ballisticacore_server.py
|
||||
@cp $< $@
|
||||
|
||||
build/prefab/linux-server/debug/config_template.yaml: \
|
||||
assets/src/server/config.yaml
|
||||
assets/src/server/config_template.yaml \
|
||||
tools/batools/build.py \
|
||||
tools/bacommon/servermanager.py
|
||||
@tools/snippets filter_server_config $< $@
|
||||
|
||||
build/prefab/linux-server/debug/README.txt: \
|
||||
assets/src/server/README.txt
|
||||
@cp $< $@
|
||||
|
||||
build/prefab/linux-server/debug/dist/ballisticacore_headless: .efrocachemap
|
||||
@ -281,15 +302,22 @@ prefab-linux-server-release: prefab-linux-server-release-build
|
||||
prefab-linux-server-release-build: prereqs assets-cmake \
|
||||
build/prefab/linux-server/release/dist/ballisticacore_headless \
|
||||
build/prefab/linux-server/release/ballisticacore_server \
|
||||
build/prefab/linux-server/release/config_template.yaml
|
||||
build/prefab/linux-server/release/config_template.yaml \
|
||||
build/prefab/linux-server/release/README.txt
|
||||
@${STAGE_ASSETS} -cmake-server build/prefab/linux-server/release/dist
|
||||
|
||||
build/prefab/linux-server/release/ballisticacore_server: \
|
||||
assets/src/server/server.py
|
||||
assets/src/server/ballisticacore_server.py
|
||||
@cp $< $@
|
||||
|
||||
build/prefab/linux-server/release/config_template.yaml: \
|
||||
assets/src/server/config.yaml
|
||||
assets/src/server/config_template.yaml \
|
||||
tools/batools/build.py \
|
||||
tools/bacommon/servermanager.py
|
||||
@tools/snippets filter_server_config $< $@
|
||||
|
||||
build/prefab/linux-server/release/README.txt: \
|
||||
assets/src/server/README.txt
|
||||
@cp $< $@
|
||||
|
||||
build/prefab/linux-server/release/dist/ballisticacore_headless: .efrocachemap
|
||||
@ -337,7 +365,8 @@ prefab-windows-server-debug-build: prereqs \
|
||||
build/prefab/windows-server/debug/dist/ballisticacore_headless.exe \
|
||||
build/prefab/windows-server/debug/launch_ballisticacore_server.bat \
|
||||
build/prefab/windows-server/debug/ballisticacore_server.py \
|
||||
build/prefab/windows-server/debug/config_template.yaml
|
||||
build/prefab/windows-server/debug/config_template.yaml \
|
||||
build/prefab/windows-server/debug/README.txt
|
||||
@${STAGE_ASSETS} -win-$(PREFAB_WINDOWS_PLATFORM) \
|
||||
build/prefab/windows-server/debug/dist
|
||||
|
||||
@ -345,15 +374,21 @@ build/prefab/windows-server/debug/dist/ballisticacore_headless.exe: .efrocachema
|
||||
@tools/snippets efrocache_get $@
|
||||
|
||||
build/prefab/windows-server/debug/ballisticacore_server.py: \
|
||||
assets/src/server/server.py
|
||||
assets/src/server/ballisticacore_server.py
|
||||
@cp $< $@
|
||||
|
||||
build/prefab/windows-server/debug/launch_ballisticacore_server.bat: \
|
||||
assets/src/server/server.bat
|
||||
assets/src/server/launch_ballisticacore_server.bat
|
||||
@cp $< $@
|
||||
|
||||
build/prefab/windows-server/debug/config_template.yaml: \
|
||||
assets/src/server/config.yaml
|
||||
assets/src/server/config_template.yaml \
|
||||
tools/batools/build.py \
|
||||
tools/bacommon/servermanager.py
|
||||
@tools/snippets filter_server_config $< $@
|
||||
|
||||
build/prefab/windows-server/debug/README.txt: \
|
||||
assets/src/server/README.txt
|
||||
@cp $< $@
|
||||
|
||||
RUN_PREFAB_WINDOWS_SERVER_RELEASE = cd build/prefab/windows-server/release \
|
||||
@ -368,7 +403,8 @@ prefab-windows-server-release-build: prereqs \
|
||||
build/prefab/windows-server/release/dist/ballisticacore_headless.exe \
|
||||
build/prefab/windows-server/release/launch_ballisticacore_server.bat \
|
||||
build/prefab/windows-server/release/ballisticacore_server.py \
|
||||
build/prefab/windows-server/release/config_template.yaml
|
||||
build/prefab/windows-server/release/config_template.yaml \
|
||||
build/prefab/windows-server/release/README.txt
|
||||
@${STAGE_ASSETS} -win-$(PREFAB_WINDOWS_PLATFORM) \
|
||||
build/prefab/windows-server/release/dist
|
||||
|
||||
@ -376,15 +412,21 @@ build/prefab/windows-server/release/dist/ballisticacore_headless.exe: .efrocache
|
||||
@tools/snippets efrocache_get $@
|
||||
|
||||
build/prefab/windows-server/release/ballisticacore_server.py: \
|
||||
assets/src/server/server.py
|
||||
assets/src/server/ballisticacore_server.py
|
||||
@cp $< $@
|
||||
|
||||
build/prefab/windows-server/release/launch_ballisticacore_server.bat: \
|
||||
assets/src/server/server.bat
|
||||
assets/src/server/launch_ballisticacore_server.bat
|
||||
@cp $< $@
|
||||
|
||||
build/prefab/windows-server/release/config_template.yaml: \
|
||||
assets/src/server/config.yaml
|
||||
assets/src/server/config_template.yaml \
|
||||
tools/batools/build.py \
|
||||
tools/bacommon/servermanager.py
|
||||
@tools/snippets filter_server_config $< $@
|
||||
|
||||
build/prefab/windows-server/release/README.txt: \
|
||||
assets/src/server/README.txt
|
||||
@cp $< $@
|
||||
|
||||
prefab-clean:
|
||||
|
||||
@ -111,10 +111,10 @@
|
||||
"ba_data/python/bacommon/__pycache__/__init__.cpython-37.opt-1.pyc",
|
||||
"ba_data/python/bacommon/__pycache__/assets.cpython-37.opt-1.pyc",
|
||||
"ba_data/python/bacommon/__pycache__/err.cpython-37.opt-1.pyc",
|
||||
"ba_data/python/bacommon/__pycache__/serverutils.cpython-37.opt-1.pyc",
|
||||
"ba_data/python/bacommon/__pycache__/servermanager.cpython-37.opt-1.pyc",
|
||||
"ba_data/python/bacommon/assets.py",
|
||||
"ba_data/python/bacommon/err.py",
|
||||
"ba_data/python/bacommon/serverutils.py",
|
||||
"ba_data/python/bacommon/servermanager.py",
|
||||
"ba_data/python/bastd/__init__.py",
|
||||
"ba_data/python/bastd/__pycache__/__init__.cpython-37.opt-1.pyc",
|
||||
"ba_data/python/bastd/__pycache__/appdelegate.cpython-37.opt-1.pyc",
|
||||
@ -473,6 +473,6 @@
|
||||
"ba_data/python/efro/executils.py",
|
||||
"ba_data/python/efro/jsonutils.py",
|
||||
"ba_data/python/efro/util.py",
|
||||
"server/__pycache__/server.cpython-37.opt-1.pyc",
|
||||
"server/server.py"
|
||||
"server/__pycache__/ballisticacore_server.cpython-37.opt-1.pyc",
|
||||
"server/ballisticacore_server.py"
|
||||
]
|
||||
@ -142,7 +142,7 @@ ASSET_TARGETS_WIN_X64 += $(EXTRAS_TARGETS_WIN_X64)
|
||||
#AUTOGENERATED_BEGIN_1 (this section is managed by the "update_project" tool)
|
||||
|
||||
SCRIPT_TARGETS_PY_1 = \
|
||||
build/server/server.py \
|
||||
build/server/ballisticacore_server.py \
|
||||
build/ba_data/python/efro/executils.py \
|
||||
build/ba_data/python/efro/util.py \
|
||||
build/ba_data/python/efro/__init__.py \
|
||||
@ -154,9 +154,9 @@ SCRIPT_TARGETS_PY_1 = \
|
||||
build/ba_data/python/efro/entity/_field.py \
|
||||
build/ba_data/python/efro/entity/__init__.py \
|
||||
build/ba_data/python/efro/entity/_value.py \
|
||||
build/ba_data/python/bacommon/servermanager.py \
|
||||
build/ba_data/python/bacommon/__init__.py \
|
||||
build/ba_data/python/bacommon/assets.py \
|
||||
build/ba_data/python/bacommon/serverutils.py \
|
||||
build/ba_data/python/bacommon/err.py \
|
||||
build/ba_data/python/ba/_dualteamsession.py \
|
||||
build/ba_data/python/ba/_gameactivity.py \
|
||||
@ -382,7 +382,7 @@ SCRIPT_TARGETS_PY_1 = \
|
||||
build/ba_data/python/bastd/session/__init__.py
|
||||
|
||||
SCRIPT_TARGETS_PYC_1 = \
|
||||
build/server/__pycache__/server.cpython-37.opt-1.pyc \
|
||||
build/server/__pycache__/ballisticacore_server.cpython-37.opt-1.pyc \
|
||||
build/ba_data/python/efro/__pycache__/executils.cpython-37.opt-1.pyc \
|
||||
build/ba_data/python/efro/__pycache__/util.cpython-37.opt-1.pyc \
|
||||
build/ba_data/python/efro/__pycache__/__init__.cpython-37.opt-1.pyc \
|
||||
@ -394,9 +394,9 @@ SCRIPT_TARGETS_PYC_1 = \
|
||||
build/ba_data/python/efro/entity/__pycache__/_field.cpython-37.opt-1.pyc \
|
||||
build/ba_data/python/efro/entity/__pycache__/__init__.cpython-37.opt-1.pyc \
|
||||
build/ba_data/python/efro/entity/__pycache__/_value.cpython-37.opt-1.pyc \
|
||||
build/ba_data/python/bacommon/__pycache__/servermanager.cpython-37.opt-1.pyc \
|
||||
build/ba_data/python/bacommon/__pycache__/__init__.cpython-37.opt-1.pyc \
|
||||
build/ba_data/python/bacommon/__pycache__/assets.cpython-37.opt-1.pyc \
|
||||
build/ba_data/python/bacommon/__pycache__/serverutils.cpython-37.opt-1.pyc \
|
||||
build/ba_data/python/bacommon/__pycache__/err.cpython-37.opt-1.pyc \
|
||||
build/ba_data/python/ba/__pycache__/_dualteamsession.cpython-37.opt-1.pyc \
|
||||
build/ba_data/python/ba/__pycache__/_gameactivity.cpython-37.opt-1.pyc \
|
||||
@ -634,8 +634,8 @@ $(SCRIPT_TARGETS_PY_1) : build/%.py : src/%.py
|
||||
# just generating explicit targets for each. Could perhaps look into using a
|
||||
# fancy for-loop instead, but perhaps listing these explicitly isn't so bad.
|
||||
|
||||
build/server/__pycache__/server.cpython-37.opt-1.pyc: \
|
||||
build/server/server.py
|
||||
build/server/__pycache__/ballisticacore_server.cpython-37.opt-1.pyc: \
|
||||
build/server/ballisticacore_server.py
|
||||
@echo Compiling script: $^
|
||||
@rm -rf $@ && $(TOOLS_DIR)/snippets compile_python_files $^ && chmod 444 $@
|
||||
|
||||
@ -694,6 +694,11 @@ build/ba_data/python/efro/entity/__pycache__/_value.cpython-37.opt-1.pyc: \
|
||||
@echo Compiling script: $^
|
||||
@rm -rf $@ && $(TOOLS_DIR)/snippets compile_python_files $^ && chmod 444 $@
|
||||
|
||||
build/ba_data/python/bacommon/__pycache__/servermanager.cpython-37.opt-1.pyc: \
|
||||
build/ba_data/python/bacommon/servermanager.py
|
||||
@echo Compiling script: $^
|
||||
@rm -rf $@ && $(TOOLS_DIR)/snippets compile_python_files $^ && chmod 444 $@
|
||||
|
||||
build/ba_data/python/bacommon/__pycache__/__init__.cpython-37.opt-1.pyc: \
|
||||
build/ba_data/python/bacommon/__init__.py
|
||||
@echo Compiling script: $^
|
||||
@ -704,11 +709,6 @@ build/ba_data/python/bacommon/__pycache__/assets.cpython-37.opt-1.pyc: \
|
||||
@echo Compiling script: $^
|
||||
@rm -rf $@ && $(TOOLS_DIR)/snippets compile_python_files $^ && chmod 444 $@
|
||||
|
||||
build/ba_data/python/bacommon/__pycache__/serverutils.cpython-37.opt-1.pyc: \
|
||||
build/ba_data/python/bacommon/serverutils.py
|
||||
@echo Compiling script: $^
|
||||
@rm -rf $@ && $(TOOLS_DIR)/snippets compile_python_files $^ && chmod 444 $@
|
||||
|
||||
build/ba_data/python/bacommon/__pycache__/err.cpython-37.opt-1.pyc: \
|
||||
build/ba_data/python/bacommon/err.py
|
||||
@echo Compiling script: $^
|
||||
|
||||
@ -28,7 +28,7 @@ from typing import TYPE_CHECKING
|
||||
from ba._enums import TimeType
|
||||
from ba._freeforallsession import FreeForAllSession
|
||||
from ba._dualteamsession import DualTeamSession
|
||||
from bacommon.serverutils import ServerConfig, ServerCommand
|
||||
from bacommon.servermanager import ServerConfig, ServerCommand
|
||||
import _ba
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@ -37,7 +37,7 @@ if TYPE_CHECKING:
|
||||
|
||||
|
||||
def _cmd(command_data: bytes) -> None:
|
||||
"""Handle commands coming in from the server wrapper."""
|
||||
"""Handle commands coming in from the server manager."""
|
||||
import pickle
|
||||
command, payload = pickle.loads(command_data)
|
||||
assert isinstance(command, ServerCommand)
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
# -----------------------------------------------------------------------------
|
||||
"""Functionality related to running standalone server."""
|
||||
"""Functionality related to the server manager script."""
|
||||
from __future__ import annotations
|
||||
|
||||
from enum import Enum
|
||||
@ -32,7 +32,7 @@ if TYPE_CHECKING:
|
||||
|
||||
@dataclass
|
||||
class ServerConfig:
|
||||
"""Configuration for running a standalone server."""
|
||||
"""Configuration for the server manager script."""
|
||||
|
||||
# Name of our server in the public parties list.
|
||||
party_name: str = 'FFA'
|
||||
@ -116,8 +116,8 @@ class ServerConfig:
|
||||
quit_reason: Optional[str] = None
|
||||
|
||||
|
||||
# NOTE: as much as possible, communication from the server-wrapper to the
|
||||
# server-binary should go through this and not ad-hoc python string commands
|
||||
# NOTE: as much as possible, communication from the server-manager to the
|
||||
# child binary should go through this and not ad-hoc python string commands
|
||||
# since this way is type safe.
|
||||
class ServerCommand(Enum):
|
||||
"""Command types that can be sent to the app in server-mode."""
|
||||
@ -1,23 +1,29 @@
|
||||
To run this, simply cd into this directory and run ./ballisticacore_server (on mac or linux) or launch_ballisticacore_server.bat (on windows)
|
||||
You'll need to open a UDP port (43210 by default) so that the world can communicate with your server.
|
||||
You can edit some server params in the ballisticacore_server script, or for more fancy changes you can modify the game scripts in data/scripts.
|
||||
To run this, simply cd into this directory and run ./ballisticacore_server
|
||||
(on mac or linux) or launch_ballisticacore_server.bat (on windows).
|
||||
You'll need to open a UDP port (43210 by default) so that the world can
|
||||
communicate with your server.
|
||||
You can configure your server by creating a config.yaml file
|
||||
(see config_template.yaml as a starting point)
|
||||
|
||||
platform-specific notes:
|
||||
Platform-Specific Notes:
|
||||
|
||||
mac:
|
||||
- The server should run on the most recent macOS (and possibly older versions, though I have not checked)
|
||||
- It now requires homebrew python 3, so you'll need that installed (brew install python3).
|
||||
Mac:
|
||||
- The server should run on the most recent macOS (and possibly older versions,
|
||||
though I have not checked)
|
||||
- It now requires homebrew Python 3, so you'll need that installed
|
||||
(brew install python3).
|
||||
|
||||
linux (x86_64):
|
||||
- Server binaries are currently compiled against ubuntu 19.04. They depend on Python 3.7, so you may need to install that.
|
||||
Linux (x86_64):
|
||||
- Server binaries are currently compiled against Ubuntu 18 LTS. They depend
|
||||
on Python 3.7, so you may need to install that.
|
||||
This should just be something like "sudo apt install python3"
|
||||
|
||||
raspberry pi:
|
||||
- The server binary was compiled on a raspberry pi 3 running raspbian buster.
|
||||
As with the standard linux build you'll need to make sure you've got Python 3 installed (should be 3.7)
|
||||
Raspberry Pi:
|
||||
- The server binary was compiled on a Raspberry Pi 4 running Raspbian Buster.
|
||||
|
||||
windows:
|
||||
- You may need to run Vc_redist.x64.exe to install support libraries if the app quits with complaints of missing DLLs
|
||||
Windows:
|
||||
- You may need to run dist/Vc_redist.x64.exe to install support libraries if
|
||||
the app quits with complaints of missing DLLs
|
||||
|
||||
Please give me a holler at support@froemling.net if you run into any problems.
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
# -----------------------------------------------------------------------------
|
||||
"""BallisticaCore server management."""
|
||||
"""BallisticaCore server manager."""
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
@ -38,8 +38,8 @@ sys.path += [
|
||||
str(Path(os.getcwd(), 'dist', 'ba_data', 'python-site-packages'))
|
||||
]
|
||||
|
||||
from bacommon.serverutils import (ServerConfig, ServerCommand,
|
||||
make_server_command)
|
||||
from bacommon.servermanager import (ServerConfig, ServerCommand,
|
||||
make_server_command)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Optional, List, Dict
|
||||
@ -113,7 +113,7 @@ class ServerManagerApp:
|
||||
'Type "help(mgr)" for more information.')
|
||||
|
||||
# Python will handle SIGINT for us (as KeyboardInterrupt) but we
|
||||
# need to register a SIGTERM handler if we want a chance to clean
|
||||
# need to register a SIGTERM handler so we have a chance to clean
|
||||
# up our child process when someone tells us to die. (and avoid
|
||||
# zombie processes)
|
||||
signal.signal(signal.SIGTERM, self._handle_term_signal)
|
||||
@ -159,9 +159,8 @@ class ServerManagerApp:
|
||||
# Ideally we'd block here until the command was run so our prompt would
|
||||
# print after it's results. We currently don't get any response from
|
||||
# the app so the best we can do is block until our bg thread has sent
|
||||
# it.
|
||||
# In the future we can perhaps add a proper 'command port' interface
|
||||
# for proper blocking two way communication.
|
||||
# it. In the future we can perhaps add a proper 'command port'
|
||||
# interface for proper blocking two way communication.
|
||||
while True:
|
||||
with self._binary_commands_lock:
|
||||
if not self._binary_commands:
|
||||
@ -241,8 +240,7 @@ class ServerManagerApp:
|
||||
if self._done:
|
||||
break
|
||||
|
||||
# Pass along any commands to the subprocess..
|
||||
# FIXME add a lock for this...
|
||||
# Pass along any commands to the subprocess.
|
||||
with self._binary_commands_lock:
|
||||
for incmd in self._binary_commands:
|
||||
# We're passing a raw string to exec; no need to wrap it
|
||||
@ -1,28 +0,0 @@
|
||||
# Copyright (c) 2011-2020 Eric Froemling
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
# -----------------------------------------------------------------------------
|
||||
# place any of your own overrides here.
|
||||
# see ballisticacore_server for details on what you can override
|
||||
# examples (uncomment to use):
|
||||
# config['party_name'] = 'My Awesome Party'
|
||||
# config['session_type'] = 'teams'
|
||||
# config['max_party_size'] = 6
|
||||
# config['port'] = 43209
|
||||
# config['playlist_code'] = 1242
|
||||
7
assets/src/server/config_template.yaml
Normal file
7
assets/src/server/config_template.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
# To configure your server, create a config.yaml file in the same directory
|
||||
# as the ballisticacore_server script. This template config file can be
|
||||
# copied or renamed as a convenient starting point.
|
||||
|
||||
# Uncomment any of these values to set them.
|
||||
|
||||
#__CONFIG_TEMPLATE_VALUES__
|
||||
@ -99,8 +99,8 @@ class PrefabTarget(Enum):
|
||||
SERVER_RELEASE = 'server-release'
|
||||
|
||||
|
||||
def _checkpaths(inpaths: List[str], category: SourceCategory,
|
||||
target: str) -> bool:
|
||||
def _lazybuild_check_paths(inpaths: List[str], category: SourceCategory,
|
||||
target: str) -> bool:
|
||||
# pylint: disable=too-many-branches
|
||||
|
||||
mtime = None if not os.path.exists(target) else os.path.getmtime(target)
|
||||
@ -159,31 +159,48 @@ def _checkpaths(inpaths: List[str], category: SourceCategory,
|
||||
if _testpath(fpath):
|
||||
return True
|
||||
unchanged_count += 1
|
||||
print(f'{CLRBLU}Skipping build of {tnamepretty}'
|
||||
f' ({unchanged_count} inputs unchanged){CLREND}')
|
||||
print(f'{CLRBLU}Lazybuild: skipping "{tnamepretty}"'
|
||||
f' ({unchanged_count} inputs unchanged).{CLREND}')
|
||||
return False
|
||||
|
||||
|
||||
def lazy_build(target: str, category: SourceCategory, command: str) -> None:
|
||||
"""Run a build if anything in category is newer than target.
|
||||
def lazybuild(target: str, category: SourceCategory, command: str) -> None:
|
||||
"""Run a build if anything in some category is newer than a target.
|
||||
|
||||
Note that target's mod-time will always be updated when the build happens
|
||||
regardless of whether the build itself did so itself.
|
||||
This can be used as an optimization for build targets that *always* run.
|
||||
As an example, a target that spins up a VM and runs a build can be
|
||||
expensive even if the VM build process determines that nothing has changed
|
||||
and does no work. We can use this to examine a broad swath of source files
|
||||
and skip firing up the VM if nothing has changed. We can be overly broad
|
||||
in the sources we look at since the worst result of a false positive change
|
||||
is the VM spinning up and determining that no actual inputs have changed.
|
||||
We could recreate this mechanism purely in the Makefile, but large numbers
|
||||
of target sources can add significant overhead each time the Makefile is
|
||||
invoked; in our case the cost is only incurred when a build is triggered.
|
||||
|
||||
Note that target's mod-time will *always* be updated to match the newest
|
||||
source regardless of whether the build itself was triggered.
|
||||
"""
|
||||
paths: List[str]
|
||||
|
||||
# Everything possibly affecting generated code.
|
||||
if category is SourceCategory.CODE_GEN:
|
||||
# Everything possibly affecting generated code.
|
||||
paths = ['Makefile', 'tools/generate_code', 'src/generated_src']
|
||||
|
||||
# Everything possibly affecting asset builds.
|
||||
elif category is SourceCategory.ASSETS:
|
||||
paths = ['Makefile', 'tools/convert_util', 'assets/src']
|
||||
|
||||
# Everything possibly affecting CMake builds.
|
||||
elif category is SourceCategory.CMAKE:
|
||||
# Everything possibly affecting CMake builds.
|
||||
paths = ['Makefile', 'src', 'ballisticacore-cmake/CMakeLists.txt']
|
||||
|
||||
# Everything possibly affecting Windows binary builds.
|
||||
elif category is SourceCategory.WIN:
|
||||
# Everything possibly affecting Windows binary builds.
|
||||
paths = ['Makefile', 'src', 'resources/src']
|
||||
|
||||
# Everything possibly affecting resource builds.
|
||||
elif category is SourceCategory.RESOURCES:
|
||||
# Everything possibly affecting resources builds.
|
||||
paths = [
|
||||
'Makefile', 'tools/snippets', 'resources/src', 'resources/Makefile'
|
||||
]
|
||||
@ -191,8 +208,7 @@ def lazy_build(target: str, category: SourceCategory, command: str) -> None:
|
||||
raise ValueError(f'Invalid source category: {category}')
|
||||
|
||||
# Now do the thing if any our our input mod times changed.
|
||||
if _checkpaths(paths, category, target):
|
||||
|
||||
if _lazybuild_check_paths(paths, category, target):
|
||||
subprocess.run(command, shell=True, check=True)
|
||||
|
||||
# We also explicitly update the mod-time of the target;
|
||||
@ -559,3 +575,58 @@ def update_makebob() -> None:
|
||||
check=True,
|
||||
)
|
||||
print('All builds complete!', flush=True)
|
||||
|
||||
|
||||
def _get_server_config_raw_contents() -> str:
|
||||
import textwrap
|
||||
with open('tools/bacommon/servermanager.py') as infile:
|
||||
lines = infile.read().splitlines()
|
||||
firstline = lines.index('class ServerConfig:') + 1
|
||||
lastline = firstline + 1
|
||||
while True:
|
||||
line = lines[lastline]
|
||||
if line != '' and not line.startswith(' '):
|
||||
break
|
||||
lastline += 1
|
||||
|
||||
# Move first line past doc-string to the first comment.
|
||||
while not lines[firstline].startswith(' #'):
|
||||
firstline += 1
|
||||
|
||||
# Back last line up to before last empty lines.
|
||||
lastline -= 1
|
||||
while lines[lastline] == '':
|
||||
lastline -= 1
|
||||
|
||||
return textwrap.dedent('\n'.join(lines[firstline:lastline + 1]))
|
||||
|
||||
|
||||
def _get_server_config_template_yaml() -> str:
|
||||
import yaml
|
||||
lines_in = _get_server_config_raw_contents().splitlines()
|
||||
lines_out: List[str] = []
|
||||
for line in lines_in:
|
||||
if line != '' and not line.startswith('#'):
|
||||
vname, _vtype, veq, vval_raw = line.split()
|
||||
assert vname.endswith(':')
|
||||
vname = vname[:-1]
|
||||
assert veq == '='
|
||||
vval = eval(vval_raw) # pylint: disable=eval-used
|
||||
|
||||
# Override a few specifics:
|
||||
if vname == 'playlist_code':
|
||||
vval = 12345
|
||||
lines_out.append('#' + yaml.dump({vname: vval}).strip())
|
||||
else:
|
||||
lines_out.append(line)
|
||||
return '\n'.join(lines_out)
|
||||
|
||||
|
||||
def filter_server_config(infilename: str, outfilename: str) -> None:
|
||||
"""Add commented-out config options to a server config."""
|
||||
with open(infilename) as infile:
|
||||
cfg = infile.read()
|
||||
cfg = cfg.replace('#__CONFIG_TEMPLATE_VALUES__',
|
||||
_get_server_config_template_yaml())
|
||||
with open(outfilename, 'w') as outfile:
|
||||
outfile.write(cfg)
|
||||
|
||||
@ -63,7 +63,7 @@ def snippets_main(globs: Dict[str, Any]) -> None:
|
||||
show_help = False
|
||||
retval = 0
|
||||
if len(sys.argv) < 2:
|
||||
print('ERROR: command expected.')
|
||||
print(f'{CLRRED}ERROR: command expected.{CLREND}')
|
||||
show_help = True
|
||||
retval = 255
|
||||
else:
|
||||
|
||||
@ -550,7 +550,7 @@ def ensure_prefab_platform() -> None:
|
||||
|
||||
|
||||
def prefab_run_var() -> None:
|
||||
"""Print a variable for running a prefab run for the current platform.
|
||||
"""Print a var for running a prefab run for the current platform.
|
||||
|
||||
We use this mechanism instead of just having a command recursively run
|
||||
a make target so that ctrl-c can be handled cleanly and directly by the
|
||||
@ -601,10 +601,18 @@ def lazybuild() -> None:
|
||||
target = sys.argv[3]
|
||||
command = ' '.join(sys.argv[4:])
|
||||
try:
|
||||
batools.build.lazy_build(target, category, command)
|
||||
batools.build.lazybuild(target, category, command)
|
||||
except subprocess.CalledProcessError as exc:
|
||||
raise CleanError(exc)
|
||||
|
||||
|
||||
def filter_server_config() -> None:
|
||||
"""Add commented-out config options to a server config."""
|
||||
import batools.build
|
||||
if len(sys.argv) != 4:
|
||||
raise CleanError('Expected 2 args (infile and outfile).')
|
||||
batools.build.filter_server_config(sys.argv[2], sys.argv[3])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
snippets_main(globals())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user