Skip to content
217 changes: 191 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,81 @@
# Ryan R-Type

**Ryan R-Type** is a modern networked multiplayer space shooter game inspired by the classic R-Type arcade game. Built with a client-server architecture in C++20, it features real-time multiplayer gameplay, a custom Entity-Component-System (ECS), and advanced networking protocols.

## 🚀 Features

- 🎮 **Multiplayer Support**: Up to 4 players in cooperative gameplay
- 🌐 **Real-time Networking**: UDP-based communication with client-server architecture
- 🎨 **Modern Graphics**: SFML-powered rendering with dynamic effects
- 🔧 **Configurable Server**: Customizable port, IP, and tick rate
- 🕹️ **Custom ECS**: High-performance entity management system
- 🎯 **Lobby System**: Create and join game lobbies with unique codes
- 📊 **HTTP API**: RESTful API for game statistics and management
- 🔒 **Cross-platform**: Supports Windows, Linux, and macOS

## 📋 System Requirements

### Minimum Requirements
- **OS**: Windows 10+, Linux (Ubuntu 20.04+), macOS 11+
- **Compiler**: GCC 11+, Clang 12+, or MSVC 2019+
- **CMake**: Version 3.23 or higher
- **RAM**: 512 MB
- **Network**: Internet connection for multiplayer

### Development Requirements
- **C++ Compiler** with C++20 support
- **CMake**: 3.23+
- **vcpkg**: Package manager for dependencies
- **Git**: Version control

## ⚡ Quick Start

### Running Pre-built Binaries

```bash
# Start the server (default: 127.0.0.1:4242)
./r-type_server

# In another terminal, start the client
./r-type_client -n Player1
```

### Multiplayer Setup

```bash
# Server on a specific IP and port
./r-type_server -p 8080 -i 0.0.0.0

# Clients connect to the server
./r-type_client -p 8080 -i <server_ip> -n Alice
./r-type_client -p 8080 -i <server_ip> -n Bob
```

## Installing Ryan R-Type

### Via Releases
### Via Releases (Recommended)

Download the latest pre-built binaries from our [releases page](https://github.com/AlbanRSS/doc-rtype/releases).

**Installation steps:**

To install our project, you just need to go to our release page and follow the release's instructions to download it.
1. Download the appropriate archive for your platform:
- **Windows**: `r-type-windows-x64.zip`
- **Linux**: `r-type-linux-x64.tar.gz`
- **macOS**: `r-type-macos-x64.tar.gz`

2. Extract the archive:
```bash
# Linux/macOS
tar -xzf r-type-*.tar.gz
cd r-type

# Windows: Use Windows Explorer or
unzip r-type-windows-x64.zip
cd r-type
```

3. Run the executables (see [Quick Start](#-quick-start) section)

### Via cloning

Expand All @@ -28,19 +99,21 @@ After compiling the project, you can run the server and client executables.

#### Running the Server
```bash
./r-type_server -p <port> -i <ip_address> -n <nb_clients>
./r-type_server -p <port> -i <ip_address>
```

Arguments:
- `-p <port>`: Specify the port number (required)
- `-i <ip_address>`: Specify the IP address to bind to (required)
- `-n <nb_clients>`: Specify the maximum number of clients (1-4, default: 1) (required)
- `-p <port>`: Specify the port number (default: 4242) (optional)
- `-i <ip_address>`: Specify the IP address to bind to (default: 127.0.0.1) (optional)
- `-tps <tps>`: Specify the TPS (ticks per second) (default: 20) (optional)
- `-d`: Enable debug mode (optional)
- `-h`: Display help message (optional)

Note: Port 5173 is reserved for HTTP server.

Example:
```bash
./r-type_server -p 4242 -i 127.0.0.1 -n 4
./r-type_server -p 4242 -i 127.0.0.1 -tps 20
```

#### Running the Client
Expand All @@ -60,19 +133,102 @@ Example:
./r-type_client -p 4242 -i 127.0.0.1 -n Player1
```

## Contributing
## 🔧 Troubleshooting

### Common Issues

#### Server: Port Already in Use
```bash
# Error: Address already in use
# Solution: Use a different port
./r-type_server -p 8080 -i 127.0.0.1
```

#### Client: Connection Refused
```bash
# Possible causes:
# 1. Server is not running
# 2. Wrong IP or port
# 3. Firewall blocking connection

# Verify server is running on the correct port
./r-type_server -p 4242 -i 0.0.0.0

# Connect with matching port
./r-type_client -p 4242 -i <server_ip>
```

#### Compilation Errors
```bash
# If vcpkg dependencies fail to install
./scripts/install_dependencies.sh

# Clean build directory and rebuild
./scripts/clean_project.sh
./scripts/compile_project.sh
```

#### HTTP Server Port Conflict
Port 5173 is reserved for the HTTP API server. If you need to run the game server on a different port:
```bash
./r-type_server -p 4243 # Use any port except 5173
```

#### Permission Denied on Scripts
```bash
# Unix systems: Make scripts executable
chmod +x ./scripts/*.sh
```

### Performance Issues

**High Latency:**
- Ensure stable network connection
- Try reducing TPS: `./r-type_server -tps 15`
- Check firewall/router settings

**Low FPS:**
- Update graphics drivers
- Close resource-intensive applications
- Check system meets minimum requirements

### Debug Mode

Enable debug mode for detailed logging:
```bash
# Server
./r-type_server -d

# Client
./r-type_client -d
```

### Getting Help

If you encounter issues not covered here:
1. Check the [documentation](https://albanrss.github.io/doc-rtype/)
2. Search [existing issues](https://github.com/AlbanRSS/doc-rtype/issues)
3. Create a new issue with:
- Your OS and version
- Steps to reproduce
- Error messages/logs
- Expected vs actual behavior

## 🤝 Contributing

For contribution guidelines, including prerequisites and commit conventions, please refer to [HOWTOCONTRIBUTE.md](HOWTOCONTRIBUTE.md).

## Documentation

### Docusaurus

The **Docusaurus** documentation regroups the entirety of the project documentation, protocole server gui and clinet information, but also how to contribute to the project and how to use the project itlsef.
The **Docusaurus** documentation contains the entirety of the project documentation, including protocol specifications, server/client information, contribution guidelines, and usage instructions.

📖 **Access the online documentation**: https://albanrss.github.io/doc-rtype/

Access the documentation at https://albanrss.github.io/doc-rtype/
#### Running Documentation Locally

To run the documentation travel to the `/documentation` folder than run the following :
To run the documentation locally, navigate to the `/documentation` folder and run the following:

``` bash
cd documentation/docusaurus/
Expand All @@ -82,33 +238,42 @@ npm start
Then you can find the documentation at http://localhost:3000/


#### Prerequisite :
#### Prerequisites

To run the Docusaurus documentation you will need to have the docusaurus librairy installed on your device.
To run the Docusaurus documentation locally:
- **Node.js**: Version 18.0 or higher
- **npm**: Version 8.0 or higher

- [Docusaurus](https://docusaurus.io/docs/installation)
The Docusaurus library will be automatically installed when running `npm install`.

For more information, see the [Docusaurus installation guide](https://docusaurus.io/docs/installation).


### Doxygen

The **Doxygen** module allows you to generate pdf documentation and schemas of the project architecure and logic.
The **Doxygen** module generates PDF documentation and diagrams of the project architecture and logic.

To update the documentation run the following :
To generate the documentation, run:

``` bash
./scripts/generateDoc.sh
```bash
./scripts/generate_doc.sh
```

#### Prerequisite :
The generated documentation will be available in `documentation/doc/`.

To run the doxygen generations script you will need to have the Doxygen and pdf-Latex Library, you can find there install guide here
#### Prerequisites

- [Doxygen](https://www.doxygen.nl/manual/install.html)
- [PDF Latex](https://www.latex-project.org/get/)
To run the Doxygen generation script, you need:
- **Doxygen**: Version 1.9.0 or higher
- **LaTeX**: For PDF generation (pdflatex)
- **Graphviz**: For generating diagrams (optional but recommended)

You also need to make sure that the script is executable.
Installation guides:
- [Doxygen Installation](https://www.doxygen.nl/manual/install.html)
- [LaTeX Installation](https://www.latex-project.org/get/)
- [Graphviz Installation](https://graphviz.org/download/)

``` bash
cd ./script
chmod +x generateDoc.sh
**Make the script executable:**
```bash
chmod +x ./scripts/generate_doc.sh
```
3 changes: 2 additions & 1 deletion client/gsm/states/scenes/InGame/InGameState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,8 @@ void InGameState::drawInGameMetrics(std::shared_ptr<gfx::IWindow> window, float
std::count(metricsText.begin(), metricsText.end(), '\n')) + 1;
size_t totalHeight = textHeight + (numLines - 1) * 5;
size_t baseX = static_cast<size_t>(constants::MAX_WIDTH - 5.0f);
size_t baseY = static_cast<size_t>(constants::MAX_HEIGHT - totalHeight - 15.0f);
size_t baseY = static_cast<size_t>(constants::MAX_HEIGHT -
static_cast<float>(totalHeight) - 15.0f);

std::istringstream iss(metricsText);
std::string line;
Expand Down
Loading