mikyll / MultiplayerGame

SDL2 multiplayer game example

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MIT License Size Issues Downloads Stars
C VS

MultiplayerGame

A super simple multiplayer "game" made in C, with SDL2 and ENet.

Demo

2024-04-20_01-13-38.online-video-cutter.com.mp4

Features/Roadmap

  • deltaTime game loop with the possibility to cap to a specific framerate;
  • multiplayer based on a server/client model and UDP reliable packets;
  • server->client disconnection;
  • non-blocking wait for client connections;
  • improve UI elements;
  • refactor;

Project Setup

TODO

SDL2 Libraries

ENet Library

Related issue: lsalzman/enet#80 (Useful for installation)

Build

The project is developed on Visual Studio 2022 (MSVC v14.39.33519), with the following dependencies:

Windows

You can use the Microsoft Build Engine, from within the Visual Studio Command Prompt:

msbuild MultiplayerGame_VisualStudio/MultiplayerGame.sln

Or just open the solution and build the project.

The build will generate an executable file named MultiplayerGame.exe in MultiplayerGame_VisualStudio/x64/Debug or MultiplayerGame_VisualStudio/x64/Release directories.
NB: to run the program you need SDL2.dll and SDL2_image.dll.

Linux

  1. You must first install sdl2 and enet development libraries:
sudo apt update
sudo apt install libsdl2-dev libsdl2-image-dev libenet-dev
  1. Then you can just compile using the makefile:
make

This will generate an executable file named multiplayer_game.

Aknowledgements

Huge thanks to Parallel Realities and their fenomenal SDL2 tutorials. Go check them out on their website and on Itch.io, the code bundles are extremely cheap and they are insanely well made.

LinkedIn GitHub followers

About

SDL2 multiplayer game example

License:MIT License


Languages

Language:C 98.1%Language:C++ 1.4%Language:Objective-C 0.4%Language:Makefile 0.0%