diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index db85e66fe..6c901652f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,11 +18,11 @@ jobs: os: macos-latest - name: Android32 - os: ubuntu-latest + os: ubuntu-24.04 target: Android32 - name: Android64 - os: ubuntu-latest + os: ubuntu-24.04 target: Android64 name: ${{ matrix.config.name }} @@ -42,7 +42,7 @@ jobs: package: name: Package builds - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 needs: build steps: diff --git a/.github/workflows/bump_deps_and_lint.yml b/.github/workflows/bump_deps_and_lint.yml new file mode 100644 index 000000000..581e8c5dd --- /dev/null +++ b/.github/workflows/bump_deps_and_lint.yml @@ -0,0 +1,43 @@ +name: Bump Dependencies and Lint + +on: + workflow_dispatch: + push: + +jobs: + bump_deps_and_lint: + name: Bump dependencies and lint + runs-on: ubuntu-24.04 + continue-on-error: true + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Rust + uses: dtolnay/rust-toolchain@nightly + with: + components: rustfmt + + - name: Bump dependencies + run: | + cd server + cargo update --verbose + + - name: Apply fixes + run: | + cd server + cargo fix --allow-dirty --verbose + + - name: Lint and format + run: | + cd server + cargo fmt --all -- --check || cargo fmt --all + + - name: Push changes + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add . + git commit -m "Bump dependencies and lint" + git push origin main --force diff --git a/.github/workflows/server.yml b/.github/workflows/server.yml index a2756d0ac..c21b1a6e7 100644 --- a/.github/workflows/server.yml +++ b/.github/workflows/server.yml @@ -12,12 +12,12 @@ jobs: matrix: include: - name: Linux - os: ubuntu-latest + os: ubuntu-24.04 target: x86_64-unknown-linux-gnu bin-suffix: "-x64" - name: Linux ARM64 - os: ubuntu-latest + os: ubuntu-24.04 target: aarch64-unknown-linux-gnu bin-suffix: "-arm64" @@ -33,7 +33,6 @@ jobs: - name: Setup Rust uses: dtolnay/rust-toolchain@nightly with: - toolchain: nightly target: ${{ matrix.target }} - name: Add Rust target @@ -96,7 +95,7 @@ jobs: shell: bash - name: Copy artifacts (Linux) - if: matrix.os == 'ubuntu-latest' + if: matrix.os == 'ubuntu-24.04' run: | cp server/target/${{ matrix.target }}/release/globed-game-server server/artifacts/globed-game-server${{ matrix.bin-suffix }} || : cp server/target/${{ matrix.target }}/release/globed-central-server server/artifacts/globed-central-server${{ matrix.bin-suffix }} || : @@ -110,7 +109,7 @@ jobs: merge: name: Merge artifacts - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 needs: build steps: - name: Merge artifacts diff --git a/CMakeLists.txt b/CMakeLists.txt index b0450943f..5c31e0dea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,79 +1,57 @@ cmake_minimum_required(VERSION 3.21) + set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_VISIBILITY_PRESET hidden) -project(globed2 VERSION 1.0.1) +project(globed2 VERSION 1.0.0) -# set ios archs if (${CMAKE_SYSTEM_NAME} STREQUAL "iOS") - message(STATUS "building for ios") unset(CMAKE_OSX_ARCHITECTURES) set(CMAKE_OSX_ARCHITECTURES "arm64") set(CMAKE_OSX_DEPLOYMENT_TARGET "14.0") set(CMAKE_SYSTEM_NAME "iOS") else() - message(STATUS "building for mac") set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64") endif() option(GLOBED_OSS_BUILD "Open source build that does not require closed-source dependencies" OFF) option(GLOBED_NATIVE_ARCH "Native architecture build" OFF) -# on windows use precompiled, on other platforms compile libsodium if (WIN32) option(GLOBED_COMPILE_LIBS "Don't use precompiled libraries and compile manually" OFF) else() option(GLOBED_COMPILE_LIBS "Don't use precompiled libraries and compile manually" ON) endif() -# check if compiler is clang if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(GLOBED_IS_CLANG ON) else() set(GLOBED_IS_CLANG OFF) endif() -# check if it's clang-cl or clang if (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU") set(GLOBED_IS_CLANG_CL OFF) else() set(GLOBED_IS_CLANG_CL ON) endif() - -# Check for debug build option(ENABLE_DEBUG "Debug mode" OFF) option(GLOBED_RELEASE "Release build" OFF) if (CMAKE_BUILD_TYPE STREQUAL "Debug" OR "${CMAKE_BUILD_TYPE}asdf" STREQUAL "asdf" OR ENABLE_DEBUG) set(GLOBED_IS_DEBUG ON) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_HAS_ITERATOR_DEBUGGING=0") endif() -# Debug/Release options if (GLOBED_IS_DEBUG) add_compile_definitions(GLOBED_DEBUG=1) add_compile_definitions(GEODE_DEBUG=1) add_compile_definitions(ASP_ENABLE_DEBUG=1) - - # # turn on asan - # if (GLOBED_IS_CLANG) - # if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/libs/stl_asan.lib") - # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address") - # set(GLOBED_LINK_TO_ASAN ON) - # endif() - - # # no omit frame pointer - # if (NOT GLOBED_IS_CLANG_CL) - # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer") - # endif() - # endif() elseif (GLOBED_RELEASE) - # Enable LTO in release (2.5x less binary size, costs only a few extra seconds of build time) set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) endif() -# add thingies depending on the current system if (ANDROID) file(GLOB_RECURSE OS_SOURCES "src/platform/os/android/*.cpp" "src/platform/arch/arm/*.cpp") elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "iOS") @@ -86,27 +64,25 @@ else() message(FATAL_ERROR "Unsupported operating system") endif() -# source files file(GLOB_RECURSE SOURCES - src/audio/*.cpp - src/crypto/*.cpp - src/data/*.cpp + src/audio/*.cpp + src/crypto/*.cpp + src/data/*.cpp src/globed/*.cpp - src/game/*.cpp - src/hooks/*.cpp - src/managers/*.cpp - src/net/*.cpp - src/ui/*.cpp - src/util/*.cpp - src/main.cpp + src/game/*.cpp + src/hooks/*.cpp + src/managers/*.cpp + src/net/*.cpp + src/ui/*.cpp + src/util/*.cpp + src/main.cpp ${OS_SOURCES} ) add_library(${PROJECT_NAME} SHARED ${SOURCES}) -# Windows - do stuff if (CMAKE_SYSTEM_NAME STREQUAL "Windows") - add_compile_definitions(WIN32_LEAN_AND_MEAN=1) # geode moment + add_compile_definitions(WIN32_LEAN_AND_MEAN=1) if (NOT MSVC) set(GLOBED_WINDOWS_CLANG ON) endif() @@ -116,7 +92,6 @@ if (GLOBED_RELEASE) target_compile_definitions(${PROJECT_NAME} PRIVATE GLOBED_RELEASE=1) endif() -# export some symbols target_compile_definitions(${PROJECT_NAME} PRIVATE GLOBED_EXPORTING) if (CMAKE_HOST_SYSTEM MATCHES "Linux" AND CMAKE_SYSTEM_NAME STREQUAL "Windows") @@ -131,29 +106,20 @@ endif() add_subdirectory($ENV{GEODE_SDK} ${CMAKE_CURRENT_BINARY_DIR}/geode) -# done so you can include root files with target_include_directories(${PROJECT_NAME} PRIVATE src/) target_include_directories(${PROJECT_NAME} PRIVATE libs/) -# our favorite libraries -CPMAddPackage("gh:dankmeme01/uibuilder#c30755a") +CPMAddPackage("gh:camila314/uibuilder#09c05a5") CPMAddPackage( NAME Boost - VERSION 1.86.0 - URL https://github.com/boostorg/boost/releases/download/boost-1.86.0/boost-1.86.0-cmake.7z - URL_HASH SHA256=ee6e0793b5ec7d13e7181ec05d3b1aaa23615947295080e4b9930324488e078f - OPTIONS "BOOST_ENABLE_CMAKE ON" "BOOST_INCLUDE_LIBRARIES describe\\\;stacktrace\\\;thread" # escape with \\\; + VERSION 1.87.0 + URL https://github.com/boostorg/boost/releases/download/boost-1.87.0/boost-1.87.0-cmake.7z + URL_HASH SHA256=61d61a3f33283bab8f3736745a4e47c37141f07e413986cd05d1f942c69d529a + OPTIONS "BOOST_ENABLE_CMAKE ON" "BOOST_INCLUDE_LIBRARIES describe\\\;stacktrace\\\;thread" ) CPMAddPackage("gh:dankmeme01/asp2#2378a82") -# asp defines if (WIN32) - if (GLOBED_IS_DEBUG) - # debug - target_compile_definitions(asp PRIVATE _HAS_ITERATOR_DEBUGGING=0) - endif() - - # thingy target_compile_definitions(asp PRIVATE ASP_ENABLE_FORMAT=1) target_compile_definitions(${PROJECT_NAME} PRIVATE ASP_ENABLE_FORMAT=1) endif() @@ -165,30 +131,15 @@ include(cmake/baked_resources_gen.cmake) generate_baked_resources_header("${CMAKE_CURRENT_SOURCE_DIR}/embedded-resources.json" "${CMAKE_CURRENT_BINARY_DIR}/globed-codegen/embedded_resources.hpp") if (GLOBED_NATIVE_ARCH) - # Apply native architecture add_compile_options("-march=native") endif() if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") target_compile_options(${PROJECT_NAME} PRIVATE "-Wno-deprecated-declarations") - # target_compile_options(${PROJECT_NAME} PRIVATE "-ftime-trace") - # target_compile_options(asp PRIVATE "-ftime-trace") - # if (WIN32) - # target_compile_options(${PROJECT_NAME} PRIVATE "-Wno-vla-cxx-extension") - # endif() endif() target_link_libraries(${PROJECT_NAME} UIBuilder Boost::describe Boost::thread asp) -# if (GLOBED_LINK_TO_ASAN) -# target_link_libraries( -# ${PROJECT_NAME} -# "${CMAKE_CURRENT_SOURCE_DIR}/libs/stl_asan.lib" -# "${CMAKE_CURRENT_SOURCE_DIR}/libs/clang_rt.asan_dynamic-x86_64.lib" -# "${CMAKE_CURRENT_SOURCE_DIR}/libs/clang_rt.asan_dynamic_runtime_thunk-x86_64.lib" -# ) -# endif() - if (GLOBED_IS_DEBUG) target_link_libraries(${PROJECT_NAME} Boost::stacktrace) endif() @@ -197,14 +148,12 @@ if (GLOBED_COMPILE_LIBS) CPMAddPackage("gh:dankmeme01/libsodium-cmake#226abba") CPMAddPackage("gh:xiph/opus#v1.5.2") - # disable some warnings if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") target_compile_options(sodium PRIVATE "-Wno-inaccessible-base" "-Wno-pointer-sign" "-Wno-user-defined-warnings") endif() target_link_libraries(${PROJECT_NAME} sodium opus) else() - # download headers (binaries based off of 1.0.20 too) CPMAddPackage( NAME sodium GIT_REPOSITORY "https://github.com/jedisct1/libsodium.git" @@ -229,40 +178,26 @@ else() set(SODIUM_VERSION_IN "${CMAKE_CURRENT_SOURCE_DIR}/libs/sodium/version.h") set(SODIUM_VERSION_OUT "${sodium_SOURCE_DIR}/src/libsodium/include/sodium/") - if (NOT EXISTS "${SODIUM_VERSION_OUT}/version.h") - message(STATUS "Copied version.h to ${SODIUM_VERSION_OUT}") file(COPY "${SODIUM_VERSION_IN}" DESTINATION "${SODIUM_VERSION_OUT}") - else() - file(READ "${SODIUM_VERSION_IN}" CONTENT_IN) - file(READ "${SODIUM_VERSION_OUT}/version.h" CONTENT_OUT) - - if (NOT "${CONTENT_IN}" STREQUAL "${CONTENT_OUT}") - message(STATUS "Copied version.h to ${SODIUM_VERSION_OUT}") - file(COPY "${SODIUM_VERSION_IN}" DESTINATION "${SODIUM_VERSION_OUT}") - endif() endif() - target_link_libraries(${PROJECT_NAME} sodium opus) + target_link_libraries(${PROJECT_NAME} sodium opus) endif() -# Windows - link to winsock and wmi if (WIN32) target_link_libraries(${PROJECT_NAME} ws2_32) endif() -# Apple - link to iokit if (APPLE) find_library(IOKIT_LIBRARY IOKit) target_link_libraries(${PROJECT_NAME} ${IOKIT_LIBRARY}) endif() -# link to libcurl - CPMAddPackage( NAME curl GIT_REPOSITORY "https://github.com/curl/curl.git" - GIT_TAG "curl-8_11_0" + GIT_TAG "curl-8_11_1" DOWNLOAD_ONLY YES ) @@ -282,9 +217,12 @@ endif() target_compile_definitions(${PROJECT_NAME} PRIVATE CURL_STATICLIB=1) -# we are kinda leeching off of geode but we can always snatch those libraries in the future if (WIN32) - set_target_properties(curl PROPERTIES IMPORTED_LOCATION "$ENV{GEODE_SDK}/loader/include/link/${LIB_PLATFORM}/libcurl.lib") + if (GLOBED_IS_DEBUG) + set_target_properties(curl PROPERTIES IMPORTED_LOCATION "$ENV{GEODE_SDK}/loader/include/link/${LIB_PLATFORM}/gd-libcurl.lib") + else() + set_target_properties(curl PROPERTIES IMPORTED_LOCATION "$ENV{GEODE_SDK}/loader/include/link/${LIB_PLATFORM}/libcurl.lib") + endif() else() set_target_properties(curl PROPERTIES IMPORTED_LOCATION "$ENV{GEODE_SDK}/loader/include/link/${LIB_PLATFORM}/libcurl.a") endif() @@ -293,25 +231,21 @@ target_include_directories(${PROJECT_NAME} PRIVATE "${curl_SOURCE_DIR}/include") target_link_libraries(${PROJECT_NAME} curl) -# mac needs this for curl if (APPLE) target_link_libraries(${PROJECT_NAME} z) elseif (WIN32) - # windows needs this ig? target_link_libraries(${PROJECT_NAME} crypt32) elseif (ANDROID) target_link_libraries(${PROJECT_NAME} android) endif() - -# link to bb if (GLOBED_OSS_BUILD) message(STATUS "Building open-source version, not linking to bb") target_compile_definitions(${PROJECT_NAME} PRIVATE GLOBED_OSS_BUILD=1) else() if (WIN32) target_link_libraries(${PROJECT_NAME} "${CMAKE_CURRENT_SOURCE_DIR}/libs/bb/bb.lib") - target_link_libraries(${PROJECT_NAME} ntdll.lib userenv.lib runtimeobject.lib Iphlpapi.lib) + target_link_libraries(${PROJECT_NAME} ntdll.lib userenv.lib runtimeobject.lib Iphlpapi.lib bcrypt.lib) else () target_link_libraries(${PROJECT_NAME} "${CMAKE_CURRENT_SOURCE_DIR}/libs/bb/bb-${LIB_PLATFORM}.a") endif() diff --git a/LICENSE b/LICENSE index 1627d5463..e45a70842 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 dank_meme +Copyright (c) 2025 dank_meme Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 35af3a811..138bb8f60 100644 --- a/README.md +++ b/README.md @@ -8,11 +8,11 @@ Globed is a [Geode](https://geode-sdk.org/) mod, so it requires you to install G ## Features -* Real-time multiplayer -* Completely free and open-source, easy to host your own server -* Available for Windows, Android and MacOS -* In-game voice & text chat -* Public & private rooms +- Real-time multiplayer +- Completely free and open-source, easy to host your own server +- Available for Windows, Android, and MacOS +- In-game voice & text chat +- Public & private rooms ## Hosting a server @@ -22,35 +22,45 @@ See the [server readme](./server/readme.md) for more information about hosting a Build like any other mod, see [Geode documentation](https://docs.geode-sdk.org/getting-started/cpp-stuff). -Only compiler supported is Clang, MSVC is unsupported since release v1.7.0 (for Geode v4). If compiling on linux, clang-cl is required instead of regular clang. +- Only compiler supported is Clang, MSVC is unsupported since release v1.7.0 (for Geode v4). +- If compiling on Linux, `clang-cl` is required instead of regular clang. ## Credit Globed is made by: -* [dank_meme](https://github.com/dankmeme01) - owner and main developer -* [availax](https://availax.xyz/) - co-owner, community manager, artist -* [ItzKiba](https://github.com/ItzKiba/) - artist, developer -* [TechStudent10](https://github.com/TechStudent10) - developer -* [ninXout](https://github.com/ninXout/) - developer +- [dank_meme](https://github.com/dankmeme01) - Owner and main developer +- [availax](https://availax.xyz/) - Co-owner, community manager, artist +- [ItzKiba](https://github.com/ItzKiba) - Artist, developer +- [TechStudent10](https://github.com/TechStudent10) - Developer +- [ninXout](https://github.com/ninXout) - Developer and the rest of our awesome [contributors](https://github.com/GlobedGD/globed2/graphs/contributors)! -Special thanks: +**Special thanks**: -* MathieuAR - for providing us server hosting -* HJfod - for making [our website](https://globed.dev) -* alk1m123 - for working together for EditorCollab interoperability -* Alphalaneous - for making the DeathLink mod and allowing us to take their idea and implement it in Globed -* [Everyone from the Geode Team](https://github.com/orgs/geode-sdk/people) - for making Geode -* Server staff and supporters - for helping in shaping this mod to be what it is today :) +- MathieuAR - For providing us with server hosting +- HJfod - For creating [our website](https://globed.dev) +- alk1m123 - For collaborating on EditorCollab interoperability +- Alphalaneous - For creating the DeathLink mod and allowing us to implement their idea into Globed +- [Everyone from the Geode Team](https://github.com/orgs/geode-sdk/people) - For developing Geode +- Server staff and supporters - For helping shape this mod into what it is today :) ### Licenses Globed is licensed under the MIT license. All of the following libraries used in Globed have their own licenses you may want to read: -* Geode - [website](https://geode-sdk.org) - [repository](https://github.com/geode-sdk/geode) - [license](https://github.com/geode-sdk/geode/blob/main/LICENSE.txt) -* Boost - [website](https://boost.org) - [repository](https://github.com/boostorg/boost) - [license](https://github.com/boostorg/boost/blob/master/LICENSE_1_0.txt) -* UIBuilder - [repository](https://github.com/camila314/uibuilder) - [license](https://github.com/camila314/uibuilder/blob/main/LICENSE) -* Opus - [website](https://opus-codec.org/) - [repository](https://github.com/xiph/opus) - [license](https://github.com/xiph/opus/blob/master/COPYING) -* libsodium - [website](https://libsodium.gitbook.io/doc/) - [repository](https://github.com/jedisct1/libsodium) - [license](https://github.com/jedisct1/libsodium/blob/master/LICENSE) +- **Geode** + [website](https://geode-sdk.org/) | [repository](https://github.com/geode-sdk/geode) | [license](https://github.com/geode-sdk/geode/blob/main/LICENSE.txt) + +- **Boost** + [website](https://www.boost.org/) | [repository](https://github.com/boostorg/boost) | [license](https://github.com/boostorg/boost/blob/master/LICENSE_1_0.txt) + +- **UIBuilder** + [repository](https://github.com/camila314/uibuilder) | [license](https://github.com/camila314/uibuilder/blob/main/LICENSE) + +- **Opus** + [website](https://opus-codec.org/) | [repository](https://github.com/xiph/opus) | [license](https://github.com/xiph/opus/blob/main/COPYING) + +- **libsodium** + [website](https://libsodium.gitbook.io/doc) | [repository](https://github.com/jedisct1/libsodium) | [license](https://github.com/jedisct1/libsodium/blob/master/LICENSE) diff --git a/about.md b/about.md index 59cd50841..acc5eb61d 100644 --- a/about.md +++ b/about.md @@ -4,35 +4,35 @@ Globed is an open-source, highly customizable multiplayer mod for Geometry Dash. ## Usage -In the main menu, an extra button is added to the bottom row. This button opens the Globed Menu, where you can join a server and start playing online with other people. +In the main menu, an extra button is added to the bottom row. This button opens the Globed Menu, where you can join a server and start playing online with others. -If you have any issues, suggestions or just want to see the development of the mod, you can join our [discord server](https://discord.gg/d56q5Dkdm3)! +If you have any issues, suggestions, or just want to follow the development of the mod, you can join our [Discord server](https://discord.gg/d56q5Dkdm3)! ## Support Globed is a completely free mod, and will never require any payment to use. -But if you want to support the developer and help us pay for server expansions, you can do it on our [Ko-Fi page](https://ko-fi.com/globed)! +However, if you'd like to support the developer and help us with server expansions, you can contribute through our [Ko-Fi page](https://ko-fi.com/globed)! -As a sign of appreciation, you will get a nice purple name and a badge in-game, and a role on our discord server :) +As a token of appreciation, you will receive a purple name, an in-game badge, and a special role on our Discord server. :) ## Credit Globed is made by: -* [dank_meme](user:9735891) - owner and main developer -* [availax](user:1621348) - co-owner, community manager, artist -* [ItzKiba](user:4569963) - artist, developer -* [TechStudent10](user:20284359) - developer -* [ninXout](user:7479054) - developer +- [dank_meme](user:9735891) - Owner and main developer +- [availax](user:1621348) - Co-owner, community manager, artist +- [ItzKiba](user:4569963) - Artist, developer +- [TechStudent10](user:20284359) - Developer +- [ninXout](user:7479054) - Developer and the rest of our awesome [contributors](https://github.com/GlobedGD/globed2/graphs/contributors)! -Special thanks: +### Special thanks: -* [MathieuAR](user:3759035) - for providing us server hosting -* [HJfod](user:104257) - for making [our website](https://globed.dev) -* [alk1m123](user:11535118) - for working together for EditorCollab interoperability -* [Alphalaneous](user:1139015) - for making the DeathLink mod and allowing us to take their idea and implement it in Globed -* [Everyone from the Geode Team](https://github.com/orgs/geode-sdk/people) - for making Geode -* Server staff and supporters - for helping in shaping this mod to be what it is today :) +- [MathieuAR](user:3759035) - For providing us with server hosting +- [HJfod](user:104257) - For creating [our website](https://globed.dev) +- [alk1m123](user:11535118) - For collaborating on EditorCollab interoperability +- [Alphalaneous](user:1139015) - For creating the DeathLink mod and allowing us to implement their idea into Globed +- [Everyone from the Geode Team](https://github.com/orgs/geode-sdk/people) - For developing Geode +- Server staff and supporters - For helping shape this mod into what it is today :) diff --git a/assets/guides/launch-args.md b/assets/guides/launch-args.md index 138fee467..79ded09e1 100644 --- a/assets/guides/launch-args.md +++ b/assets/guides/launch-args.md @@ -1,28 +1,27 @@ -# Globed launch arguments +# Globed Launch Arguments -Globed has a few launch arguments that might be useful in troubleshooting certain issues or just debugging. To enable them, pass the options into either the command line when launching the executable (if invoking directly), in steam launch options section, or in Geode launcher settings (if on Android). +Globed has several launch arguments that can be useful for troubleshooting or debugging. To enable them, pass the options into either the command line when launching the executable (if invoking directly), in the Steam launch options section, or in the Geode launcher settings (if on Android). -Make sure to use the full format and prefix the option name with `globed-`, so if an option is called `skip-preload`, the full launch option is called `--geode:globed-skip-preload` +## Asset Preloading -## Asset preloading - -`debug-preload` - enables printing of a ton of extra information during asset preloading, so that in case there's a crash or a texture corruption isuse, it can be debugged easier. - -`skip-preload` - forces asset preloading to be disabled, no matter the in-game settings. +- **`--geode:globed-debug-preload`**: Enables extra logging during asset preloading. This is helpful in diagnosing crashes or texture corruption issues. + +- **`--geode:globed-skip-preload`**: Forces asset preloading to be disabled, regardless of in-game settings. ## Troubleshooting -`skip-resource-check` - skips the resource check at the startup, which would cause globed to be unusable if a texture mismatch was detected (usually because of an outdated texture pack that modifies globed textures). - -`no-ssl-verification` - disables SSL certificate verification, useful if you can't connect to the server with an error similar to "SSL peer certificate or SSH remote key was not OK." - -`crt-fix` - unused in release builds, if you are a developer using Wine and experiencing hangs on launch, you may check `src/platform/os/windows/setup.cpp` for more information. - -## Debugging (more dev centered) - -`tracing` - enables some extra logging. +- **`--geode:globed-skip-resource-check`**: Skips the resource check at startup. This can be helpful if there’s a texture mismatch, often caused by outdated texture packs that modify Globed textures. + +- **`--geode:globed-no-ssl-verification`**: Disables SSL certificate verification. This option is useful if you're unable to connect to the server with an error like "SSL peer certificate or SSH remote key was not OK." -`verbose-curl` - enables verbose curl logging (can help figure out problems with web requests) +- **`--geode:reset-settings`**: - Resets all Globed settings. + +- **`--geode:globed-crt-fix`**: This is not used in release builds. However, if you are a developer using Wine and experiencing launch hangs, you may find more details in `src/platform/os/windows/setup.cpp`. -`fake-server-data` - emulates a more lively server, for example, even if the server has no players connected to it, with this option, there will be a lot of fake players on the player list. same with fake levels and rooms. **ONLY** works in debug builds (`-DGLOBED_DEBUG=ON` was set when building the mod) +## Debugging (Developer-Centered) +- **`--geode:globed-tracing`**: Enables additional logging to help with debugging. + +- **`--geode:globed-verbose-curl`**: Enables verbose curl logging, which can be helpful for diagnosing issues with web requests. + +- **`--geode:globed-fake-server-data`**: Simulates a more active server environment. Even if there are no players connected to the server, this option will populate the player list with fake players, and generate fake levels and rooms. **ONLY** works in debug builds (`-DGLOBED_DEBUG=ON` set during mod build). diff --git a/changelog.md b/changelog.md index 2d49a2950..29bcb176f 100644 --- a/changelog.md +++ b/changelog.md @@ -1,418 +1,214 @@ -## v1.7.2 - -* Make some corrections to the texture pack detection algorithm -* Fix rare crash when viewing changelog popup -* Fix rare crash caused by a race condition - -## v1.7.1 - -* Fix room password popup having broken UI - -## v1.7.0 - -* Port to Geode v4.0.0 -* Added a 2-player mode room setting, allowing you to play 2-player levels with a remote friend -* Added a way to filter levels in the Globed level list -* Added a mechanism that allows for compatibility with outdated mod versions and game versions -* Make the direct connection popup allow for 64 characters in the address instead of 21 -* Added some guides to the GitHub repository (currently only a guide on how to use certain launch options) -* Added a 'cheat indicator' to the room creation UI, to show which settings enable safe mode -* Improve error messages in failed web requests -* Improve sliders (volume, etc.) in UI, now no longer squished! -* Improve server security & performance -* Improve packet fragmentation algorithm -* Revamp moderator panel -* Add a way to override the main server URL (for GDPS owners). The searched sources are, in order: -* \-- `GLOBED_MAIN_SERVER_URL` environment variable -* \-- `globed-server-url.txt` in the game folder -* \-- `globed-server-url.txt` in the mod config folder -* \-- `globed-server-url.txt` in the mod save directory -* \-- Default value, `https://main.globed.dev` -* Fix crash when trying to join a room with an unlisted/deleted level -* Fix minor memory leak whenever any player leaves the level :P (thanks sleepyut) -* Fix crashes when using an outdated texture pack that modifies Globed textures -* Fix some logic issues in the audio recording system -* Fix a rare crash during closing the game that no one except Brittank88 ever experienced :D -* Fix rare multithreading crash when loading into the main menu - -## v1.6.2 - -* Fix crashes on some Windows devices - -## v1.6.1 - -* Fix crash when pressing any key on Mac -* Fix crash when opening the globed menu on Mac -* Fix player list looking weird after leaving a room with a pinned level -* In Death Link, faster reset will now be enabled for everyone if the room creator has it enabled -* Add verification for discord linking -* Only show 1 badge near a player's name when in a level - -## v1.6.0 - -* Add a way to pin a specific level in a room -* \-- If you are a room creator, there will now be a new button whenever opening an online level -* \-- The chosen level will be pinned at the top of the player list in the globed menu -* \-- Thanks [TechStudent10](user:20284359) for implementing this (and [Dasshu](user:1975253) for the textures!) -* Add a popup showing the changelog of the most recent update -* Change the invisibility button to instead open a popup with more advanced options -* \-- You can now choose to separately hide yourself from the player list, the level, or the invite list -* Add a new Discord bot for supporters to be able to obtain their in-game roles without having to ask a staff member -* Show all the badges of a player instead of just one at a time (for example Mod & Booster) (thanks [Kiba](user:4569963) -* When playing in a Death Link room, the faster reset option is now forcefully disabled for all players (to prevent desync) -* Automatically block invites from users that you have blocked on GD -* Change the player list to sort players in a random order, to fight against people making alt accounts to promote their levels -* Add a Force Progress Bar setting, that makes it so that the progress bar is enabled if you are connected to the server, when it's otherwise disabled (thanks TechStudent10!) -* Add Node IDs dependency -* Remove Custom Keybinds dependency from Android, as it was unused -* Various security improvements +### 1.7.2 +- Corrected texture pack detection algorithm +- Fixed rare crash when viewing changelog popup +- Fixed rare crash caused by a race condition + +### v1.7.1 +- Fixed broken UI in room password popup + +### v1.7.0 +- Ported to Geode v4.0.0 +- Added **2-player mode room setting**, enabling remote 2-player levels +- Added **level filtering** in the Globed level list +- Introduced compatibility for **outdated mod versions and game versions** +- Allowed **64 characters** in the direct connection popup address +- Added GitHub guides (currently about launch options) +- Added **cheat indicator** in the room creation UI to highlight safe mode settings +- Enhanced error messages for failed web requests +- Improved UI sliders (volume, etc.) +- Enhanced server security & performance +- Revamped packet fragmentation algorithm +- Revamped moderator panel +- Added ability for GDPS owners to override main server URL with several fallbacks +- Fixed crash when joining a room with an unlisted/deleted level +- Fixed minor memory leak when players leave levels +- Fixed crashes with outdated texture packs modifying Globed textures +- Fixed audio recording system logic issues +- Fixed rare crash during game closing +- Fixed multithreading crash when loading into the main menu + +### v1.6.2 +- Fixed crashes on some Windows devices + +### v1.6.1 +- Fixed crash when pressing any key or opening the Globed menu on Mac +- Fixed player list layout issues after leaving a room with a pinned level +- Enabled faster reset for all players in Death Link if the room creator enables it +- Added **verification for Discord linking** +- Showed only 1 badge near a player's name in-game + +### v1.6.0 +- Added ability to **pin specific levels** in a room + - Room creators can now pin levels at the top of the player list in the Globed menu +- Added **changelog popup** showing the latest update details +- Replaced invisibility button with advanced options + - Option to hide yourself from player list, level, or invite list +- Introduced new **Discord bot** for supporters to automatically obtain in-game roles +- Displayed all badges of a player (e.g., **Mod & Booster**) +- Enforced faster reset option in **Death Link** rooms +- Automatically **blocked invites** from blocked users +- Changed player list sorting to **random order** to prevent alt account promotion +- Added **Force Progress Bar** setting for server-connected progress bar +- Removed **Custom Keybinds** dependency from Android +- Improved security Bugfixes: - -* Fixed some login issues (login taking a very long time and sometimes failing for no reason) -* Fixed player names and status icons not rotating together with the camera (i.e. arrow trigger) -* \-- You can return to the old behavior by disabling the "Rotate names" setting -* \-- Thanks [TheSillyDoggo](user:16778880) for implementing this! -* Fixed crash caused by closing the globed menu too fast -* Fixed crash when muting a user that has exited the level -* Fixed room name overlapping other UI elements in the room listing -* Fixed player count going up to 4 digits on android (and cap to 10000 instead of 65535) -* Fixed crash on entering a level when Force Platformer is enabled in Megahack -* Fixed the room listing getting closed when trying to join a room, even if joining fails -* Fixed "Player" with default icons showing up in the player list -* Fixed ship fire showing near invisible players -* Change max web request timeout to be 10 seconds in most places instead of 3 or 5 seconds - -## v1.5.1 - -* Fix Globed not loading on Android due to missing Custom Keybinds dependency - -## v1.5.0 - -* Add a Death Link setting to rooms, which causes all players in the level to die if one of them dies -* \-- **Huge thanks to Alphalaneous for making the DeathLink mod and allowing us to use their idea** -* Add ability for the room owner to close the room (kicks all players) -* Change the Receive Invites From setting to friends only by default instead of everyone -* Fix the player not being disconnected from the server if they log out of their GD account -* Fix crash when closing the featured level list too fast -* Fix spammy error popups on self-hosted servers when no featured level is selected -* Add an age warning to the discord invite button - -## v1.4.5 - -* Add player counts to the featured level list -* Make player names in invites clickable to bring up their profile -* Fix some bugs with the featured level list -* Fix level ordering in the saved tab (again) -* Fix "Receive Invites From" setting crashing the game -* Fix the next arrow button showing on the last page of the featured level list - -## v1.4.4 - -* Add Globed Featured Levels (thanks [Kiba](user:4569963)) -* \-- A level will be chosen every few days to be featured on Globed -* \-- Levels can be rated Featured, Epic and Outstanding -* Levels played on Globed are now put at the top of the saved levels list, rather than the bottom -* Hopefully fix room list not loading on some devices -* Change the icon used in Discord RPC integration to a better one -* Various small fixes and UI changes - -## v1.4.3 - -* Fix crash on ARM MacOS when a player with an animated name is online -* Fix rare crash with devtools -* Add error message when entering wrong room password -* Minor UI changes - -## v1.4.2 - -* Put yourself at the top of the player list (thanks [Kiba](user:4569963)) -* Add integration with the Discord Rich Presence mod -* \-- If you have the mod installed, you will have a special rich presence while playing on Globed -* Playing an unlisted level in the editor will no longer show the level on the level list -* \-- Note: joining an unlisted level NOT through the editor will still cause the level to be shown on the level list, as the game does not know whether the level is unlisted or not. -* Add option to disable multiplayer in the level editor -* Fix crash when completing created levels on ARM MacOS -* Fix server list being broken on MacOS -* Fix joining a room while in a level causing visual glitches until you reopen the level -* Small UI changes and fixes -* Make the main room menu significantly more optimized -* Fix weirdness when opening someone's levels or lists while in a level and then coming back -* Fix hitboxes of mini icons being too big in collision rooms -* Remove version checks when adding a new server -* Small fixes to asset preloading - -## v1.4.1 - -* Add MacOS support -* Improve the room listing (now shows player count/limit and whether the room has collision enabled or a password set) -* Sort room list by player count -* Fix room list not starting at the top -* Fix the Audio Device and Receive Invites From settings not saving when exiting the game -* Fix weirdness when receiving an invite while in a level - -## v1.4.0 - -* Overhaul the room system -* \-- You can now send room invites to other players -* \-- Rooms have various settings, i.e. password, collision, player limit, name, invite-only -* \-- Public room listing that lets you discover rooms without having to be invited -* \-- You can control whether you can be invited by anybody, only friends, or by nobody -* Add user roles -* \-- Staff, supporters, etc. will have special name color, text chat color, and a badge near their name -* \-- Thanks to [LimeGradient](user:7214334), [Terma](user:4706010) and [Capeling](user:18226543) for help! -* Add editor compatibility -* \-- This does **NOT** mean you can build levels together! -* \-- If you are the creator of a level, you will be able to see other people playing while in the editor -* \-- When [EditorCollab by alk1m123](https://github.com/altalk23/EditorCollab) comes out, you will also be able to playtest non-uploaded levels together with others -* \-- Experimental, might have issues -* Add automatic reconnection to the server in case of a disconnect -* Add credits to the globed menu (thanks [TechStudent10](user:20284359) for partial help) -* Fix all unsynced clock issues (auth no longer uses TOTP) -* Fix most "unhandled packet" errors by rewriting networking core -* Fix many connection related bugs -* Ask the user if they want voice chat enabled or not on first startup -* Add a Compressed Player Count setting which changes the "X players" label to be more compact (thanks [Uproxide](user:25397826)!) -* Add support & voice chat guide buttons in the menu (thanks [Kiba](user:4569963) for the design) -* Add a gradient and an icon to your friends on the player list -* Add a way to hide yourself from the player list in menus (thanks [TechStudent10](user:20284359)) -* Redesign the main menus and change textures for many of the icons -* Add much better error messages for outdated clients -* Don't play effects and animations if the player is too far, to decrease lag -* Replace the Overlay settings tab with Menus and move overlay settings into Level UI -* Pin the main server to the top of the server list and disallow deleting or modifying it -* Make some of the UI look better on weird aspect ratios (such as 4:3) -* Fix "already inside of a level" error sometimes appearing when it shouldn't, and add a way to bypass it -* Fix settings menu looking a bit broken due to a Geode update -* Fix the placeholder green icon color being a slightly different shade than the actual default green -* Fix a missing texture crash when asset preloading is disabled -* Fix progress indicator line going out of the progressbar (thanks [Terma](user:4706010)) -* Lots of internal restructuring and rewrites, for improved performance and user experience -* Protocol optimization (slightly less bandwidth usage) -* Change the compiler used for Windows releases - -Some of the features have been co-developed by [ninXout](user:7479054), who has now also become an official Globed developer :) - -## v1.3.7 - -* Add a mysterious button to the room menu -* Fix interpolation issues related to vsync -* Fix being unable to restart a level with the Confirm Restart feature in BetterPause (and other bugs similar to this) - -## v1.3.6 - -* Fix crash on startup on Android - -## v1.3.5 - -* Fix crashes and other weird behavior when opening profiles of others when in a level -* ^ also makes it impossible to open another level while already in a level -* Fix issues with zip file texture packs -* Fix own name setting not working on Mac -* Fix crash when having the confirm quit menu open without a visible pause menu and trying to quit the level (yes this is very specific and there's like 1 person who ever encountered this) -* Fix rare crash when exiting a level -* Fix rare crash when exiting the game - -## v1.3.4 - -* Fix player collision being broken in the editor -* Fix crash when opening player list -* Fix crash when quickly closing the level browser on Android -* Make the icons above players change their opacity too when changing player opacity - -## v1.3.3 - -* Speed up asset preloading even more (death effects now don't preload if they are disabled or if Default death effects is enabled) -* Add a way to hide specific players -* Add an option to load assets when first joining an online level instead of on the loading screen (for Colon) -* Add an option that shows your own name above your icon -* Add ability to copy room IDs by pressing the title -* Death effects and spider animations of other players now play while paused -* Some player animations are now paused when that player is also paused -* Fix some (but not all) crashes related to asset preloading and texture packs -* Fix platformer squish animation looking wrong when jumping sideways from a wall -* Fix (yet again) progressing in levels with start positions - -## v1.3.2 - -* **Improve loading times** - Asset preloading is now up to **3-5 times faster** on Windows (not as fast on other platforms, but still slightly faster) -* Fix rare crash when exiting a level -* Fix some crashes in the level browser on android -* Improve the platformer squish animation slightly -* Make the "outdated client" message more straightforward -* Add player counts to tower levels (**requires** Node IDs mod to be installed first to work) -* Fix progressbar icons having wrong glow when the Colored Icon Kit mod is installed -* Try to fix progressing in levels with startpos (again) -* Try to fix crashes when using a Level Edit hack -* Hide loopback devices from audio settings -* Add a way to manually set packet limit -* Fix players not appearing in a level until you move away from the spawn position - -## v1.3.1 - -* Fix being unable to join a room on some Android devices (due to room ID input being limited to 5 characters) -* Fix the "application was in the background for too long" disconnect error sometimes appearing when it shouldn't -* Fix portal gauntlet progress resetting -* Fix some voice chat crashes on Android -* Fix progressing in levels with start positions -* Fix undeafen notification not showing up in platformers if you had proximity chat on -* Remove voice chat hints on Mac and Android (since you can't really press V there) -* Disable audio device setting on Mac and Android -* Added a report button in the user list that redirects to the Globed Discord -* Server level lists now show up to 30 levels by default, with a new option being added to increase it back to 100 - -## v1.3.0 - -**Add support for Android (both 32-bit and 64-bit) and MacOS!** - -This is a **required** update, and you will not be able to connect to the server until you update the mod. - -Please note that those platforms are not as thoroughly tested, so they may have issues. Additionally, talking in voice chat is **currently impossible** on all platforms except Windows, but you will still be able to hear others. - -Other changes include: - -* Redesign the settings menu to be more convenient (it now has tabs!) -* Enable Lower audio latency by default -* Enable Hide conditionally by default (for ping overlay) -* Add the squish animation for other players whenever they jump in platformer mode -* Add a setting to always show players, even if they are invisible -* Add deafen notifications (can be disabled in settings) -* Add better server messages for failed login attempts -* Add a voice volume slider in the player list on the pause menu -* Add player name colors to the room list -* Slightly improve bandwidth usage by optimizing the protocol -* Made the jump to level button jump to a main level page if it's a classic main level -* Fix the ball icon sometimes being displayed as a cube with Default mini icons enabled -* Fix crashes due to the menu button being removed by another mod -* Fix player count on main levels not animating together with the button -* Fix player count being in a wrong place with Compact Lists installed -* Change the scaling and pop animation of many buttons to look a bit more pretty - -Thank you [Capeling](user:18226543), [ninXout](user:7479054) and [TheSillyDoggo](user:16778880) for their first contributions to the mod in this update :) - -## v1.2.5 - -* Fix crash when browsing levels -* Fix player count label being shown in lists (in a silly place) -* Fix audio test in settings being broken -* Hide player count on levels with no people - -## v1.2.4 - -* Add name colors to player list -* Fix the player count label being displayed when not connected to a server -* Fix player count being displayed in wrong places (like in map pack list) -* Fix the game not closing properly sometimes - -## v1.2.3 - -* Add an option for proximity voice in non-platformer mode -* Add a player count to main levels -* Add player counts to the level browser -* Make it harder to accidentally close an error/notice popup -* Fix dual icon still being visible after exiting dual mode -* Slightly fix the layout of the voice chat overlay cells -* Fix the robot fire staying in the air after death -* Fix name searching in the admin panel - -## v1.2.2 - -* Add a voice overlay to show who's currently speaking -* Don't record audio if voice chat is disabled (oops) -* Try to fix crashes that don't even show an error popup -* Fix a crash when connecting to an invalid server -* Fix login issues when the username has spaces -* Add a setting that lets you change opacity of the icons under the progressbar (or edge of the screen in platformer) -* Scale down the name of a server if it's too long - -## v1.2.1 - -* Refresh server list more often (fixes some crashes and connection issues) -* Make the player list in-game more compact -* Fix some issues with the admin panel - -## v1.2.0 - -* Fix deadlock on packet limit test failure -* Fix audio stack overflow due to high deltatime -* Add a geode setting to disable asset preloading (in case the game doesn't launch) -* Make own icon being above everyone else on the progress bar -* Server owners now have an advanced admin panel to moderate the server - -## v1.1.2 - -* Add player searching in the player list menu -* Fix lag when activating voice chat -* Fix rare audio crashes caused by data races -* Fix crash when changing the Position setting -* Fix crash when editing a central server -* Fix robot fire sometimes randomly appearing in a level -* Fix login failed issue when changing the url of a server - -## v1.1.1 - -* Add pages to the online level list (and fix some levels not appearing) -* Add a Hide Nearby Players setting that allows you to make nearby players transparent -* Fix some more network related issues (specifically keeping the TCP connection alive) -* Fix huge lag related to packet limit & fragmentation -* Fix huge lag when exiting a level -* Fix some audio related issues -* Fix the mute button not working immediately in platformer -* Fix the cube icon being default in levels starting with a non-cube gamemode -* Allow editing the server name even if the server is offline -* Fix being able to quit/resume the level while having the user popup opened on the pause menu -* Fix some lagspikes when recording audio -* Fix crash when connecting to an invalid server - -## v1.1.0 - -Globed now uses a different networking protocol (hybrid TCP/UDP instead of just UDP). This should fix **many (but not all!) of the connection related issues**, such as players not loading in a level, or the player list popup taking an infinite amount of time to load. - -That means this is a **required** update which bumps the protocol version to 2. You will not be able to connect to an updated server without updating the mod to this version. - -If you are a server owner, please read the [server changelog](https://github.com/GlobedGD/globed2/blob/main/server/changelog.md) as there have been some changes to the server. - -Additional changes include: - -* Improve the **account verification** system (and enable it on the main server) -* Fix the freezes/crashes on the loading screen and update the message text at the bottom when loading icons -* Add a connection calibration button in settings (try to use it if you have connection issues) -* (Maybe) fix crash when applying a texture pack with Texture Loader -* Fix audio crash -* Add a volume indicator in the pause menu player list -* Fix the TPS cap setting being impossible to change -* Fix bug with blank names when clicking on a user to open their profile -* Make the mute button work immediately instead of with a delay -* Add an automatic rollback system for a certain save bug related to gauntlets -* ^ in versions before v1.0.5 there used to be a bug that would cause your savefile to have some invalid levels. Now those will be automatically removed on startup. - -## v1.0.5 - -* Preload icons on the loading screen (longer loading time but hopefully a lot less lagspikes in-game now) -* Fix disconnecting when minimizing the game -* Room popup now doesn't auto refresh, and sorts players alphabetically (also your friends are now shown before everyone else!) -* ^ same applies for the in-game player list popup -* Scroll position no longer resets when refreshing a list -* Changed the voice chat volume slider to be ranged from 0% to 200% instead of 100% -* You can now hear yourself when testing audio in settings -* Make asset preloading optional (if you have weird texture bugs, disable it in settings!) -* Hopefully fix a crash when disconnecting the active audio input device -* Maybe fixed death effects crashing the game -* Fix some crashes caused by corrupted data -* Fix gauntlet levels sometimes being broken -* Fix player opacity not working properly on spider and robot -* Add a message indicating how to use voice chat - -## v1.0.4 - -* Make incompatible with More Level Tags (the issues were too hard to fix sorry) -* Make deafening immediate (you will stop hearing others as soon as you press B, no need to wait) -* Fix crashes on old CPUs, now for real - -## v1.0.2 - -* Use github actions for releases (hopefully no more crashes on old CPUs) -* Add a volume slider for voice chat -* Add a button that opens the discord server -* Fixed a crash in the editor -* Fixed an incompatibility with the mod More Level Tags, should no longer crash when opening a level +- Fixed login issues (long login time and occasional failures) +- Fixed player names/status not rotating with camera + - Option to disable name rotation available +- Fixed crash when closing the Globed menu quickly +- Fixed crash when muting players who left the level +- Fixed room name overlapping UI in room listing +- Fixed player count capping at 10000 instead of 65535 +- Fixed crash with **Force Platformer** enabled in Megahack +- Fixed room listing closing when joining a room + +### v1.5.1 +- Fixed Globed not loading on Android due to missing **Custom Keybinds** dependency + +### v1.5.0 +- Added **Death Link** setting to rooms, causing all players to die when one dies +- Added ability for room owners to close rooms (kicks all players) +- Changed default **Receive Invites From** setting to "friends only" +- Fixed player not disconnecting from server when logging out of GD account +- Fixed crash when closing the featured level list too quickly +- Fixed error popups on self-hosted servers when no featured level is selected +- Added **age warning** to Discord invite button + +### v1.4.5 +- Added **player counts** to the featured level list +- Made player names in invites clickable to bring up profiles +- Fixed bugs with the featured level list +- Fixed level ordering in saved tab +- Fixed "Receive Invites From" setting crash + +### v1.4.4 +- Added **Globed Featured Levels** (thanks Kiba) + - Levels rated **Featured**, **Epic**, and **Outstanding** +- Featured levels now appear at the top of saved levels list +- Fixed room list not loading on some devices +- Changed Discord RPC integration icon +- Various small UI fixes + +### v1.4.3 +- Fixed crash on ARM MacOS with animated player names +- Fixed rare crash with devtools +- Added error message when entering wrong room password + +### v1.4.2 +- Displayed yourself at the top of the player list (thanks Kiba) +- Integrated with **Discord Rich Presence mod** + - Special rich presence for players using the mod +- Fixed issue with unlisted levels in editor showing up in the level list +- Added option to **disable multiplayer in level editor** +- Fixed crash when completing created levels on ARM MacOS +- Fixed server list issue on MacOS + +### 1.4.1 +- Added **MacOS support** +- Improved room listing (shows player count/limit, collision settings, password) +- Sorted room list by player count +- Fixed settings not saving when exiting game + +### 1.4.0 +- Overhauled the room system: + - Send room invites to players + - Added password, collision, player limit, and invite-only options + - Public room listing and invite options +- Introduced **user roles** with special badges for staff/supporters +- Added **editor compatibility** (non-collaborative level building) +- Added automatic server reconnection +- Added **credits** to the Globed menu +- Fixed unsynced clock and connection issues +- Added **Force Progress Bar** setting +- Redesigned main menus for better UI + +### 1.3.7 +- Added a mysterious button to the room menu +- Fixed interpolation issues with vsync +- Fixed restarting a level with the **Confirm Restart** feature + +### 1.3.6 +- Fixed crash on startup on Android + +### 1.3.5 +- Fixed crashes when opening other players' profiles in a level +- Fixed texture pack issues with zip files +- Fixed crash when setting the player's name on Mac + +### 1.3.4 +- Fixed player collision issues in the editor +- Fixed crash when opening player list +- Fixed crash when closing level browser on Android + +### 1.3.3 +- Speeded up asset preloading (particularly death effects) +- Added ability to hide specific players +- Fixed animation issues with platformer squish + +### 1.3.2 +- Improved loading times (up to **3-5 times faster**) on Windows +- Fixed rare crashes and asset preloading issues +- Added **player counts** to tower levels + +### 1.3.1 +- Fixed Android issues with room joining +- Fixed **portal gauntlet** progress resetting + +### 1.3.0 +- Added **Android (32/64-bit)** and **MacOS** support +- Redesigned settings menu with tabbed UI +- Added deafen notifications, voice chat improvements +- Fixed oice chat** issues on Mac and Android + +### 1.2.5 +- Fixed crash when browsing levels +- Fixed player count label issues + +### 1.2.4 +- Added name colors in player list +- Fixed player count label and display issues + +### 1.2.3 +- Added **proximity voice** option for non-platformer mode +- Fixed visual glitches and robot fire issues + +### 1.2.2 +- Added voice overlay to show active speakers +- Fixed recording issues when voice chat is disabled + +### 1.2.1 +- Refresh server list more often +- Fixed issues with in-game player list + +### 1.2.0 +- Fixed **deadlock** on packet limit test failure +- Added **Geode setting** to disable asset preloading + +### 1.1.2 +- Added player searching in player list +- Fixed lag and crashes related to voice chat + +### 1.1.1 +- Added pages to the online level list +- Fixed network issues related to keeping TCP connection alive + +### 1.1.0 +- **Networking protocol update** (TCP/UDP hybrid) +- Fixed several connection-related issues +- Added **account verification** + +### 1.0.5 +- Preloaded icons on the loading screen to improve loading speed + +## 1.0.4 +- Make the mod incompatible with More Level Tags (the issues were too hard to fix) +- Make deafening immediate (you will stop hearing others as soon as you press B) +- Fix crashes on old CPUs + +## 1.0.2 +- Use GitHub Actions for releases (hopefully no more crashes on old CPUs) +- Add a volume slider for voice chat +- Add a button that opens the Discord server +- Fixed a crash in the editor +- Fixed an incompatibility with More Level Tags, should no longer crash when opening a level diff --git a/cmake/baked_resources_gen.cmake b/cmake/baked_resources_gen.cmake index 7304b3f55..f1353cb3e 100644 --- a/cmake/baked_resources_gen.cmake +++ b/cmake/baked_resources_gen.cmake @@ -1,11 +1,7 @@ -function (generate_baked_resources_header JSON_FILE HEADER_FILE) - # read the file +function(generate_baked_resources_header JSON_FILE HEADER_FILE) file(READ ${JSON_FILE} JSON_CONTENT) - - # check md5 string(MD5 JSON_HASH "${JSON_CONTENT}") - # do not regenerate the file unless the json was changed if (EXISTS "${HEADER_FILE}" AND EXISTS "${HEADER_FILE}.md5") file(READ "${HEADER_FILE}.md5" JSON_FS_HASH) @@ -26,14 +22,11 @@ function (generate_baked_resources_header JSON_FILE HEADER_FILE) string(APPEND HEADER_CONTENT "constexpr inline const char* stringbyhash(uint32_t hash) {\n") string(APPEND HEADER_CONTENT " switch (hash) {\n") - # fucking kill me string(REGEX MATCHALL "\"([^\"]+)\"[ \t]*:" JSON_KEYS ${JSON_OBJECT}) foreach(CKEY ${JSON_KEYS}) string(REGEX REPLACE "\"([^\"]+)\"[ \t]*:" "\\1" KEY ${CKEY}) - string(JSON VALUE GET ${JSON_OBJECT} ${KEY}) - string(APPEND HEADER_CONTENT " case util::crypto::adler32(\"${KEY}\"): return \"${VALUE}\";\n") endforeach() diff --git a/libs/sodium/version.h b/libs/sodium/version.h index e07ae90d9..249d64e22 100644 --- a/libs/sodium/version.h +++ b/libs/sodium/version.h @@ -1,15 +1,12 @@ - -#ifndef sodium_version_H -#define sodium_version_H +#ifndef SODIUM_VERSION_H +#define SODIUM_VERSION_H #include "export.h" #define SODIUM_VERSION_STRING "1.0.20" - #define SODIUM_LIBRARY_VERSION_MAJOR 26 #define SODIUM_LIBRARY_VERSION_MINOR 2 - #ifdef __cplusplus extern "C" { #endif @@ -18,16 +15,16 @@ SODIUM_EXPORT const char *sodium_version_string(void); SODIUM_EXPORT -int sodium_library_version_major(void); +int sodium_library_version_major(void); SODIUM_EXPORT -int sodium_library_version_minor(void); +int sodium_library_version_minor(void); SODIUM_EXPORT -int sodium_library_minimal(void); +int sodium_library_minimal(void); #ifdef __cplusplus } #endif -#endif +#endif // SODIUM_VERSION_H diff --git a/llgvis/.gitignore b/llgvis/.gitignore index c441a5a90..915abb821 100644 --- a/llgvis/.gitignore +++ b/llgvis/.gitignore @@ -1,4 +1,24 @@ -target +# Generated by Cargo +# will have compiled files and executables +debug/ +target/ + +# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries +# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html Cargo.lock + +# These are backup files generated by rustfmt +**/*.rs.bk + +# MSVC Windows builds of rustc generate these, which store debugging information +*.pdb + +# RustRover +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ + scatter_plot.png -data.txt \ No newline at end of file +data.txt diff --git a/llgvis/Cargo.toml b/llgvis/Cargo.toml index 0c79dc479..30ebe91e4 100644 --- a/llgvis/Cargo.toml +++ b/llgvis/Cargo.toml @@ -1,11 +1,10 @@ [package] name = "llgvis" version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +edition = "2024" [dependencies] esp = { path = "../server/esp" } globed-derive = { path = "../server/derive" } -plotters = "0.3.5" + +plotters = "0.3.7" diff --git a/llgvis/readme.md b/llgvis/readme.md index 8fa919712..768873e81 100644 --- a/llgvis/readme.md +++ b/llgvis/readme.md @@ -1,3 +1,3 @@ # llgvis -interpolation log visualiser \ No newline at end of file +Interpolation log visualiser diff --git a/mod.json b/mod.json index 2ff43a7a1..9f00fdd1e 100644 --- a/mod.json +++ b/mod.json @@ -2,7 +2,7 @@ "id": "dankmeme.globed2", "name": "Globed", "developer": "dankmeme", - "geode": "4.1.0", + "geode": "4.2.0", "version": "v1.7.2", "gd": { "win": "2.2074", @@ -28,7 +28,7 @@ ], "incompatibilities": [], "links": { - "homepage": "https://globed.dev", + "homepage": "https://globed.dev/", "source": "https://github.com/GlobedGD/globed2", "community": "https://discord.gg/d56q5Dkdm3" }, diff --git a/server/Cargo.toml b/server/Cargo.toml index 0cda9274f..c606767ec 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -1,6 +1,6 @@ [workspace] members = ["central", "esp", "game", "derive", "shared", "observer", "observer-shared"] -resolver = "2" +resolver = "3" [profile.release] lto = "fat" diff --git a/server/central/Cargo.toml b/server/central/Cargo.toml index 0ba914844..fe4618f92 100644 --- a/server/central/Cargo.toml +++ b/server/central/Cargo.toml @@ -11,9 +11,9 @@ blake2 = "0.11.0-pre.4" digest = "0.11.0-pre.9" ipnet = "2.10.1" iprange = "0.6.7" -serde = { version = "1.0.215", features = ["serde_derive"] } -serde_json = "1.0.133" -tokio = { version = "1.42.0", features = ["full"] } +serde = { version = "1.0.217", features = ["serde_derive"] } +serde_json = "1.0.135" +tokio = { version = "1.43.0", features = ["full"] } json_comments = "0.2.2" rocket = { version = "0.5.1", features = ["json"] } rocket_db_pools = { version = "0.2.0", features = ["sqlx_sqlite"] } @@ -22,5 +22,5 @@ sqlx = { version = "^0.7.0", features = [ # TODO: rocket_db_pools is broken in s "runtime-tokio-rustls", ] } rocket_cors = "0.6.0" -const_format = "0.2.33" +const_format = "0.2.34" hex = "0.4.3" diff --git a/server/central/build.rs b/server/central/build.rs index 25c393629..b999f9eb7 100644 --- a/server/central/build.rs +++ b/server/central/build.rs @@ -1,4 +1,4 @@ fn main() { - // trigger recompilation when a new migration is added + // Trigger recompilation when a new migration is added println!("cargo:rerun-if-changed=migrations"); } diff --git a/server/central/src/Rocket.toml.template b/server/central/src/Rocket.toml.template index 302662b69..482f6a869 100644 --- a/server/central/src/Rocket.toml.template +++ b/server/central/src/Rocket.toml.template @@ -2,7 +2,7 @@ port = 4201 cli_colors = true -# These are not recommended to change unless you have a reason to +# These are not recommended to change unless you have a reason to. address = "0.0.0.0" ip_header = false diff --git a/server/central/src/allowed_ranges.txt b/server/central/src/allowed_ranges.txt index 03e9c812c..44a54a67f 100644 --- a/server/central/src/allowed_ranges.txt +++ b/server/central/src/allowed_ranges.txt @@ -4,10 +4,10 @@ # In debug or with the "cloudflare_protection" option disabled this file has no impact on anything, no IP addresses will be blocked. # # Use hashtags for comments and separate ranges by newlines. Start with 'v4' or 'v6' depending if it's IPv4 or IPv6. -# NOTE: these are included in the executable at compile time. If you want to change anything here, you have to recompile the server. +# NOTE: These are included in the executable at compile time. If you want to change anything here, you have to recompile the server. -# List of cloudflare IP ranges (from https://www.cloudflare.com/ips/): -# Updated 2023-11-17 +# List of Cloudflare IP ranges (from https://www.cloudflare.com/ips/): +# Updated 2024-12-20 v4 103.21.244.0/22 v4 103.22.200.0/22 @@ -35,4 +35,4 @@ v6 2c0f:f248::/32 # Custom addresses -v4 127.0.0.0/8 \ No newline at end of file +v4 127.0.0.0/8 diff --git a/server/central/src/config.rs b/server/central/src/config.rs index 6f9199c2a..143d8d65b 100644 --- a/server/central/src/config.rs +++ b/server/central/src/config.rs @@ -4,13 +4,14 @@ use std::{ }; use globed_shared::{ + ADMIN_KEY_LENGTH, DEFAULT_GAME_SERVER_PORT, Decodable, Encodable, ServerRole, anyhow::{self, anyhow}, esp::{self, Decodable, Encodable}, - generate_alphanum_string, Decodable, Encodable, ServerRole, ADMIN_KEY_LENGTH, DEFAULT_GAME_SERVER_PORT, + generate_alphanum_string, }; use json_comments::StripComments; use serde::{Deserialize, Serialize}; -use serde_json::{ser::PrettyFormatter, Serializer}; +use serde_json::{Serializer, ser::PrettyFormatter}; /* stinky serde defaults */ diff --git a/server/central/src/db/dbimpl.rs b/server/central/src/db/dbimpl.rs index 7ceed731f..56193ab1b 100644 --- a/server/central/src/db/dbimpl.rs +++ b/server/central/src/db/dbimpl.rs @@ -1,7 +1,7 @@ use std::time::{Duration, SystemTime, UNIX_EPOCH}; -use globed_shared::{debug, AdminPunishUserAction, PunishmentType, ServerUserEntry, UserPunishment}; -use rocket_db_pools::sqlx::{query_as, Result}; +use globed_shared::{AdminPunishUserAction, PunishmentType, ServerUserEntry, UserPunishment, debug}; +use rocket_db_pools::sqlx::{Result, query_as}; use serde::Serialize; use sqlx::{prelude::*, query, query_scalar, sqlite::SqliteRow}; diff --git a/server/central/src/db/mod.rs b/server/central/src/db/mod.rs index eb6b7812c..485332af4 100644 --- a/server/central/src/db/mod.rs +++ b/server/central/src/db/mod.rs @@ -1,7 +1,7 @@ use globed_shared::{error, info}; use rocket::{ - fairing::{self, AdHoc}, Build, Rocket, + fairing::{self, AdHoc}, }; use rocket_db_pools::Database; diff --git a/server/central/src/game_pinger.rs b/server/central/src/game_pinger.rs index 24aa6861e..653978970 100644 --- a/server/central/src/game_pinger.rs +++ b/server/central/src/game_pinger.rs @@ -7,10 +7,10 @@ use std::{ }; use globed_shared::{ - debug, + SyncMutex, debug, esp::{ByteBuffer, ByteBufferExtRead, ByteBufferExtWrite, ByteReader}, rand::{self, Rng}, - warn, SyncMutex, + warn, }; use tokio::net::UdpSocket; diff --git a/server/central/src/verifier.rs b/server/central/src/verifier.rs index ad45977cb..b40ecb6ce 100644 --- a/server/central/src/verifier.rs +++ b/server/central/src/verifier.rs @@ -6,7 +6,7 @@ use std::{ use globed_shared::{ anyhow::bail, - base64::{engine::general_purpose as b64e, Engine as _}, + base64::{Engine as _, engine::general_purpose as b64e}, *, }; @@ -170,20 +170,13 @@ impl AccountVerifier { #[cfg(not(debug_assertions))] trace!( "{} ({} / userid {}): {}", - message.name, - message.account_id, - message.user_id, - message.authcode + message.name, message.account_id, message.user_id, message.authcode ); #[cfg(debug_assertions)] trace!( "{} ({} / userid {}): {} ({})", - message.name, - message.account_id, - message.user_id, - message.authcode, - message.age + message.name, message.account_id, message.user_id, message.authcode, message.age ); } trace!("------------------------------------"); diff --git a/server/central/src/web/guards/decodable.rs b/server/central/src/web/guards/decodable.rs index 64984d81d..1027adf9e 100644 --- a/server/central/src/web/guards/decodable.rs +++ b/server/central/src/web/guards/decodable.rs @@ -2,8 +2,8 @@ use super::*; use globed_shared::esp::{ByteBuffer, ByteBufferExtRead, Decodable, DecodeError}; use rocket::{ - data::{self, FromData, ToByteUnit}, Data, Request, + data::{self, FromData, ToByteUnit}, }; use tokio::io::AsyncReadExt; diff --git a/server/central/src/web/guards/encrypted_json.rs b/server/central/src/web/guards/encrypted_json.rs index a483cf786..adff6f0d6 100644 --- a/server/central/src/web/guards/encrypted_json.rs +++ b/server/central/src/web/guards/encrypted_json.rs @@ -3,8 +3,8 @@ use std::{num::ParseIntError, sync::OnceLock}; use super::*; use globed_shared::{CryptoBox, CryptoBoxError}; use rocket::{ - data::{self, FromData, ToByteUnit}, Data, + data::{self, FromData, ToByteUnit}, }; use serde::de::DeserializeOwned; use tokio::io::AsyncReadExt; diff --git a/server/central/src/web/guards/mod.rs b/server/central/src/web/guards/mod.rs index 8ed8e9a1d..efec2f52f 100644 --- a/server/central/src/web/guards/mod.rs +++ b/server/central/src/web/guards/mod.rs @@ -1,9 +1,9 @@ use std::net::IpAddr; use rocket::{ + Request, http::Status, request::{FromRequest, Outcome}, - Request, }; pub mod check_protocol_; diff --git a/server/central/src/web/mod.rs b/server/central/src/web/mod.rs index e0e20fdfd..0d78cecf5 100644 --- a/server/central/src/web/mod.rs +++ b/server/central/src/web/mod.rs @@ -4,7 +4,7 @@ pub mod responders; pub use guards::*; pub use responders::*; -use rocket::{catch, Request}; +use rocket::{Request, catch}; #[catch(404)] pub fn not_found(_req: &Request) -> &'static str { @@ -33,8 +33,8 @@ pub mod routes { pub use super::*; pub use crate::{db::GlobedDb, state::ServerState}; - pub use rocket::{get, post, State}; - use rocket::{routes, Route}; + use rocket::{Route, routes}; + pub use rocket::{State, get, post}; pub fn build_router() -> Vec { routes![ diff --git a/server/central/src/web/responders/mod.rs b/server/central/src/web/responders/mod.rs index d056cef8b..c74e397c7 100644 --- a/server/central/src/web/responders/mod.rs +++ b/server/central/src/web/responders/mod.rs @@ -1,9 +1,9 @@ use std::error::Error; use rocket::{ + Request, http::Status, response::{Responder, Response}, - Request, }; pub mod maintenance; @@ -13,16 +13,16 @@ pub mod generic; pub use generic::{GenericErrorResponder, WebResult}; pub mod unauthorized_; -pub(crate) use unauthorized_::unauthorized; pub use unauthorized_::UnauthorizedResponder; +pub(crate) use unauthorized_::unauthorized; pub mod bad_request_; -pub(crate) use bad_request_::bad_request; pub use bad_request_::BadRequestResponder; +pub(crate) use bad_request_::bad_request; pub mod not_found_; -pub(crate) use not_found_::not_found; pub use not_found_::NotFoundResponder; +pub(crate) use not_found_::not_found; pub mod encodable; pub use encodable::{CheckedEncodableResponder, EncodableResponder}; diff --git a/server/central/src/web/routes/featured.rs b/server/central/src/web/routes/featured.rs index 869d777dc..80b99a374 100644 --- a/server/central/src/web/routes/featured.rs +++ b/server/central/src/web/routes/featured.rs @@ -1,9 +1,9 @@ use globed_shared::{warn, webhook}; -use rocket::{get, post, serde::json::Json, State}; +use rocket::{State, get, post, serde::json::Json}; use serde::Deserialize; use crate::{ - db::{dbimpl::FeaturedLevelPage, FeaturedLevel, GlobedDb}, + db::{FeaturedLevel, GlobedDb, dbimpl::FeaturedLevelPage}, state::ServerState, web::*, }; diff --git a/server/central/src/web/routes/game_server.rs b/server/central/src/web/routes/game_server.rs index cf5a77d53..5d535f8d2 100644 --- a/server/central/src/web/routes/game_server.rs +++ b/server/central/src/web/routes/game_server.rs @@ -1,12 +1,12 @@ use std::net::IpAddr; use globed_shared::{ - esp::{types::FastString, ByteBuffer, ByteBufferExtWrite}, - logger::debug, GameServerBootData, MAX_SUPPORTED_PROTOCOL, SERVER_MAGIC, + esp::{ByteBuffer, ByteBufferExtWrite, types::FastString}, + logger::debug, }; -use rocket::{post, State}; +use rocket::{State, post}; use crate::{config::UserlistMode, state::ServerState, web::*}; diff --git a/server/central/src/web/routes/public.rs b/server/central/src/web/routes/public.rs index cb52f1d15..1fcbb5d01 100644 --- a/server/central/src/web/routes/public.rs +++ b/server/central/src/web/routes/public.rs @@ -1,12 +1,12 @@ use std::time::{Duration, SystemTime}; use crate::{ - db::{dbimpl::PlayerCountHistoryEntry, GlobedDb}, + db::{GlobedDb, dbimpl::PlayerCountHistoryEntry}, state::ServerState, }; use super::*; -use rocket::{get, serde::json::Json, State}; +use rocket::{State, get, serde::json::Json}; use serde::Serialize; #[derive(Serialize)] diff --git a/server/derive/Cargo.toml b/server/derive/Cargo.toml index 68a45441d..6195f5d85 100644 --- a/server/derive/Cargo.toml +++ b/server/derive/Cargo.toml @@ -8,6 +8,6 @@ proc-macro = true [dependencies] darling = "0.20.10" -proc-macro2 = "1.0.92" -quote = "1.0.37" -syn = { version = "2.0.90", features = ["full"] } +proc-macro2 = "1.0.93" +quote = "1.0.38" +syn = { version = "2.0.96", features = ["full"] } diff --git a/server/derive/readme.md b/server/derive/readme.md index f61911f9f..e4e290e55 100644 --- a/server/derive/readme.md +++ b/server/derive/readme.md @@ -1,3 +1,3 @@ # globed-derive -Derive macros for traits `esp::Encodable`, `esp::Decodable`, `esp::StaticSize`, `esp::DynamicSize`, and `globed_game_server::data::Packet` +Derive macros for traits `esp::Encodable`, `esp::Decodable`, `esp::StaticSize`, `esp::DynamicSize`, and `globed_game_server::data::Packet`. diff --git a/server/derive/src/attrs.rs b/server/derive/src/attrs.rs index 28c05c4db..409ee4a4b 100644 --- a/server/derive/src/attrs.rs +++ b/server/derive/src/attrs.rs @@ -11,11 +11,7 @@ pub(crate) struct BitfieldAttributes { impl BitfieldAttributes { pub fn parse(input: &DeriveInput) -> Option { let res = Self::from_derive_input(input).expect("Failed to parse bitfield attributes"); - if res.on.unwrap_or(false) { - Some(res) - } else { - None - } + if res.on.unwrap_or(false) { Some(res) } else { None } } } diff --git a/server/derive/src/lib.rs b/server/derive/src/lib.rs index 511d17749..7514a1a13 100644 --- a/server/derive/src/lib.rs +++ b/server/derive/src/lib.rs @@ -8,8 +8,8 @@ mod encode; use attrs::{BitfieldAttributes, DynamicSizeAttributes, PacketAttributes}; use darling::FromDeriveInput; use proc_macro::{self, Span, TokenStream}; -use quote::{quote, ToTokens}; -use syn::{parse_macro_input, punctuated::Punctuated, Data, DataStruct, DeriveInput, Meta, Token, Type}; +use quote::{ToTokens, quote}; +use syn::{Data, DataStruct, DeriveInput, Meta, Token, Type, parse_macro_input, punctuated::Punctuated}; /// Implements `Encodable` for the given type, allowing you to serialize it into a `ByteBuffer` or a `FastByteBuffer`. /// For `Encodable` to be successfully derived, for structs, all of the members of the struct must also implement `Encodable`. @@ -35,7 +35,7 @@ pub fn derive_encodable(input: TokenStream) -> TokenStream { return quote! { compile_error!("Encodable cannot be derived for unions"); } - .into() + .into(); } }; diff --git a/server/esp/readme.md b/server/esp/readme.md index fc7180635..d4f64d932 100644 --- a/server/esp/readme.md +++ b/server/esp/readme.md @@ -1,14 +1,12 @@ # esp -lightweight binary serialization library. derive macros for `Encodable`, `Decodable`, `StaticSize` and `DynamicSize` will be found in the `derive` crate, not here. +`esp` is a lightweight binary serialization library. It provides derive macros for `Encodable`, `Decodable`, `StaticSize`, and `DynamicSize` found in the `derive` crate, not here. -name meaning - **e**fficient **s**erialization **p**rotocol + a play on the stack pointer register on x86 since the crate also provides types like `FastByteBuffer` and `FastString` making heapless encoding easier. +The name stands for **e**fficient **s**erialization **p**rotocol, and is also a play on the x86 stack pointer register, as the crate includes types like `FastByteBuffer` and `FastString`, which make heapless encoding easier. ## Encodable and Decodable -it's just encoding structs to binary data. or the other way around. do i really need to say more - -though, one special feature is bitfield structs. they are done like this: +`esp` enables encoding structs to binary data and decoding them back. While this may sound simple, one special feature of the library is its support for **bitfield structs**. Bitfields can be defined as follows: ```rust #[derive(Encodable, Decodable, StaticSize)] @@ -25,83 +23,69 @@ assert!(Flags::ENCODED_SIZE == 2); // without `size = 2` would've been 1 byte, w ## StaticSize and DynamicSize -Short primer on those traits - - -`StaticSize` is a trait with a single constant integer, so there is zero runtime overhead and any usages can be inlined. However it is imprecise and only indicates the *maximum* permitted size, which means that after calling `buffer.write_value(val: &T) where T: StaticSize`, the amount of bytes written is equal to *or less than* `T::ENCODED_SIZE`. - -`DynamicSize` is a trait with a non-static method, which is used to calculate the precise encoded size. If the object hasn't been mutated between the two calls, there is a guarantee that the result of `val.encoded_size()` will be exactly the amount of bytes written with `buffer.write_value(&val)`. This precision, however, comes with a downside of a runtime calculation, as this will have to go through every struct member and check their sizes in order to calculate the exact size of the encoded data. +### `StaticSize` +`StaticSize` is a trait with a single constant integer, which introduces zero runtime overhead, and all usages can be inlined. However, it is imprecise, as it only indicates the *maximum* size allowed. Therefore, the bytes written by `buffer.write_value(val: &T) where T: StaticSize` will be less than or equal to `T::ENCODED_SIZE`. -It is encouraged that every type (except for packets) that implements `StaticSize` must also implement `DynamicSize`, or else it would not be possible to derive `DynamicSize` for a struct containing such types. For efficiency purposes, the crate provides `dynamic_size_as_static_impl!` macro which would automatically implement `DynamicSize` for a struct that implements `StaticSize`, and that implementation would just return the static size instead of doing any calculations. That is also available as a derive macro atribute `#[dynamic_size(as_static = true)]` +### `DynamicSize` +`DynamicSize` is a trait with a method used to calculate the precise encoded size. If the object hasn't been mutated, `val.encoded_size()` will return the exact amount of bytes written by `buffer.write_value(&val)`. However, calculating this involves runtime overhead, as the method must check the size of every struct member to calculate the precise encoded data size. -Implementer guide (only needed if you can't or don't want to derive): +### Implementing StaticSize and DynamicSize +For efficiency, it’s recommended that every type (except for packets) implementing `StaticSize` should also implement `DynamicSize`. The crate offers the `dynamic_size_as_static_impl!` macro to automatically implement `DynamicSize` for a type that implements `StaticSize`, which will return the static size instead of calculating it. -* If the size is known to be a constant N, implement both traits to return N. -* If the size is known to be from 0 to N (inclusive), and N is small enough that memory allocation overhead doesn't matter, implement `StaticSize` to be N, and implement `DynamicSize` to calculate and return the exact encoded size. -* If the size is too unpredictable (for example `Vec` which has unlimited size), only implement `DynamicSize`. +#### Implementation Guide: +- If the size is known to be a constant N, implement both `StaticSize` and `DynamicSize` to return N. +- If the size varies from 0 to N and memory overhead is minimal, implement `StaticSize` as N and `DynamicSize` to return the exact size. +- If the size is unpredictable (e.g., `Vec` with unlimited elements), only implement `DynamicSize`. -You should **not** use `StaticSize`/`ENCODED_SIZE` *at all* when implementing `DynamicSize`, except for types that have an *actual constant size* (like primitive integers). For example, do not implement `DynamicSize` for `Vec` with the implementation `self.len() * T::ENCODED_SIZE`. This is a bad idea, and while it may work properly for something like `Vec`, it will produce incorrect results for something like `Vec>`. The entire point of `DynamicSize` is to be *accurate*, whereas `StaticSize` is made to be *fast*. +**Important**: You should not use `StaticSize`/`ENCODED_SIZE` when implementing `DynamicSize` (except for types with a constant size like primitive integers). For example, avoid implementing `DynamicSize` for `Vec` using the formula `self.len() * T::ENCODED_SIZE`, as it will lead to incorrect results in certain cases (e.g., `Vec>`). -## Ready implementations +## Ready Implementations -`esp` provides the implementations of `Encodable`, `Decodable`, and optionally `StaticSize` and/or `DynamicSize` depending on the type, for all the following types: +`esp` provides implementations for `Encodable`, `Decodable`, and optionally `StaticSize` and/or `DynamicSize` for the following types: -* Primitive integers (`bool`, `u8`, `u16`, `u32`, `u64`, `i8`, `i16`, `i32`, `i64`, `f32`, `f64`) -* `str` -* `String` -* `Option` -* `Result` -* `[T; N]` -* `[T]` -* `Vec` -* `HashMap` -* `Ipv4Addr` -* `SocketAddrV4` -* `(T1, T2)` +- Primitive integers: `bool`, `u8`, `u16`, `u32`, `u64`, `i8`, `i16`, `i32`, `i64`, `f32`, `f64` +- `str`, `String` +- `Option`, `Result` +- Arrays and slices: `[T; N]`, `[T]` +- `Vec` +- `HashMap` +- `Ipv4Addr`, `SocketAddrV4` +- Tuples: `(T1, T2)` -Variable-size types (strings, `Vec`, `HashMap`, etc.) are prefixed with a `esp::VarLength` (currently alias to `u16`) indicating the length. This means they cannot contain more than 65535 elements. +Variable-size types like `String`, `Vec`, and `HashMap` are prefixed with a `esp::VarLength` (currently an alias for `u16`), indicating the length. This means they can store no more than 65535 elements. -## New types +## New Types -`esp` also adds a few new types, which are optimized specifically for the purpose of encoding or decoding, but can also be used for other purposes. +`esp` introduces several types optimized for encoding/decoding, but they can also serve other purposes: ### FastString +`FastString` is a Small String Optimization (SSO) class that can store up to 63 characters inline, resorting to heap allocation only when larger storage is required. It can be easily converted to and from a `String` or `&str`. -`FastString` is an SSO string class that can store up to 63 characters inline, and will use heap allocation if bigger storage is required. It can be easily converted to and from a `String` or `&str` if needed. - -When encoded, the actual representation is no different from `String` or `&str`, so its main purpose is just avoiding heap allocation. - -### InlineString - -`InlineString` is an even simpler string class, that unlike `FastString` stores all the data inline - never does any heap allocation. +When encoded, `FastString` behaves identically to `String` or `&str`, but its main advantage is avoiding heap allocation when the string is small. -Do keep in mind that if you try to mutate the string and the size goes above `N`, the program will panic. To avoid that, use `extend_safe` or manually check the size and capacity of the string before mutating. +### InlineString +`InlineString` is a simpler string type that stores all the data inline, never using heap allocation. However, if the string exceeds the defined size (`N`), the program will panic. Use `extend_safe` or manually check the size and capacity before mutating the string to avoid panics. ### FastVec - -Similar to `InlineString`, `FastVec` is a class with similar API to `Vec`, except it uses no heap storage and can store up to `N` elements, at which point adding any more will cause the program to panic. Just like `InlineString`, it also has `safe_` APIs that instead return an error on failure. +`FastVec` is similar to `InlineString`, but it is a vector-like type that can hold up to `N` elements without allocating on the heap. Adding more than `N` elements causes a panic. It also includes safe APIs like `safe_` that return an error on failure. ### Either - -Essentially `Result` but with a less misleading name, indicating that both outcomes are a success. +`Either` is a type similar to `Result`, but it conveys the idea of two possible successful outcomes instead of one error and one success. ### FiniteF32, FiniteF64 - -Simple wrappers around `f32` and `f64` with the only difference being that they will return a `DecodeError` if the value is `nan` or `+inf`/`-inf` when decoding. +These are simple wrappers around `f32` and `f64` that return a `DecodeError` if the value is `NaN` or `±inf` during decoding. ### Bits - -Structure that holds a bitfield of flags. For example, `Bits<2>` and `u16` have the same size, but the former will never be byteswapped on a non-big-endian system, and also provides user-friendly APIs for managing bits. +`Bits` holds a bitfield of flags. For example, `Bits<2>` and `u16` occupy the same size, but the former ensures that the flags are never byte-swapped on non-big-endian systems and offers more user-friendly APIs for managing bits. ### Vec1L - -Simple wrapper around Vec that can hold up to 255 elements and the length is encoded as a single byte. +A wrapper around `Vec` that can hold up to 255 elements, with the length encoded as a single byte. ### RemainderBytes +This type must be placed at the end of a struct and will simply store any remaining data in the buffer. -Must be put at the end of a struct, the value will simply be the remaining data in the buffer. - -## Additional notes +## Additional Notes -The library wraps around `ByteBuffer` and `ByteReader` from the crate `bytebuffer` and extends them both with traits `ByteBufferExt`, `ByteBufferExtRead`, `ByteBufferExtWrite`. These have a lot of useful methods, but due to derive macros, you often don't have to manually use those. +The library extends `ByteBuffer` and `ByteReader` from the `bytebuffer` crate with the `ByteBufferExt`, `ByteBufferExtRead`, and `ByteBufferExtWrite` traits. These extensions provide useful methods, though the derive macros often eliminate the need to manually use them. -One notable addition is methods `ByteBufferExtWrite::append_self_checksum` and `ByteBufferExtRead::validate_self_checksum`. The former calculates an Adler-32 checksum of all the data in the buffer, encodes it as a 32-bit unsigned integer, and writes it at the current position of the buffer. The latter method decodes that checksum and verifies that the data in the buffer matches, otherwise raising a `DecodeError`. \ No newline at end of file +A key addition is the `ByteBufferExtWrite::append_self_checksum` and `ByteBufferExtRead::validate_self_checksum` methods. The first calculates an Adler-32 checksum of the buffer’s data, encodes it as a 32-bit unsigned integer, and writes it. The latter method validates the checksum during decoding and raises a `DecodeError` if the data doesn’t match the checksum. diff --git a/server/esp/src/types/either.rs b/server/esp/src/types/either.rs index b8b8e180b..1339fc7aa 100644 --- a/server/esp/src/types/either.rs +++ b/server/esp/src/types/either.rs @@ -1,11 +1,7 @@ use crate::*; const fn constmax(a: usize, b: usize) -> usize { - if a >= b { - a - } else { - b - } + if a >= b { a } else { b } } #[derive(Clone, Debug)] diff --git a/server/game/Cargo.toml b/server/game/Cargo.toml index ddac9fce9..376518ec5 100644 --- a/server/game/Cargo.toml +++ b/server/game/Cargo.toml @@ -11,16 +11,17 @@ esp = { path = "../esp" } alloca = "0.4.0" ctrlc = "3.4.5" rustc-hash = "2.1.0" -serde = { version = "1.0.215", features = ["serde_derive"] } -serde_json = "1.0.133" +serde = { version = "1.0.217", features = ["serde_derive"] } +serde_json = "1.0.135" futures-util = "0.3.31" console-subscriber = { version = "0.4.1", features = ["parking_lot"] } -# tokio_tracing = { package = "tokio", version = "1.42.0", features = [ +# tokio_tracing = { package = "tokio", version = "1.43.0", features = [ # "full", # "tracing", # ], optional = true } -tokio = { version = "1.42.0", features = ["full"], optional = true } + +tokio = { version = "1.43.0", features = ["full"], optional = true } aho-corasick = "1.1.3" [dev-dependencies] diff --git a/server/game/benchmarks/bench.rs b/server/game/benchmarks/bench.rs index 90d709b92..f9a71fa06 100644 --- a/server/game/benchmarks/bench.rs +++ b/server/game/benchmarks/bench.rs @@ -1,5 +1,5 @@ #![allow(clippy::wildcard_imports, clippy::cast_possible_truncation)] -use criterion::{black_box, criterion_group, criterion_main, Criterion}; +use criterion::{Criterion, black_box, criterion_group, criterion_main}; use esp::{ByteBuffer, ByteReader}; use globed_game_server::{data::*, make_uninit, managers::LevelManager, new_uninit}; use globed_shared::{ @@ -76,7 +76,7 @@ fn buffers(c: &mut Criterion) { fn structs(c: &mut Criterion) { let mut data = [0u8; 2048]; - rand::thread_rng().fill_bytes(&mut data); + rand::rng().fill_bytes(&mut data); c.bench_function("encode-audio-frame", |b| { b.iter(black_box(|| { @@ -156,27 +156,27 @@ fn read_value_array(c: &mut Criterion) { fn strings(c: &mut Criterion) { let mut buf_short = ByteBuffer::new(); for _ in 0..1024 { - buf_short.write_value(&generate_alphanum_string(rand::thread_rng().gen_range(8..32))); + buf_short.write_value(&generate_alphanum_string(rand::rng().random_range(8..32))); } let mut buf_med = ByteBuffer::new(); for _ in 0..1024 { - buf_med.write_value(&generate_alphanum_string(rand::thread_rng().gen_range(56..128))); + buf_med.write_value(&generate_alphanum_string(rand::rng().random_range(56..128))); } let mut buf_long = ByteBuffer::new(); for _ in 0..1024 { - buf_long.write_value(&generate_alphanum_string(rand::thread_rng().gen_range(164..512))); + buf_long.write_value(&generate_alphanum_string(rand::rng().random_range(164..512))); } - let mut output = ByteBuffer::with_capacity(buf_long.len() + 1024); + let _output = ByteBuffer::with_capacity(buf_long.len() + 1024); c.bench_function("read-string-short", |b| { b.iter(|| { // output.clear(); let mut reader = ByteReader::from_bytes(buf_short.as_bytes()); for _ in 0..1024 { - let str = black_box(reader.read::()).unwrap(); + let _str = black_box(reader.read::()).unwrap(); // output.write_value(&str); } }); @@ -187,7 +187,7 @@ fn strings(c: &mut Criterion) { // output.clear(); let mut reader = ByteReader::from_bytes(buf_short.as_bytes()); for _ in 0..1024 { - let str = black_box(reader.read::()).unwrap(); + let _str = black_box(reader.read::()).unwrap(); // output.write_value(&str); } }); @@ -198,7 +198,7 @@ fn strings(c: &mut Criterion) { // output.clear(); let mut reader = ByteReader::from_bytes(buf_short.as_bytes()); for _ in 0..1024 { - let str = black_box(reader.read::>()).unwrap(); + let _str = black_box(reader.read::>()).unwrap(); // output.write_value(&str); } }); @@ -209,7 +209,7 @@ fn strings(c: &mut Criterion) { // output.clear(); let mut reader = ByteReader::from_bytes(buf_med.as_bytes()); for _ in 0..1024 { - let str = black_box(reader.read::()).unwrap(); + let _str = black_box(reader.read::()).unwrap(); // output.write_value(&str); } }); @@ -220,7 +220,7 @@ fn strings(c: &mut Criterion) { // output.clear(); let mut reader = ByteReader::from_bytes(buf_med.as_bytes()); for _ in 0..1024 { - let str = black_box(reader.read::()).unwrap(); + let _str = black_box(reader.read::()).unwrap(); // output.write_value(&str); } }); @@ -231,7 +231,7 @@ fn strings(c: &mut Criterion) { // output.clear(); let mut reader = ByteReader::from_bytes(buf_long.as_bytes()); for _ in 0..1024 { - let str = black_box(reader.read::()).unwrap(); + let _str = black_box(reader.read::()).unwrap(); // output.write_value(&str); } }); @@ -242,7 +242,7 @@ fn strings(c: &mut Criterion) { // output.clear(); let mut reader = ByteReader::from_bytes(buf_long.as_bytes()); for _ in 0..1024 { - let str = black_box(reader.read::()).unwrap(); + let _str = black_box(reader.read::()).unwrap(); // output.write_value(&str); } }); diff --git a/server/game/src/client/error.rs b/server/game/src/client/error.rs index 1a28ab54d..6dae34e4b 100644 --- a/server/game/src/client/error.rs +++ b/server/game/src/client/error.rs @@ -2,7 +2,7 @@ use std::{fmt::Display, time::SystemTimeError}; use crate::{ bridge::CentralBridgeError, - data::{types::ColorParseError, DecodeError}, + data::{DecodeError, types::ColorParseError}, }; use globed_shared::reqwest; diff --git a/server/game/src/client/thread/handlers/game.rs b/server/game/src/client/thread/handlers/game.rs index 401dd11f5..ad7f731cc 100644 --- a/server/game/src/client/thread/handlers/game.rs +++ b/server/game/src/client/thread/handlers/game.rs @@ -1,4 +1,4 @@ -use std::sync::{atomic::Ordering, Arc}; +use std::sync::{Arc, atomic::Ordering}; use super::*; diff --git a/server/game/src/client/thread/handlers/room.rs b/server/game/src/client/thread/handlers/room.rs index 80442056e..94f1f9c68 100644 --- a/server/game/src/client/thread/handlers/room.rs +++ b/server/game/src/client/thread/handlers/room.rs @@ -1,5 +1,5 @@ -use std::borrow::Cow; use crate::webhook::{WebhookChannel, WebhookMessage}; +use std::borrow::Cow; use super::*; @@ -25,7 +25,11 @@ impl ClientThread { }; if let Some(reason) = fail_reason { - return self.send_packet_dynamic(&RoomCreateFailedPacket { reason: Cow::Borrowed(reason) }).await; + return self + .send_packet_dynamic(&RoomCreateFailedPacket { + reason: Cow::Borrowed(reason), + }) + .await; } let room = self @@ -226,8 +230,6 @@ impl ClientThread { room_password, }; - - thread.push_new_message(ServerThreadMessage::BroadcastInvite(invite_packet.clone())).await; } diff --git a/server/game/src/client/translator/impls/mod.rs b/server/game/src/client/translator/impls/mod.rs index 9755e3815..bb90c66b8 100644 --- a/server/game/src/client/translator/impls/mod.rs +++ b/server/game/src/client/translator/impls/mod.rs @@ -5,8 +5,8 @@ mod general; mod room; #[allow(unused)] -pub use super::{Packet, PacketTranslationError, Translatable, CURRENT_PROTOCOL}; +pub use super::{CURRENT_PROTOCOL, Packet, PacketTranslationError, Translatable}; #[allow(unused)] -pub use crate::data::{v13, v_current, Decodable, DynamicSize, Encodable, StaticSize}; +pub use crate::data::{Decodable, DynamicSize, Encodable, StaticSize, v_current, v13}; #[allow(unused)] pub use v_current::{packets::*, types::*}; diff --git a/server/game/src/client/translator/mod.rs b/server/game/src/client/translator/mod.rs index a7810da93..48d839748 100644 --- a/server/game/src/client/translator/mod.rs +++ b/server/game/src/client/translator/mod.rs @@ -27,7 +27,7 @@ use esp::{ByteReader, Decodable, DecodeResult}; -pub use crate::data::{Packet, CURRENT_PROTOCOL}; +pub use crate::data::{CURRENT_PROTOCOL, Packet}; mod error; mod impls; diff --git a/server/game/src/client/unauthorized.rs b/server/game/src/client/unauthorized.rs index c02a9673c..6295a7442 100644 --- a/server/game/src/client/unauthorized.rs +++ b/server/game/src/client/unauthorized.rs @@ -2,19 +2,19 @@ use std::{ borrow::Cow, net::SocketAddrV4, sync::{ - atomic::{AtomicBool, AtomicI32, AtomicU16, AtomicU32, Ordering}, Arc, + atomic::{AtomicBool, AtomicI32, AtomicU16, AtomicU32, Ordering}, }, time::Duration, }; +use globed_shared::{MAX_SUPPORTED_PROTOCOL, ServerUserEntry, should_ignore_error}; #[allow(unused_imports)] use globed_shared::{ - debug, info, + MIN_CLIENT_VERSION, MIN_SUPPORTED_PROTOCOL, SUPPORTED_PROTOCOLS, SyncMutex, debug, info, rand::{self, Rng}, - warn, SyncMutex, MIN_CLIENT_VERSION, MIN_SUPPORTED_PROTOCOL, SUPPORTED_PROTOCOLS, + warn, }; -use globed_shared::{should_ignore_error, ServerUserEntry, MAX_SUPPORTED_PROTOCOL}; use super::*; use crate::{ diff --git a/server/game/src/data/v13/types/crypto.rs b/server/game/src/data/v13/types/crypto.rs index df793ef84..aa6ced6cb 100644 --- a/server/game/src/data/v13/types/crypto.rs +++ b/server/game/src/data/v13/types/crypto.rs @@ -1,7 +1,7 @@ use std::io::Read; use esp::*; -use globed_shared::crypto_box::{PublicKey, KEY_SIZE}; +use globed_shared::crypto_box::{KEY_SIZE, PublicKey}; pub struct CryptoPublicKey(pub PublicKey); diff --git a/server/game/src/managers/level.rs b/server/game/src/managers/level.rs index 814223ce8..5433718e9 100644 --- a/server/game/src/managers/level.rs +++ b/server/game/src/managers/level.rs @@ -1,8 +1,8 @@ use globed_shared::IntMap; use crate::data::{ - types::PlayerData, AssociatedPlayerData, AssociatedPlayerMetadata, BorrowedAssociatedPlayerData, BorrowedAssociatedPlayerMetadata, - GlobedCounterChange, LevelId, PlayerMetadata, + AssociatedPlayerData, AssociatedPlayerMetadata, BorrowedAssociatedPlayerData, BorrowedAssociatedPlayerMetadata, GlobedCounterChange, LevelId, + PlayerMetadata, types::PlayerData, }; #[derive(Default)] @@ -71,14 +71,11 @@ impl LevelManager { } pub fn create_player(&mut self, account_id: i32, invisible: bool) { - self.players.insert( + self.players.insert(account_id, LevelManagerPlayer { account_id, - LevelManagerPlayer { - account_id, - is_invisible: invisible, - ..Default::default() - }, - ); + is_invisible: invisible, + ..Default::default() + }); } fn get_or_create_player(&mut self, account_id: i32) -> &mut LevelManagerPlayer { diff --git a/server/game/src/managers/role.rs b/server/game/src/managers/role.rs index 18ceef283..b749b1408 100644 --- a/server/game/src/managers/role.rs +++ b/server/game/src/managers/role.rs @@ -1,5 +1,5 @@ use crate::data::*; -use globed_shared::{error, warn, GameServerBootData, IntMap, ServerRole, SyncMutex}; +use globed_shared::{GameServerBootData, IntMap, ServerRole, SyncMutex, error, warn}; #[derive(Default)] pub struct RoleManager { diff --git a/server/game/src/managers/room.rs b/server/game/src/managers/room.rs index be8a1ad6f..f4729202f 100644 --- a/server/game/src/managers/room.rs +++ b/server/game/src/managers/room.rs @@ -1,16 +1,16 @@ use std::sync::{ - atomic::{AtomicI32, Ordering}, Arc, OnceLock, + atomic::{AtomicI32, Ordering}, }; use esp::InlineString; use globed_shared::{ - rand::{self, Rng}, IntMap, SyncMutex, SyncMutexGuard, SyncRwLock, + rand::{self, Rng}, }; use crate::{ - data::{LevelId, PlayerPreviewAccountData, RoomInfo, RoomListingInfo, RoomSettings, ROOM_ID_LENGTH}, + data::{LevelId, PlayerPreviewAccountData, ROOM_ID_LENGTH, RoomInfo, RoomListingInfo, RoomSettings}, server::GameServer, }; @@ -208,11 +208,7 @@ impl RoomManager { f(self.get_global()) } else { let room = self.get_room(room_id); - if let Some(room) = room { - f(&room) - } else { - default() - } + if let Some(room) = room { f(&room) } else { default() } } } diff --git a/server/get_unique_users.py b/server/get_unique_users.py index eb1421434..1f911a650 100644 --- a/server/get_unique_users.py +++ b/server/get_unique_users.py @@ -27,23 +27,15 @@ end_time = datetime.now() - timedelta(hours=shift_by_hours) start_time = end_time - timedelta(days=1) -filtered = [] -for e in entries: - if e[0] > start_time and e[0] < end_time: - filtered.append(e) +filtered = [e for e in entries if start_time < e[0] < end_time] print(f"Logins during the last 24 hours: {len(filtered)}") -filtered2 = set() -for e in filtered: - filtered2.add(e[1]) +unique_users = {e[1] for e in filtered} -print(f"Unique users: {len(filtered2)}") +print(f"Unique users: {len(unique_users)}") with open(".unique_users.txt", "w") as f: - unique_names = set() - for e in entries: - unique_names.add(e[1]) - - for name in sorted(list(unique_names)): + unique_names = {e[1] for e in entries} + for name in sorted(unique_names): f.write(name + "\n") diff --git a/server/observer/Cargo.toml b/server/observer/Cargo.toml index 00332dc33..2e3932935 100644 --- a/server/observer/Cargo.toml +++ b/server/observer/Cargo.toml @@ -8,4 +8,5 @@ globed-shared = { path = "../shared" } globed-derive = { path = "../derive" } observer-shared = { path = "../observer-shared" } esp = { path = "../esp" } -egui = "0.29.1" + +egui = "0.30.0" diff --git a/server/protocol.md b/server/protocol.md index 3a8645d2c..0c1b0f58d 100644 --- a/server/protocol.md +++ b/server/protocol.md @@ -1,112 +1,106 @@ ## Protocol -if you somehow stumbled upon this file, hi! this is a brief protocol description so that I don't forget what everything does :p +If you somehow stumbled upon this file, hi! This is a brief protocol description so that I don't forget what everything does. :p -`+` - encrypted packet. +### Legend -`!` - this packet is unused and may be removed completely in the future +- `+` - Encrypted packet. +- `!` - This packet is unused and may be removed completely in the future. +- `^` - This packet is not fully functional, and work needs to be done on either the client side or the server side. -`^` - this packet is not fully functional and work needs to be done on either the client side or the server side +(Note: I will probably forget to update this very often.) -i will probably forget to update this very often +--- ### Client -Connection related - -* 10000 - PingPacket - ping -* 10001 - CryptoHandshakeStartPacket - handshake -* 10002 - KeepalivePacket - keepalive -* 10003+ - LoginPacket - authentication -* 10004 - LoginRecoverPacket - recover a disconnected session -* 10005 - ClaimThreadPacket - claim a tcp thread from a udp connection -* 10006 - DisconnectPacket - client disconnection -* 10007 - KeepaliveTCPPacket - keepalive but for the tcp connection -* 10200 - ConnectionTestPacket - connection test (response 20010) - -General - -* 11000 - SyncIconsPacket - store client's icons -* 11001 - RequestGlobalPlayerListPacket - request list of all people in the server (response 21000) -* 11002 - RequestLevelListPacket - request list of all levels people are playing right now (response 21005) -* 11003 - RequestPlayerCountPacket - request amount of people on up to 128 different levels (response 21006) -* 11004 - UpdatePlayerStatusPacket - updates the player's status to either visible or invisible - -Game related - -* 12000 - RequestPlayerProfilesPacket - request account data of another player (or all people on the level) -* 12001 - LevelJoinPacket - join a level -* 12002 - LevelLeavePacket - leave a level -* 12003 - PlayerDataPacket - player data -* 12004 - PlayerMetadataPacket - player metadata -* 12010+ - VoicePacket - voice frame -* 12011^+ - ChatMessagePacket - chat message - -Room related - -* 13000 - CreateRoomPacket - create a room -* 13001 - JoinRoomPacket - join a room -* 13002 - LeaveRoomPacket - leave a room (no need for a response) -* 13003 - RequestRoomPlayerListPacket - request list of all people in the given room (response 21004) -* 13004 - UpdateRoomSettingsPacket - update the settings of a room -* 13005 - RoomSendInvitePacket - send invite to a room -* 13006 - RequestRoomListPacket - request a list of all public rooms - -Admin related - -* 19000+ - AdminAuthPacket - admin auth -* 19001+ - AdminSendNoticePacket - send notice to everyone or a specific connected person -* 19002 - AdminDisconnectPacket - disconnect a user with a specific message -* 19003 - AdminGetUserStatePacket - get user state -* 19004+ - AdminUpdateUserPacket - mute/ban/whitelist a user, etc. +#### Connection related +- **10000** - PingPacket: ping +- **10001** - CryptoHandshakeStartPacket: handshake +- **10002** - KeepalivePacket: keepalive +- **10003+** - LoginPacket: authentication +- **10004** - LoginRecoverPacket: recover a disconnected session +- **10005** - ClaimThreadPacket: claim a TCP thread from a UDP connection +- **10006** - DisconnectPacket: client disconnection +- **10007** - KeepaliveTCPPacket: keepalive but for the TCP connection +- **10200** - ConnectionTestPacket: connection test (response 20010) + +#### General +- **11000** - SyncIconsPacket: store client's icons +- **11001** - RequestGlobalPlayerListPacket: request list of all people in the server (response 21000) +- **11002** - RequestLevelListPacket: request list of all levels people are playing right now (response 21005) +- **11003** - RequestPlayerCountPacket: request amount of people on up to 128 different levels (response 21006) +- **11004** - UpdatePlayerStatusPacket: updates the player's status to either visible or invisible + +#### Game related +- **12000** - RequestPlayerProfilesPacket: request account data of another player (or all people on the level) +- **12001** - LevelJoinPacket: join a level +- **12002** - LevelLeavePacket: leave a level +- **12003** - PlayerDataPacket: player data +- **12004** - PlayerMetadataPacket: player metadata +- **12010+** - VoicePacket: voice frame +- **12011^+** - ChatMessagePacket: chat message + +#### Room related +- **13000** - CreateRoomPacket: create a room +- **13001** - JoinRoomPacket: join a room +- **13002** - LeaveRoomPacket: leave a room (no need for a response) +- **13003** - RequestRoomPlayerListPacket: request list of all people in the given room (response 21004) +- **13004** - UpdateRoomSettingsPacket: update the settings of a room +- **13005** - RoomSendInvitePacket: send invite to a room +- **13006** - RequestRoomListPacket: request a list of all public rooms + +#### Admin related +- **19000+** - AdminAuthPacket: admin auth +- **19001+** - AdminSendNoticePacket: send notice to everyone or a specific connected person +- **19002** - AdminDisconnectPacket: disconnect a user with a specific message +- **19003** - AdminGetUserStatePacket: get user state +- **19004+** - AdminUpdateUserPacket: mute/ban/whitelist a user, etc. + +--- ### Server -Connection related - -* 20000 - PingResponsePacket - ping response -* 20001 - CryptoHandshakeResponsePacket - handshake response -* 20002 - KeepaliveResponsePacket - keepalive response -* 20003 - ServerDisconnectPacket - server kicked you out -* 20004 - LoggedInPacket - successful auth -* 20005 - LoginFailedPacket - bad auth (has error message) -* 20006 - ProtocolMismatchPacket - protocol version mismatch -* 20007 - KeepaliveTCPResponsePacket - keepalive response but for tcp -* 20008 - ClaimThreadFailedPacket - failed to claim thread -* 20009 - LoginRecoveryFailedPacket - failed to recover session -* 20100 - ServerNoticePacket - message popup for the user -* 20101 - ServerBannedPacket - message about being banned -* 20102 - ServerMutedPacket - message about being muted -* 20200 - ConnectionTestResponsePacket - connection test response - -General - -* 21000! - GlobalPlayerListPacket - list of people in the server -* 21001 - LevelListPacket - list of all levels in the room -* 21002 - LevelPlayerCountPacket - amount of players on certain requested levels - -Game related - -* 22000 - PlayerProfilesPacket - list of requested profiles -* 22001 - LevelDataPacket - level data -* 22002 - LevelPlayerMetadataPacket - metadata of other players -* 22010+ - VoiceBroadcastPacket - voice frame from another user -* 22011+ - ChatMessageBroadcastPacket - chat message from another user - -Room related - -* 23000 - RoomCreatedPacket - returns room id (returns existing one if already in a room) -* 23001 - RoomJoinedPacket - returns nothing ig?? just indicates success -* 23002 - RoomJoinFailedPacket - also nothing, the only possible error is no such room id exists -* 23003 - RoomPlayerListPacket - list of people in the room -* 23004 - RoomInfoPacket - settings updated and stuff -* 23005 - RoomInvitePacket - invite from another player -* 23006 - RoomListPacket - list of all public rooms - -Admin related - -* 29000 - AdminAuthSuccessPacket - admin auth successful -* 29001+ - AdminErrorPacket - error happened when doing an admin action -* 29002+ - AdminUserDataPacket - data about the player -* 29003+ - AdminSuccessMessagePacket - small success message about an action -* 29004 - AdminAuthFailedPacket - admin auth failed \ No newline at end of file +#### Connection related +- **20000** - PingResponsePacket: ping response +- **20001** - CryptoHandshakeResponsePacket: handshake response +- **20002** - KeepaliveResponsePacket: keepalive response +- **20003** - ServerDisconnectPacket: server kicked you out +- **20004** - LoggedInPacket: successful auth +- **20005** - LoginFailedPacket: bad auth (has error message) +- **20006** - ProtocolMismatchPacket: protocol version mismatch +- **20007** - KeepaliveTCPResponsePacket: keepalive response but for TCP +- **20008** - ClaimThreadFailedPacket: failed to claim thread +- **20009** - LoginRecoveryFailedPacket: failed to recover session +- **20100** - ServerNoticePacket: message popup for the user +- **20101** - ServerBannedPacket: message about being banned +- **20102** - ServerMutedPacket: message about being muted +- **20200** - ConnectionTestResponsePacket: connection test response + +#### General +- **21000!** - GlobalPlayerListPacket: list of people in the server +- **21001** - LevelListPacket: list of all levels in the room +- **21002** - LevelPlayerCountPacket: amount of players on certain requested levels + +#### Game related +- **22000** - PlayerProfilesPacket: list of requested profiles +- **22001** - LevelDataPacket: level data +- **22002** - LevelPlayerMetadataPacket: metadata of other players +- **22010+** - VoiceBroadcastPacket: voice frame from another user +- **22011+** - ChatMessageBroadcastPacket: chat message from another user + +#### Room related +- **23000** - RoomCreatedPacket: returns room ID (returns existing one if already in a room) +- **23001** - RoomJoinedPacket: returns nothing (just indicates success) +- **23002** - RoomJoinFailedPacket: also nothing, the only possible error is "no such room ID exists" +- **23003** - RoomPlayerListPacket: list of people in the room +- **23004** - RoomInfoPacket: settings updated and stuff +- **23005** - RoomInvitePacket: invite from another player +- **23006** - RoomListPacket: list of all public rooms + +#### Admin related +- **29000** - AdminAuthSuccessPacket: admin auth successful +- **29001+** - AdminErrorPacket: error happened when doing an admin action +- **29002+** - AdminUserDataPacket: data about the player +- **29003+** - AdminSuccessMessagePacket: small success message about an action +- **29004** - AdminAuthFailedPacket: admin auth failed diff --git a/server/readme.md b/server/readme.md index 427f52b22..50be60ed6 100644 --- a/server/readme.md +++ b/server/readme.md @@ -1,111 +1,120 @@ -# Globed Server +# Globed Server Setup Guide ## Prerequisites -Before trying to setup a server, it is **recommended** that you understand what it involves. You will likely need to either setup port forwarding or use a VPN tool like Radmin VPN if you are hosting the server on your PC, and that won't be covered in this guide. +Before setting up the server, it is **recommended** that you understand what it entails. You may need to set up port forwarding or use a VPN tool like Radmin VPN if hosting the server on your PC. These steps are not covered in this guide. -In case you are familiar with [Pterodactyl](https://pterodactyl.io/), there are eggs available for the [central](https://github.com/DumbCaveSpider/globed-central-egg) and [game](https://github.com/DumbCaveSpider/globed-game-egg) servers that could simplify the setup (thanks to [@DumbCaveSpider](https://github.com/DumbCaveSpider/)) +If you're familiar with [Pterodactyl](https://pterodactyl.io/), there are eggs available for both the [central](https://github.com/DumbCaveSpider/globed-central-egg) and [game](https://github.com/DumbCaveSpider/globed-game-egg) servers that can simplify the setup (thanks to [@DumbCaveSpider](https://github.com/DumbCaveSpider)). -Additionally, if you are setting up a public server, please keep in mind that there are no stability guarantees. Big changes to the server can be made at any time, and updates to the mod can cause your server to stop accepting users until you update it. +Please note, if you're setting up a public server, there are no guarantees regarding stability. The server may undergo significant changes at any time, and updates to the mod can cause your server to stop accepting users until it is updated. ## Setup -If you want to host a server yourself, first you have to download the server binaries from the [latest GitHub release](https://github.com/GlobedGD/globed2/releases/latest), named `globed-central-server` and `globed-game-server`. Depending on your OS and architecture, you want the one ending in `.exe` on Windows, the `-x64` one on Linux x64, and the `-arm64` one on Linux ARM64. +To host a server yourself, follow these steps: -After that is done, you have 2 paths: +1. **Download the Server Binaries:** + Download the server binaries from the [latest GitHub release](https://github.com/GlobedGD/globed2/releases/latest), which include `globed-central-server` and `globed-game-server`. Choose the appropriate file based on your operating system: + - For **Windows**, download the `.exe` file. + - For **Linux x64**, download the `-x64` file. + - For **Linux ARM64**, download the `-arm64` file. -* If you want to setup a small, simple server you can jump to the [standalone section](#standalone) -* If you want to setup a bigger or more configurable server, keep reading. +2. **Choose Your Setup Path:** + - If you want a small, simple server, proceed to the [Standalone section](#standalone). + - If you're aiming for a larger or more configurable setup, continue reading. -After launching the central server binary, you should see two new files called `central-conf.json` and `Rocket.toml`. This is where you can configure everything about the server. For documentation about all the options, jump to the [configuration section](#central-server-configuration), however for now we only need the option `game_server_password`. +3. **Configure the Central Server:** + Launch the `central-server` binary. Afterward, you should see two new files: `central-conf.json` and `Rocket.toml`. These files contain the server's configuration. For now, focus on the `game_server_password` option. -With your central server properly setup and started, jump to the [bridged](#bridged) section of the game server configuration and launch the game server, with the password that you configured earlier. +4. **Launch the Game Server:** + With the central server configured, proceed to the [Bridged section](#bridged) of the game server configuration and launch the game server using the password set earlier. -If you did everything right, you should see no errors or warnings in the console and instead you should see "Server launched on x.x.x.x". This means everything worked! Congrats :) +If everything is done correctly, the console should show "Server launched on x.x.x.x", indicating a successful setup. -## Game server configuration +## Game Server Configuration -note: if you are not on Windows, in the following examples replace `set` with `export` and replace `globed-game-server.exe` with the appropriate server binary (such as `globed-game-server-x64`) +**Note:** If you're not on Windows, replace `set` with `export` and use the appropriate server binary (e.g., `globed-game-server-x64` for Linux). ### Standalone -If you want to spin up a quick, standalone game server, without needing to start a central server, then it is as simple as running the `globed-game-server.exe` executable directly. +To quickly launch a game server without the central server, run the `globed-game-server.exe` executable directly. -If you want to change the port (default is 4202) then you'll have to run the executable with an additional argument like so: +To change the port (default is 4202), use the following command: ```sh -# replace 4202 with your desired port +# Replace 4202 with your desired port globed-game-server.exe 0.0.0.0:4202 ``` -**To connect to your server, you want to use the Direct Connection option inside the server switcher in-game**. (with the address `127.0.0.1:4202` if the server is running on the same device) - -Keep in mind that a standalone server makes the configuration very limited (for example you can't ban/mute users anymore) and disables any kind of player authentication. +**Connecting to the server:** +Use the **Direct Connection** option in the game’s server switcher, with the address `127.0.0.1:4202` if the server is running on the same machine. +Keep in mind, a standalone server offers limited configuration (e.g., you can't ban or mute users) and disables player authentication. ### Bridged -To start the game server and bridge it together with an active central server you must use the password from the `game_server_password` option in the central server configuration. Then, you have 2 options whenever you start the server: +To bridge the game server with a central server, use the `game_server_password` from the central server configuration. You have two options to start the server: ```sh globed-game-server.exe 0.0.0.0:4202 http://127.0.0.1:4201 password +``` -# or like this: - +Or set environment variables and then run the server: +```sh set GLOBED_GS_ADDRESS=0.0.0.0:4202 set GLOBED_GS_CENTRAL_URL=http://127.0.0.1:4201 set GLOBED_GS_CENTRAL_PASSWORD=password globed-game-server.exe ``` -Replace `0.0.0.0:4202` with the address you want the game server to listen on, `http://127.0.0.1:4201` with the URL of your central server, and `password` with the password. - -### Environment variables - -`GLOBED_GS_NO_FILE_LOG` - if set to 1, don't create a log file and only log to the console. - -## Central server configuration - -By default, the file is created with the name `central-conf.json` in the current working directory when you run the server, but it can be overriden with the environment variable `GLOBED_CONFIG_PATH`. The path can be a folder or a full file path. - -### General settings -| JSON key | Default | Description | -|---------|---------|-----------------| -| `web_mountpoint` | `"/"` | HTTP mountpoint (the prefix before every endpoint) | -| `game_servers` | `[]` | List of game servers that will be sent to the clients (see below for the format) | -| `maintenance` | `false` | When enabled, anyone trying to connect will get an appropriate error message saying that the server is under maintenance | -| `status_print_interval` | `7200` | How often (in seconds) the game servers will print various status information to the console, 0 to disable | -| `userlist_mode` | `"none"` | Can be `blacklist`, `whitelist`, `none` (same as `blacklist`). When set to `whitelist`, players will need to be first whitelisted before being able to join | -| `tps` | `30` | Dictates how many packets per second clients can (and will) send when in a level. Higher = smoother experience but more processing power and bandwidth | -| `admin_webhook_url` | `(empty)` | When enabled, admin actions (banning, muting, etc.) will send a message to the given discord webhook URL | -| `rate_suggestion_webhook_url` | `(empty)` | When enabled, sending a level to be featured will send a message to the given discord webhook URL | -| `featured_webhook_url` | `(empty)` | When enabled, featuring a level will send a message to the given discord webhook URL | -| `featured_webhook_message` | `(empty)` | The message to send in the body of the webhook message for featured levels | -| `room_webhook_url` | `(empty)` | When enabled, creating a room will send a message to the given discord webhook URL | -| `chat_burst_limit` | `0` | Controls the amount of text chat messages users can send in a specific period of time, before getting rate limited. 0 to disable | -| `chat_burst_interval` | `0` | Controls the period of time for the `chat_burst_limit_setting`. Time is in milliseconds | -| `roles` | `(...)` | Controls the roles available on the server (moderator, admin, etc.), their permissions, name colors, and various other things | - -### Security settings (the boring stuff) - -These are recommended to adjust if you're hosting a public server, otherwise the defaults should be fine. - -| JSON key | Default | Description | -|---------|---------|-----------------| -| `admin_key` | `(random)` | The password used to unlock the admin panel in-game, must be 32 characters or less | -| `use_gd_api` | `false` | Verify account ownership via requests to GD servers. Note that you must set `gd_api_account` and `gd_api_gjp` accordingly if you enable this setting | -| `gd_api_account` | `0` | Account ID of a bot account that will be used to verify account ownership | -| `gd_api_gjp` | `(empty)` | GJP2 of the GD account used for verifying ownership. Figuring this out is left as an excercise to the reader :) | -| `gd_api_url` | `(...)` | Base link to the GD API used for account verification. By default is `https://www.boomlings.com/database`. Change this if you're hosting a server for a GDPS | -| `skip_name_check` | `false` | Skips validation of account names when verifying accounts | -| `refresh_interval` | `3000` | Controls the time (in milliseconds) between requests to the GD server for refreshing messages | -| `secret_key` | `(random)` | Secret key for signing authentication keys | -| `secret_key2` | `(random)` | Secret key for signing session tokens | -| `game_server_password` | `(random)` | Password used to authenticate game servers | -| `cloudflare_protection` | `false` | Block requests coming not from Cloudflare (see `central/src/allowed_ranges.txt`) and use `CF-Connecting-IP` header to distinguish users. If your server is proxied through cloudflare, you **must** turn on this option. | -| `challenge_expiry` | `30` | Amount of seconds before an authentication challenge expires and a new one can be requested | -| `token_expiry` | `86400` (1 day) | Amount of seconds a session token will last. Those regenerate every time you restart the game, so it doesn't have to be long | - -Formatting for game servers: +Replace: +- `0.0.0.0:4202` with your desired game server address. +- `http://127.0.0.1:4201` with the URL of your central server. +- `password` with your configured password. + +### Environment Variables + +- `GLOBED_GS_NO_FILE_LOG` - Set to `1` to prevent the creation of a log file, logging only to the console. + +## Central Server Configuration + +By default, the `central-conf.json` file is created in the current directory when you run the central server, but it can be overridden using the `GLOBED_CONFIG_PATH` environment variable. + +### General Settings + +| JSON Key | Default | Description | +|------------------------------------|---------------|-------------| +| `web_mountpoint` | `"/"` | HTTP mountpoint (prefix before every endpoint) | +| `game_servers` | `[]` | List of game servers sent to clients (see below for format) | +| `maintenance` | `false` | If enabled, users trying to connect will receive a maintenance message | +| `status_print_interval` | `7200` | Time in seconds between status messages printed to the console (set to `0` to disable) | +| `userlist_mode` | `"none"` | Options: `blacklist`, `whitelist`, `none` (whitelist requires players to be whitelisted to join) | +| `tps` | `30` | Number of packets per second clients can send in a level (higher = smoother experience) | +| `admin_webhook_url` | `(empty)` | URL for sending admin action notifications (banning, muting, etc.) to Discord | +| `rate_suggestion_webhook_url` | `(empty)` | URL for sending level submission notifications to Discord | +| `featured_webhook_url` | `(empty)` | URL for sending level feature notifications to Discord | +| `room_webhook_url` | `(empty)` | URL for sending room creation notifications to Discord | +| `chat_burst_limit` | `0` | Limit on the number of text messages a user can send in a period (set to `0` to disable) | +| `chat_burst_interval` | `0` | Time period for chat burst limit (in milliseconds) | +| `roles` | `(...)` | List of available roles, with permissions and settings | + +### Security Settings (Recommended for Public Servers) + +| JSON Key | Default | Description | +|------------------------------------|---------------|-------------| +| `admin_key` | `(random)` | Password for unlocking the admin panel (max 32 characters) | +| `use_gd_api` | `false` | Verify account ownership via GD servers (requires `gd_api_account` and `gd_api_gjp`) | +| `gd_api_account` | `0` | Bot account ID for verification | +| `gd_api_gjp` | `(empty)` | GJP2 for account verification | +| `gd_api_url` | `(...)` | Base URL for GD API used for account verification | +| `skip_name_check` | `false` | Skips account name validation when verifying accounts | +| `refresh_interval` | `3000` | Time in milliseconds between GD server requests for refreshing messages | +| `secret_key` | `(random)` | Secret key for signing authentication keys | +| `secret_key2` | `(random)` | Secret key for signing session tokens | +| `game_server_password` | `(random)` | Password for authenticating game servers | +| `cloudflare_protection` | `false` | Block non-Cloudflare requests and use the `CF-Connecting-IP` header if server is proxied through Cloudflare | +| `challenge_expiry` | `30` | Time (in seconds) before an authentication challenge expires | +| `token_expiry` | `86400` (1 day) | Time (in seconds) a session token lasts | + +### Game Server Formatting Example: ```json { @@ -116,54 +125,59 @@ Formatting for game servers: } ``` -**Note that the `address` key must be a public IP address if you want others to be able to connect. Putting 127.0.0.1 will make it possible to only connect from *your* machine.** +**Note:** The `address` key must be a public IP address if you want others to connect. Use `127.0.0.1` for local connections only. -Formatting for user roles: +### User Role Formatting Example: ```json { - // all keys except id and priority are optional. - - "id": "mod", - "priority": 100, // determines which roles can edit users with other roles - "badge_icon": "role-mod.png", // make sure it's a valid sprite! (can be empty) - "name_color": "#ff0000", // name color - "chat_color": "#ff0000", // color of chat messages - - // permissions - "notices": false, // ability to send notices (popup messages) - "notices_to_everyone": false, // ability to send a notice to everyone on the server - "kick": false, // ability to disconnect users from the server - "kick_everyone": false, // ability to disconnect everyone from the server - "mute": false, // ability to mute/unmute - "ban": false, // ability to ban/unban & whitelist (on whitelist enabled servers) - "edit_role": false, // ability to change roles of a user - "edit_featured_levels": false, // ability to edit featured levels - "admin": false, // implicitly enables all other permissions and also does some additional things + "id": "mod", // Required + "priority": 100, // Required, determines which roles can edit users with other roles + "badge_icon": "role-mod.png", // Optional, make sure it's a valid sprite + "name_color": "#ff0000", // Optional, name color + "chat_color": "#ff0000", // Optional, color of chat messages + "notices": false, // Optional, ability to send notices (popup messages) + "notices_to_everyone": false, // Optional, ability to send a notice to everyone on the server + "kick": false, // Optional, ability to kick users from the server + "kick_everyone": false, // Optional, ability to kick everyone from the server + "mute": false, // Optional, ability to mute/unmute + "ban": false, // Optional, ability to ban/unban & whitelist (on whitelist enabled servers) + "edit_role": false, // Optional, ability to change roles of a user + "edit_featured_levels": false, // Optional, ability to edit featured levels + "admin": false // Optional, implicitly enables all other permissions } ``` -There is also a special format for tinting colors, for example setting `name_color` to `#ff0000 > 00ff00 > 0000ff` would make your name fade between red, green and blue. Spaces and a `#` at the start are for clarity and are optional. (Maximum 8 colors supported in one string) +### Special Role Tinting: + +You can create color transitions for names by using a special format, e.g., setting `name_color` to `#ff0000 > 00ff00 > 0000ff` will make the name fade between red, green, and blue. + +Keep in mind that there is a limit of 8 colors. -### Rocket.toml +### Rocket.toml Configuration -Additionally, when first starting up a server, a `Rocket.toml` file will be created from a template. By default, it will be put in the current working directory, or `ROCKET_CONFIG` if specified. +When starting the server, a `Rocket.toml` file is generated, typically in the current working directory (or the directory specified by `ROCKET_CONFIG`). This file is used for configuring the HTTP port and database path, among other settings. Refer to [Rocket documentation](https://rocket.rs/guide/v0.5/configuration/#rocket-toml) for further configuration options. -The `Rocket.toml` is primarily used for changing the HTTP port and the path to the database, however other settings are also free to change, as per [Rocket documentation](https://rocket.rs/v0.5/guide/configuration/#rockettoml). Changing the TOML configuration is as simple as the JSON configuration, however it is *not* hot-reloadable. +## Building the Server -## Building +To build the server yourself, you will need a nightly Rust toolchain. Once set up, use the following commands to build: -If you want to build the server yourself, you need a nightly Rust toolchain. After that, it's as simple as: ```sh cd server/ -rustup override set nightly # has to be done only once +rustup override set nightly cargo build --release ``` -## Extra +## Extra Configuration -In release builds, by default, the `Debug` and `Trace` log levels are disabled, so you will only see logs with levels `Info`, `Warn` and `Error`. +In release builds, the default log levels are set to `Info`, `Warn`, and `Error`. To adjust the log level, set the environment variable `GLOBED_LOG_LEVEL` for the central server or `GLOBED_GS_LOG_LEVEL` for the game server. This variable defines the **minimum** log level, meaning that setting it to `Trace` will enable all log levels, from `Trace` up to `Error`. -This can be changed by setting the environment variable `GLOBED_LOG_LEVEL` for the central server, or `GLOBED_GS_LOG_LEVEL` for the game server. The appropriate values are: `trace`, `debug`, `info`, `warn`, `error`, `none`. +The possible log levels are: +- `Trace` (shows all log messages, including `Trace`, `Debug`, `Info`, `Warn`, and `Error`) +- `Debug` +- `Info` +- `Warn` +- `Error` +- `None` (disables all logs) -`GLOBED_NO_FILE_LOG` can be set to a nonzero value to disable logging to a file. \ No newline at end of file +To disable logging to a file, set `GLOBED_NO_FILE_LOG` to a nonzero value. diff --git a/server/rustfmt.toml b/server/rustfmt.toml index 397483873..bc30bf42f 100644 --- a/server/rustfmt.toml +++ b/server/rustfmt.toml @@ -1 +1 @@ -max_width = 150 # menace to society +max_width = 150 diff --git a/server/shared/Cargo.toml b/server/shared/Cargo.toml index eb9bf1f9f..80cf9b09f 100644 --- a/server/shared/Cargo.toml +++ b/server/shared/Cargo.toml @@ -7,21 +7,21 @@ edition = "2024" esp = { path = "../esp" } globed-derive = { path = "../derive" } -anyhow = "1.0.94" +anyhow = "1.0.95" base64 = "0.22.1" -colored = "2.1.0" +colored = "3.0.0" crypto_box = { version = "0.9.1", features = ["std", "chacha20"] } hmac = "0.13.0-pre.4" log = "0.4.22" nohash-hasher = "0.2.0" parking_lot = "0.12.3" rand = "0.9.0-beta.1" -reqwest = { version = "0.12.9", default-features = false, features = [ +reqwest = { version = "0.12.12", default-features = false, features = [ "rustls-tls", ] } sha2 = "0.11.0-pre.4" time = { version = "0.3.37", features = ["formatting"] } -serde = { version = "1.0.215", features = ["derive"] } +serde = { version = "1.0.217", features = ["derive"] } crypto_secretbox = { version = "0.1.1", features = ["chacha20"] } -serde_json = "1.0.133" +serde_json = "1.0.135" argon2 = "0.6.0-pre.1" diff --git a/server/shared/src/crypto.rs b/server/shared/src/crypto.rs index 6aa42f00e..b9cf8d327 100644 --- a/server/shared/src/crypto.rs +++ b/server/shared/src/crypto.rs @@ -1,10 +1,10 @@ use crypto_box::{ - aead::{generic_array::GenericArray, Aead, AeadCore, AeadInPlace, OsRng}, ChaChaBox, PublicKey, SecretKey, + aead::{Aead, AeadCore, AeadInPlace, OsRng, generic_array::GenericArray}, }; use crypto_secretbox::{ - consts::{U24, U32}, KeyInit, XChaCha20Poly1305, + consts::{U24, U32}, }; /// Simpler interface for encryption/decryption diff --git a/server/shared/src/data.rs b/server/shared/src/data.rs index 402a76368..73c9f1c70 100644 --- a/server/shared/src/data.rs +++ b/server/shared/src/data.rs @@ -2,8 +2,8 @@ use std::time::UNIX_EPOCH; use super::*; use argon2::{ - password_hash::{rand_core::OsRng, PasswordHash, PasswordHasher, PasswordVerifier, SaltString}, Argon2, + password_hash::{PasswordHash, PasswordHasher, PasswordVerifier, SaltString, rand_core::OsRng}, }; use esp::{FastString, InlineString}; use serde::{Deserialize, Serialize}; diff --git a/server/shared/src/logger.rs b/server/shared/src/logger.rs index edff691e0..c8b6cf317 100644 --- a/server/shared/src/logger.rs +++ b/server/shared/src/logger.rs @@ -7,10 +7,10 @@ use std::{ }; use colored::Colorize; -use time::{format_description, OffsetDateTime}; +use time::{OffsetDateTime, format_description}; pub use log; -pub use log::{debug, error, info, trace, warn, Level as LogLevel, LevelFilter as LogLevelFilter}; +pub use log::{Level as LogLevel, LevelFilter as LogLevelFilter, debug, error, info, trace, warn}; pub struct Logger { pub format_desc: Vec>, diff --git a/server/shared/src/token_issuer.rs b/server/shared/src/token_issuer.rs index 193b62e76..e2a9a3213 100644 --- a/server/shared/src/token_issuer.rs +++ b/server/shared/src/token_issuer.rs @@ -3,7 +3,7 @@ use std::{ time::{Duration, SystemTime, UNIX_EPOCH}, }; -use base64::{engine::general_purpose as b64e, Engine}; +use base64::{Engine, engine::general_purpose as b64e}; use hmac::{Hmac, KeyInit, Mac}; use sha2::Sha256; diff --git a/src/platform/os/mac/misc.cpp b/src/platform/os/mac/misc.cpp index c6419a5d8..e8e668726 100644 --- a/src/platform/os/mac/misc.cpp +++ b/src/platform/os/mac/misc.cpp @@ -9,7 +9,6 @@ using util::misc::UniqueIdent; static std::string getUuid() { - io_registry_entry_t ioRegistryRoot = IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/"); CFStringRef uuidCf = (CFStringRef)IORegistryEntryCreateCFProperty(ioRegistryRoot, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0); IOObjectRelease(ioRegistryRoot); diff --git a/support.md b/support.md index 05b053d85..7e232996b 100644 --- a/support.md +++ b/support.md @@ -1,6 +1,5 @@ Globed is a completely free mod, and will never require any payment to use. -But if you want to support the developer and help us pay for server expansions, you can do it on our [Ko-Fi page](https://ko-fi.com/globed)! - -As a sign of appreciation, you will get a nice purple name in-game and a role on our discord server :) +However, if you'd like to support the developer and help us with server expansions, you can contribute through our [Ko-Fi page](https://ko-fi.com/globed)! +As a token of appreciation, you will receive a purple name, an in-game badge, and a special role on our Discord server. :)