Skip to content

[RType] Build & Run

Raphael_m edited this page Nov 3, 2024 · 7 revisions
logo

In this section, you’ll find all the information needed to install and launch the project.

Summary

Installation

Prerequisite

To compile this project, you’ll need the following dependencies:

  • Conan for third-party dependencies.
  • CMake to build the project.
  • GCC or Clang to compile the project.
  • Visual Studio 2022 to compile on windows

Install Conan

Note: If you encounter any issue, see the official Conan installation guide.

Windows

To install Conan on Windows, follow these steps:

  1. Download the Conan installer from Conan's official website.
  2. Follow the installer instructions to complete the installation.

Linux

To install Conan on Linux, you can use pip:

pip install conan

Install CMake

Windows

  1. Download the CMake installer from CMake’s official website.
  2. Run the installer and follow the instructions.

Linux

Install CMake via your package manager:

sudo apt update
sudo apt install cmake

Install GCC or Clang

Windows

For Windows, you can install GCC via MinGW or install Clang directly:

  1. Download MinGW from MinGW’s official website.
  2. Follow the installation instructions, and ensure you add MinGW to your PATH.

Linux

On most Linux distributions, you can install GCC or Clang using the package manager:

# For GCC
sudo apt install gcc

# For Clang
sudo apt install clang

Building the Project

Prerequisites

  • CMake (3.10+)
  • Conan (1.36+)

Building on Linux

  1. Open a terminal and navigate to your project directory.
cd path\to\your\project
  1. Create a build directory:
mkdir build && cd build
  1. Install dependencies:
conan install .. --output-folder=build/conan --build=missing
  1. Configure with CMake:
cmake .. -DCMAKE_TOOLCHAIN_FILE=conan/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release
  1. Build the project:
cmake --build .

Building on Windows

  1. Open a terminal and navigate to your project directory.
cd path\to\your\project
  1. Create a build directory:
mkdir build && cd build
  1. Install dependencies:
conan install . --output-folder=build/conan --build=missing -c "tools.system.package_manager:mode=install" -c "tools.system.package_manager:sudo=true"
  1. Configure with CMake:
cmake .. -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE="conan/conan_toolchain.cmake" -DCMAKE_POLICY_DEFAULT_CMP0091=NEW
  1. Build the project
cmake --build . --config Release

Customization

To build with SDL, use:

conan install .. -o graphics=SDL --output-folder=build/conan --build=missing

Manual dependency installation

If you prefer not to use Conan, make sure you have the following dependency versions:

  • glm > cci.20230113
  • asio > 1.30
  • sfml > 2.6
  • lua > 5.4
  • nlohmann_json > 3.11

Build using the installer

Note: Download the installer from this link and follow the instructions for a quick installation.


Client & server launching

To play, a client needs to connect to a server.

Client Launching

For the game launch of a client, our approach is based on a classic game startup process. Similar to VALORANT, Overwatch, and Minecraft, no parameters are required—just an executable to run. The program will automatically retrieve the player’s IP and use the first available port on their machine. The only connection needed occurs in the menu, where the server’s host and port are requested for the player to connect.

Linux

./r-type_client

Windows

.\r-type_client.exe

Optional: Specifying Host and Port

If you would like to specify the necessary fields for launching your game on the client side, a debug mode is available that allows you to choose your host and port.

Linux

./r-type_client --debug [HOST] [PORT]

# Example
./r-type_client --debug 127.0.0.1 4242

Windows

.\r-type_client.exe --debug [HOST] [PORT]

# Example
.\r-type_client.exe --debug 127.0.0.1 4242

Server Launching

The server can be launched without specifying any arguments, similar to the client.

Warning: By default, the server will use 127.0.0.1 as the host and 8581 as the port, making it accessible only on a local machine.

Linux

./r-type_server

Windows

.\r-type_server.exe

Optional: Specifying Host and Port

If you want to run your server with a specific host and port, use the following command:

Linux

./r-type_server -p [PORT] -H [HOST]

# Example
./r-type_server -p 4242 -H 127.0.0.2

Windows

.\r-type_server -p [PORT] -H [HOST]

# Example
.\r-type_server -p 4242 -H 127.0.0.2

Previous page: RType Documentation
Next page: How to play

Clone this wiki locally