Advertisement

Recommendations For a Server Game

Started by August 31, 2023 10:58 PM
11 comments, last by Josheir 1 year, 2 months ago

The software you write, in C++, is the server. It uses something like cpp-httplib to open up a socket, listen on a port, and dispatch incoming requests.

The very front page of the github repository has an example of how to start it up:

https://github.com/yhirose/cpp-httplib#server:~:text=ignore%20it%20yourself.-,Server,-%23include%20%3C

You change the various Post and Get request handlers to do whatever your game needs.

Something like, POST to /game to create a new game instance, returning some game ID. POST to /game/GAMEID/move/PLAYERID to add a move in the game. Do a GET to /game/GAMEID to get the current state of the game.

enum Bool { True, False, FileNotFound };

Terrific, thanks!

This topic is closed to new replies.

Advertisement