Recommendations For a Server Game

Started by
11 comments, last by Josheir 8 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 };
Advertisement

Terrific, thanks!

This topic is closed to new replies.

Advertisement