stream world data from pxl8d to pxl8
This commit is contained in:
parent
39ee0fefb7
commit
a71a9840b2
55 changed files with 5290 additions and 2131 deletions
89
pxl8.sh
89
pxl8.sh
|
|
@ -58,20 +58,20 @@ build_luajit() {
|
|||
|
||||
build_server() {
|
||||
local mode="$1"
|
||||
if [[ -d "server" ]]; then
|
||||
print_info "Building server ($mode mode)"
|
||||
cd server
|
||||
if [[ -d "pxl8d" ]]; then
|
||||
print_info "Building pxl8d ($mode mode)"
|
||||
cd pxl8d
|
||||
if [[ "$mode" == "release" ]]; then
|
||||
cargo build --release
|
||||
cargo build --release --quiet
|
||||
else
|
||||
cargo build
|
||||
cargo build --quiet
|
||||
fi
|
||||
local status=$?
|
||||
cd - > /dev/null
|
||||
if [[ $status -eq 0 ]]; then
|
||||
print_info "Built server"
|
||||
print_info "Built pxl8d"
|
||||
else
|
||||
print_error "Server build failed"
|
||||
print_error "pxl8d build failed"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
|
@ -80,9 +80,9 @@ start_server() {
|
|||
local mode="$1"
|
||||
local server_bin
|
||||
if [[ "$mode" == "release" ]]; then
|
||||
server_bin="server/target/release/pxl8-server"
|
||||
server_bin="pxl8d/target/release/pxl8d"
|
||||
else
|
||||
server_bin="server/target/debug/pxl8-server"
|
||||
server_bin="pxl8d/target/debug/pxl8d"
|
||||
fi
|
||||
print_info "Server mode: $mode, binary: $server_bin"
|
||||
if [[ -f "$server_bin" ]]; then
|
||||
|
|
@ -92,8 +92,8 @@ start_server() {
|
|||
print_info "Server started with PID $SERVER_PID"
|
||||
sleep 0.5
|
||||
else
|
||||
print_error "Server binary not found: $server_bin"
|
||||
print_error "Build the server first with: cd server && cargo build"
|
||||
print_error "pxl8d binary not found: $server_bin"
|
||||
print_error "Build pxl8d first with: cd pxl8d && cargo build"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -105,6 +105,15 @@ stop_server() {
|
|||
fi
|
||||
}
|
||||
|
||||
clean_server() {
|
||||
if [[ -d "pxl8d" ]]; then
|
||||
print_info "Cleaning pxl8d"
|
||||
cd pxl8d
|
||||
cargo clean 2>/dev/null || true
|
||||
cd - > /dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
build_sdl() {
|
||||
if [[ ! -f "lib/SDL/build/libSDL3.so" ]] && [[ ! -f "lib/SDL/build/libSDL3.a" ]] && [[ ! -f "lib/SDL/build/libSDL3.dylib" ]]; then
|
||||
print_info "Building SDL3"
|
||||
|
|
@ -160,9 +169,9 @@ print_usage() {
|
|||
echo
|
||||
echo -e "${BOLD}OPTIONS:${NC}"
|
||||
echo " --all Clean both build artifacts and dependencies"
|
||||
echo " --cache Clear ccache (use with clean)"
|
||||
echo " --deps Clean only dependencies"
|
||||
echo " --release Build/run/clean in release mode (default: debug)"
|
||||
echo " --server Start game server before running (for networked games)"
|
||||
}
|
||||
|
||||
setup_sdl3() {
|
||||
|
|
@ -364,6 +373,8 @@ case "$COMMAND" in
|
|||
build_sdl
|
||||
fi
|
||||
|
||||
build_server "$MODE"
|
||||
|
||||
setup_sdl3
|
||||
print_info "Building pxl8 ($MODE mode)"
|
||||
|
||||
|
|
@ -380,16 +391,19 @@ case "$COMMAND" in
|
|||
LIB_SOURCE_FILES="lib/linenoise/linenoise.c lib/miniz/miniz.c"
|
||||
|
||||
PXL8_SOURCE_FILES="
|
||||
src/asset/pxl8_ase.c
|
||||
src/asset/pxl8_cart.c
|
||||
src/asset/pxl8_save.c
|
||||
src/core/pxl8.c
|
||||
src/core/pxl8_bytes.c
|
||||
src/core/pxl8_io.c
|
||||
src/core/pxl8_log.c
|
||||
src/core/pxl8_replay.c
|
||||
src/core/pxl8_rng.c
|
||||
src/math/pxl8_math.c
|
||||
src/gfx/pxl8_3d_camera.c
|
||||
src/gfx/pxl8_anim.c
|
||||
src/gfx/pxl8_atlas.c
|
||||
src/gfx/pxl8_blit.c
|
||||
src/gfx/pxl8_3d_camera.c
|
||||
src/gfx/pxl8_colormap.c
|
||||
src/gfx/pxl8_cpu.c
|
||||
src/gfx/pxl8_dither.c
|
||||
|
|
@ -404,22 +418,23 @@ case "$COMMAND" in
|
|||
src/gfx/pxl8_tilemap.c
|
||||
src/gfx/pxl8_tilesheet.c
|
||||
src/gfx/pxl8_transition.c
|
||||
src/sfx/pxl8_sfx.c
|
||||
src/script/pxl8_repl.c
|
||||
src/script/pxl8_script.c
|
||||
src/gui/pxl8_gui.c
|
||||
src/hal/pxl8_hal_sdl3.c
|
||||
src/hal/pxl8_mem_sdl3.c
|
||||
src/world/pxl8_bsp.c
|
||||
src/world/pxl8_gen.c
|
||||
src/world/pxl8_world.c
|
||||
src/procgen/pxl8_graph.c
|
||||
src/asset/pxl8_ase.c
|
||||
src/asset/pxl8_cart.c
|
||||
src/asset/pxl8_save.c
|
||||
src/gui/pxl8_gui.c
|
||||
src/core/pxl8_replay.c
|
||||
src/math/pxl8_math.c
|
||||
src/net/pxl8_net.c
|
||||
src/net/pxl8_protocol.c
|
||||
src/procgen/pxl8_graph.c
|
||||
src/script/pxl8_repl.c
|
||||
src/script/pxl8_script.c
|
||||
src/sfx/pxl8_sfx.c
|
||||
src/world/pxl8_bsp.c
|
||||
src/world/pxl8_chunk.c
|
||||
src/world/pxl8_chunk_cache.c
|
||||
src/world/pxl8_entity.c
|
||||
src/world/pxl8_gen.c
|
||||
src/world/pxl8_voxel.c
|
||||
src/world/pxl8_world.c
|
||||
"
|
||||
|
||||
LUAJIT_LIB="lib/luajit/src/libluajit.a"
|
||||
|
|
@ -450,7 +465,8 @@ case "$COMMAND" in
|
|||
NEEDS_REBUILD=false
|
||||
if [[ "$src_file" -nt "$obj_file" ]] || \
|
||||
[[ "src/core/pxl8_types.h" -nt "$obj_file" ]] || \
|
||||
[[ "src/core/pxl8_macros.h" -nt "$obj_file" ]]; then
|
||||
[[ "src/core/pxl8_macros.h" -nt "$obj_file" ]] || \
|
||||
[[ "src/net/pxl8_protocol.h" -nt "$obj_file" ]]; then
|
||||
NEEDS_REBUILD=true
|
||||
fi
|
||||
|
||||
|
|
@ -489,24 +505,18 @@ case "$COMMAND" in
|
|||
|
||||
CART=""
|
||||
EXTRA_ARGS=""
|
||||
RUN_SERVER=false
|
||||
for arg in "$@"; do
|
||||
if [[ "$arg" == "--release" ]]; then
|
||||
MODE="release"
|
||||
elif [[ "$arg" == "--repl" ]]; then
|
||||
EXTRA_ARGS="$EXTRA_ARGS --repl"
|
||||
elif [[ "$arg" == "--server" ]]; then
|
||||
RUN_SERVER=true
|
||||
elif [[ -z "$CART" ]]; then
|
||||
CART="$arg"
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "$RUN_SERVER" == true ]]; then
|
||||
build_server "$MODE"
|
||||
start_server "$MODE"
|
||||
trap stop_server EXIT
|
||||
fi
|
||||
start_server "$MODE"
|
||||
trap stop_server EXIT
|
||||
|
||||
if [[ -z "$CART" ]]; then
|
||||
"$BINDIR/pxl8" $EXTRA_ARGS
|
||||
|
|
@ -517,17 +527,24 @@ case "$COMMAND" in
|
|||
|
||||
clean)
|
||||
CLEAN_ALL=false
|
||||
CLEAN_CACHE=false
|
||||
CLEAN_DEPS=false
|
||||
CLEAN_RELEASE=false
|
||||
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--all) CLEAN_ALL=true ;;
|
||||
--cache) CLEAN_CACHE=true ;;
|
||||
--deps) CLEAN_DEPS=true ;;
|
||||
--release) CLEAN_RELEASE=true ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ "$CLEAN_CACHE" == true ]] && command -v ccache >/dev/null 2>&1; then
|
||||
print_info "Clearing ccache"
|
||||
ccache -C >/dev/null
|
||||
fi
|
||||
|
||||
if [[ "$CLEAN_RELEASE" == true ]]; then
|
||||
BUILD_PATH=".build/release"
|
||||
BIN_PATH="bin/release"
|
||||
|
|
@ -541,6 +558,7 @@ case "$COMMAND" in
|
|||
if [[ "$CLEAN_ALL" == true ]]; then
|
||||
print_info "Removing build artifacts and dependencies"
|
||||
rm -rf "$BUILD_PATH" "$BIN_PATH" lib
|
||||
clean_server
|
||||
print_info "Cleaned all"
|
||||
elif [[ "$CLEAN_DEPS" == true ]]; then
|
||||
print_info "Removing dependencies"
|
||||
|
|
@ -549,6 +567,7 @@ case "$COMMAND" in
|
|||
else
|
||||
print_info "Removing build artifacts"
|
||||
rm -rf "$BUILD_PATH" "$BIN_PATH"
|
||||
clean_server
|
||||
print_info "Cleaned"
|
||||
fi
|
||||
;;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue