From 2cee8fc7d32f989842c8c63f3621730e123a5a9c Mon Sep 17 00:00:00 2001 From: Cameron Reikes Date: Tue, 8 Nov 2022 11:38:51 -0800 Subject: [PATCH] Automated build tooling --- .gitignore | 4 ++++ build_debug.bat | 25 ++----------------------- build_msvc.bat | 23 +++++++++++++++++++++++ build_release.bat | 2 ++ flight.service | 1 + release_all.bat | 3 +++ server.c | 2 +- types.h | 2 +- update_server.bat | 1 + 9 files changed, 38 insertions(+), 25 deletions(-) create mode 100644 build_msvc.bat create mode 100644 build_release.bat create mode 100644 release_all.bat create mode 100644 update_server.bat diff --git a/.gitignore b/.gitignore index 3666051..c37367c 100644 --- a/.gitignore +++ b/.gitignore @@ -4,10 +4,14 @@ flight_server flight.zip ipsettings.h + + .vs/ x64/ *.exe *.obj *.pdb +*.exp +*.lib *.ilk *.gen.h diff --git a/build_debug.bat b/build_debug.bat index 933cfc1..9143b5a 100644 --- a/build_debug.bat +++ b/build_debug.bat @@ -1,23 +1,2 @@ -@echo off - -@REM what all the compile flags mean: https://learn.microsoft.com/en-us/cpp/build/reference/compiler-options-listed-by-category?view=msvc-170 - -WHERE sokol-shdc.exe -IF %ERRORLEVEL% NEQ 0 ECHO ERROR download sokol-shdc from https://github.com/floooh/sokol-tools-bin/blob/master/bin/win32/sokol-shdc.exe and put it in this folder - -@REM example of how to compile shaders: sokol-shdc.exe --input triangle.glsl --output triangle.gen.h --slang glsl330:hlsl5:metal_macos - -setlocal enabledelayedexpansion enableextensions -pushd thirdparty\Chipmunk2D\src - set MUNKSRC= - for %%x in (*.c) do set MUNKSRC=!MUNKSRC! thirdparty\Chipmunk2D\src\%%x -popd - -@REM /DENET_DEBUG=1^ -cl /MP /Zi /FS /Fd"flight.pdb" /Fe"flight"^ - /I"thirdparty" /I"thirdparty\minilzo" /I"thirdparty\enet\include" /I"thirdparty\Chipmunk2D\include\chipmunk" /I"thirdparty\Chipmunk2D\include"^ - /DSERVER_ADDRESS="\"127.0.0.1\""^ - main.c gamestate.c server.c debugdraw.c^ - thirdparty\minilzo\minilzo.c^ - thirdparty\enet\callbacks.c thirdparty\enet\compress.c thirdparty\enet\host.c thirdparty\enet\list.c thirdparty\enet\packet.c thirdparty\enet\peer.c thirdparty\enet\protocol.c thirdparty\enet\win32.c Ws2_32.lib winmm.lib^ - %MUNKSRC% \ No newline at end of file +set compileopts=/Fe"flight_debug" /Zi /FS /Fd"flight.pdb" /DSERVER_ADDRESS="\"127.0.0.1\"" +call build_msvc.bat \ No newline at end of file diff --git a/build_msvc.bat b/build_msvc.bat new file mode 100644 index 0000000..a49936e --- /dev/null +++ b/build_msvc.bat @@ -0,0 +1,23 @@ +@echo off + +@REM what all the compile flags mean: https://learn.microsoft.com/en-us/cpp/build/reference/compiler-options-listed-by-category?view=msvc-170 + +WHERE sokol-shdc.exe +IF %ERRORLEVEL% NEQ 0 ECHO ERROR download sokol-shdc from https://github.com/floooh/sokol-tools-bin/blob/master/bin/win32/sokol-shdc.exe and put it in this folder + +@REM example of how to compile shaders: sokol-shdc.exe --input triangle.glsl --output triangle.gen.h --slang glsl330:hlsl5:metal_macos + +setlocal enabledelayedexpansion enableextensions +pushd thirdparty\Chipmunk2D\src + set MUNKSRC= + for %%x in (*.c) do set MUNKSRC=!MUNKSRC! thirdparty\Chipmunk2D\src\%%x +popd + +@REM /DENET_DEBUG=1^ +cl /MP^ + %compileopts%^ + /I"thirdparty" /I"thirdparty\minilzo" /I"thirdparty\enet\include" /I"thirdparty\Chipmunk2D\include\chipmunk" /I"thirdparty\Chipmunk2D\include"^ + main.c gamestate.c server.c debugdraw.c^ + thirdparty\minilzo\minilzo.c^ + thirdparty\enet\callbacks.c thirdparty\enet\compress.c thirdparty\enet\host.c thirdparty\enet\list.c thirdparty\enet\packet.c thirdparty\enet\peer.c thirdparty\enet\protocol.c thirdparty\enet\win32.c Ws2_32.lib winmm.lib^ + %MUNKSRC% \ No newline at end of file diff --git a/build_release.bat b/build_release.bat new file mode 100644 index 0000000..0265510 --- /dev/null +++ b/build_release.bat @@ -0,0 +1,2 @@ +set compileopts=/Fe"flight_release" /O2 +call build_msvc.bat \ No newline at end of file diff --git a/flight.service b/flight.service index 50f2a85..d6f6521 100644 --- a/flight.service +++ b/flight.service @@ -3,6 +3,7 @@ Description=Flight [Service] ExecStart=/root/flight/flight_server +WorkingDirectory=/root/flight Restart=always [Install] diff --git a/release_all.bat b/release_all.bat new file mode 100644 index 0000000..b831016 --- /dev/null +++ b/release_all.bat @@ -0,0 +1,3 @@ +call build_release.bat +call update_server.bat +tar.exe -a -c -f flight-nonumber.zip flight_release.exe loaded \ No newline at end of file diff --git a/server.c b/server.c index a632a2d..fd222d3 100644 --- a/server.c +++ b/server.c @@ -102,7 +102,7 @@ void server(void* world_save_name) /* Bind the server to port 1234. */ address.port = SERVER_PORT; server = enet_host_create(&address /* the address to bind the server host to */, - 32 /* allow up to 32 clients and/or outgoing connections */, + MAX_PLAYERS /* allow up to MAX_PLAYERS clients and/or outgoing connections */, 2 /* allow up to 2 channels to be used, 0 and 1 */, 0 /* assume any amount of incoming bandwidth */, 0 /* assume any amount of outgoing bandwidth */); diff --git a/types.h b/types.h index 244d072..192b671 100644 --- a/types.h +++ b/types.h @@ -1,6 +1,6 @@ #pragma once -#define MAX_PLAYERS 8 +#define MAX_PLAYERS 16 #define MAX_ENTITIES 1024*25 #define BOX_SIZE 0.25f #define PLAYER_SIZE ((V2){.x = BOX_SIZE, .y = BOX_SIZE}) diff --git a/update_server.bat b/update_server.bat new file mode 100644 index 0000000..a63d61a --- /dev/null +++ b/update_server.bat @@ -0,0 +1 @@ +ssh astris "cd flight; git pull; ./linux_server_install.sh" \ No newline at end of file