Skip to content

Commit

Permalink
style: minor style improvements
Browse files Browse the repository at this point in the history
- this commit also enables client-side level restart on default.
  • Loading branch information
Xenapte committed Jul 22, 2022
1 parent a6d62ae commit b6c0661
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/BallanceMMOServer/out/build/x64-Debug/CMakeFiles
/build
/BallanceMMOClient/include
/BallanceMMOClient/lib/BML
/BallanceMMOClient/lib
/BallanceMMOClient/Debug
/Debug
/BallanceMMOClient/x64/Debug
Expand Down
19 changes: 12 additions & 7 deletions BallanceMMOCommon/entity/version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,21 @@ namespace bmmo {

std::string to_string() const;
bool operator<(const version_t& that) const;
bool operator>(const version_t& that) const;
};

const version_t minimum_client_version = {3, 2, 9, Beta, 12};

std::string version_t::to_string() const {
std::string stage_s = "";
std::stringstream ss;
ss << (int)major << '.' << (int)minor << '.' << (int)subminor;
switch (stage) {
case Alpha: stage_s = "-alpha" + std::to_string((int)build); break;
case Beta: stage_s = "-beta" + std::to_string((int)build); break;
case RC: stage_s = "-rc" + std::to_string((int)build); break;
case Release: break;
case Alpha: ss << "-alpha" << (int)build; break;
case Beta: ss << "-beta" << (int)build; break;
case RC: ss << "-rc" << (int)build; break;
case Release:
default: break;
};
std::stringstream ss;
ss << (int)major << "." << (int)minor << "." << (int)subminor << stage_s;
return std::move(ss.str());
}

Expand All @@ -50,6 +51,10 @@ namespace bmmo {
if (build > that.build) return false;
return false;
}

bool version_t::operator>(const version_t& that) const {
return that < *this;
}
}

#endif //BALLANCEMMOSERVER_VERSION_HPP
4 changes: 2 additions & 2 deletions BallanceMMOServer/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,7 @@ class server : public role {
YAML::Node config_;
std::unordered_map<std::string, std::string> op_players_, map_names_;
std::unordered_map<std::string, int> map_ranks_;
bool op_mode_ = true, restart_level_ = false, force_restart_level_ = false;
bool op_mode_ = true, restart_level_ = true, force_restart_level_ = false;
ESteamNetworkingSocketsDebugOutputType logging_level_ = k_ESteamNetworkingSocketsDebugOutputType_Important;
};

Expand Down Expand Up @@ -996,7 +996,7 @@ int parse_args(int argc, char** argv, uint16_t* port, std::string& log_path, boo
printf("Usage: %s [OPTION]...\n", argv[0]);
puts("Options:");
puts(" -p, --port=PORT\t Use PORT as the server port instead (default: 26676).");
puts(" -l, --log=PATH\t Log to the file at PATH in addition to stdout.");
puts(" -l, --log=PATH\t Write log to the file at PATH in addition to stdout.");
puts(" -h, --help\t\t Display this help and exit.");
puts(" -v, --version\t\t Display version information and exit.");
puts(" --dry-run\t\t Test the server by starting it and exiting immediately.");
Expand Down
89 changes: 47 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,15 @@ BallanceMMO is a project which brings online experiences to Ballance.
- A build tool like GNU Make, Ninja: Build server binary
- A compiler with core C++20 feature support
- This project has been successfully compiled under:
- GCC 9.4 (server-side)
- GCC 9.4, 10.3, and 12.1 (server-side)
- Apple Clang 13.1 (server-side)
- Visual Studio 2019 (client side, or specifically, BML related stuff)
- Visual Studio 2019 and 2022 (client side, or specifically, BML related stuff)
- One of the following crypto solutions:
- OpenSSL 1.1.1 or later
- OpenSSL 1.1.x, plus ed25519-donna and curve25519-donna. (Valve GNS has made some minor changes, so the source is included in this project.)
- libsodium
- Google protobuf 2.6.1+ (included in submodule)
- Dev pack of BallanceModLoader (client-side, [release page](https://github.com/Gamepiaynmo/BallanceModLoader/releases))

- Dev pack of BallanceModLoader (client-side, [*release page*](https://github.com/Gamepiaynmo/BallanceModLoader/releases))

## Building server

Expand All @@ -45,49 +44,55 @@ BallanceMMO is a project which brings online experiences to Ballance.
2. Install OpenSSL and protobuf
- Debian/Ubuntu
```commandline
# apt install libssl-dev
# apt install libprotobuf-dev protobuf-compiler
apt install libssl-dev
apt install libprotobuf-dev protobuf-compiler
```
- Arch
```commandline
# pacman -S openssl
# pacman -S protobuf
pacman -S openssl
pacman -S protobuf
```
- macOS with brew
```commandline
$ brew install [email protected]
$ export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/opt/[email protected]/lib/pkgconfig
$ brew install protobuf
brew install [email protected]
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/opt/[email protected]/lib/pkgconfig
brew install protobuf
```
(Haven't tried on a Linux distro with yum as package manager. Sorry Fedora/RHEL/CentOS guys...)
3. Building!
- Ninja
```commandline
$ cd BallanceMMOServer
$ mkdir build
$ cd build
$ cmake -G Ninja ..
$ ninja
cd BallanceMMOServer
mkdir build
cd build
cmake -G Ninja ..
ninja
```
- GNU Make
```commandline
$ cd BallanceMMOServer
$ mkdir build
$ cd build
$ cmake -G ..
$ make
cd BallanceMMOServer
mkdir build
cd build
cmake -G ..
make
```
If CMake failed to find openssl for some reason, you may need to specify path to openssl yourself.
For example:
```commandline
$ cmake -G Ninja .. -DOPENSSL_ROOT_DIR="/usr/local/opt/[email protected]/"
```
Expand All @@ -104,14 +109,14 @@ BallanceMMO is a project which brings online experiences to Ballance.
$ ./BallanceMMOServer --help
Usage: ./BallanceMMOServer [OPTION]...
Options:
-p, --port=PORT Use PORT as the server port instead (default: 26676).
-l, --log=PATH Log to the file at PATH in addition to stdout.
-h, --help Display this help and exit.
-v, --version Display version information and exit.
--dry-run Test the server by starting it and exiting immediately.
-p, --port=PORT Use PORT as the server port instead (default: 26676).
-l, --log=PATH Write log to the file at PATH in addition to stdout.
-h, --help Display this help and exit.
-v, --version Display version information and exit.
--dry-run Test the server by starting it and exiting immediately.
```
Alternatively, use the bash script `start_ballancemmo_loop.sh` (`start_ballancemmo_loop.bat` on Windows) which handles file logging and automatically restarts the server after crashes. *All command line arguments for the server executable also applies there.*
Alternatively, use the bash script `start_ballancemmo_loop.sh` (`start_ballancemmo_loop.bat` on Windows) which handles file logging automatically and restarts the server after crashes. *All command line arguments for the server executable also applies there.*
```commandline
$ ./start_ballancemmo_loop.sh
Expand All @@ -131,41 +136,41 @@ __Warning Beforehand__: DO NOT upgrade (cancel when prompted) when Visual Studio
- In a `Visual Studio Developer PowerShell`/`Visual Studio Developer Command Prompt`
```commandline
> cd submodule\vcpkg
> .\bootstrap-vcpkg.bat
cd submodule\vcpkg
.\bootstrap-vcpkg.bat
```
3. Build the prerequisites using vcpkg
- This is the step where vcpkg will fail if you haven't got your English language pack installed. (Again, wtf Microsoft???)
```commandline
> .\vcpkg --overlay-ports=..\GameNetworkingSockets\vcpkg_ports install gamenetworkingsockets
```
You may also try
```commandline
> .\vcpkg --overlay-ports=..\GameNetworkingSockets\vcpkg_ports install gamenetworkingsockets[core,libsodium]
```
if openssl fails to compile.
4. Install vcpkg integrate so that Visual Studio will pick up installed packages
```commandline
> vcpkg integrate install
```
5. Extract BML Dev pack and [Boost Library](https://www.boost.org/users/download/), and place the following:
*BML*:
```
include\BML -> BallanceMMOClient\include\BML
lib\Debug -> BallanceMMOClient\lib\BML\Debug
lib\Release -> BallanceMMOClient\lib\BML\Release
```
*Boost*:
```
boost -> BallanceMMOClient\include\boost
```
6. Open the Visual Studio project file `BallanceMMO.sln`.
- *BML*:
- include\BML -> BallanceMMOClient\include\BML
- lib\Debug -> BallanceMMOClient\lib\BML\Debug
- lib\Release -> BallanceMMOClient\lib\BML\Release
- *Boost*:
- boost -> BallanceMMOClient\include\boost
6. Open the Visual Studio project file `BallanceMMO.sln`.
- DO NOT upgrade the project(cancel) when prompted! (Yet again, wtf Microsoft???)
7. In `Solution Explorer` panel, Right click on the project `BallanceMMOClient`, select `Properties`.
Expand Down

0 comments on commit b6c0661

Please sign in to comment.