|
Rehti MMORPG
1.0.0
Rehti MMORPG is a free and open source MMORPG game.
|
Main class for the server. More...
#include <Server.hpp>

Public Member Functions | |
| Server () | |
| void | acceptConnections () |
| Function to accept new connections from clients, runs on a seperate thread. More... | |
| void | processMessages () |
| Server's main loop for processing messages. More... | |
| void | handleMessage (const Message &msg) |
| Function to parse and act upon messages received from clients. More... | |
Private Member Functions | |
| void | ticker () |
| Timer function that is used to start server ticks, runs on a separate thread. More... | |
| void | tick () |
| Function that updates the gamestate on each server tick, called by ticker() More... | |
| void | sendGameState () |
| Sends the current gamestate to connected clients. More... | |
| void | initGameState () |
| Initializes the gamestate and gameworld. More... | |
| bool | loadPlayer (std::string username, std::string password, const std::shared_ptr< Connection > &connection) |
| Loads a player's data from the database and adds the player to the game. More... | |
| void | savePlayer (int playerId) |
| Saves a player's data to the database. More... | |
Private Attributes | |
| boost::asio::io_context | ioContextM |
| boost::asio::ip::tcp::acceptor | acceptorM |
| std::vector< std::shared_ptr< Connection > > | connectionsM |
| MessageQueue | messagesM |
| std::thread | ioThreadM |
| std::thread | acceptThreadM |
| std::thread | tickThreadM |
| boost::asio::executor_work_guard< boost::asio::io_context::executor_type > | workGuardM |
| GameWorld | gameWorldM |
| DatabaseManager | dbManagerM |
Main class for the server.
| Server::Server | ( | ) |

| void Server::acceptConnections | ( | ) |
Function to accept new connections from clients, runs on a seperate thread.

| void Server::handleMessage | ( | const Message & | msg | ) |
Function to parse and act upon messages received from clients.
| msg |


|
private |
Initializes the gamestate and gameworld.


|
private |
Loads a player's data from the database and adds the player to the game.
| username | |
| password | |
| connection |


| void Server::processMessages | ( | ) |
Server's main loop for processing messages.


|
private |
Saves a player's data to the database.
| playerId |


|
private |
Sends the current gamestate to connected clients.


|
private |
Function that updates the gamestate on each server tick, called by ticker()


|
private |
Timer function that is used to start server ticks, runs on a separate thread.


|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |