Structure for online game server

i'm trying to write a server for my little game and i'm wondering about server structure.

Let me explain that. Let's say i will create game in which you could edit skill stats, character basic stats and now i'm wondering how i should implement that.

I don't want to share this game as open source and i don't want changing those stats lets say in txt file because for me it's ugly.

Do you guys have any other ideas how i could implement feature in which i could edit some basic stuff of server but not in txt and not as open source ?

• Are you talking about a database?
– Anko
Oct 31 '15 at 16:53
• It could be in database but i think after that it will be overheaded with too much things on it. Oct 31 '15 at 16:55
• Sorry, I don't understand the question here at all. Could you edit to describe exactly what you are trying to do? Ideally also describe what you have tried.
– Anko
Oct 31 '15 at 16:58
• I mean that i'm doing online game and now i'm coding server for it and i want to implement feature for people that will be able to edit server stuff such as basic stats for characters and i'm asking in which way people should edit that.Txt for me is ugly for that and using database would overhead it.So which thing i should use for that ? Oct 31 '15 at 19:10
• -1 question is unclear Nov 1 '15 at 14:57

You can use several Flatbuffers. Depending on how you want to organize the structure, can be a single master blob on the server or however you want to update it. And smaller buffers on the client that would be sent to the server for update.

An example would be the server having several buckets, one for each player account or the like. Each bucket of data will contain user profile, customization, level, etc. Then you will have code that will allow the client to update what you want them to update on the server and the ability to store in their own PC just what is needed to be stored. You sync all of that when you deem necessary.

This is all just an hypothetical example, you will need to adjust it to your needs.

If you want to learn basic networking I sugest you watch this tutorial series , (episodes 38 - 59 are about networking). He explains how servers work and such. You can then bend the code towards your needs.

• I use boost asio not normal sockets. Oct 31 '15 at 21:25
• Ugh... Programming video tutorials... Nov 1 '15 at 2:37

Do something like this:

struct client
{
int health:
int armor;
}


The client with have an instance of this class; the server will have an instance for each client connected. (You could store them in a map.) Then whenever data changes, have the client send data to the server saying it changed, and the server will update accordingly. Say you only wanted the server to be able to change a player's health. So just handle damage on the server and send the data to the client when the player's health changes.

• You don't get it... I'm asking about METHOD to load server info after starting the server program but not changing server code . I don' want to use txt or ini files because they're ugly for that . And i'm asking if there is another method to load user options directly after starting server. Nov 1 '15 at 13:13
• Oh my bad. Didn't read fully. Use yaml Nov 1 '15 at 20:49

Your server configuration needs to be stored somewhere, so you will need either configuration files or store them in the game database.

When you don't want the end-users to have to edit your configuration files with a text editor or even worse have to use an SQL shell, you will need to provide a graphical user interface to edit them.

Such a GUI could be a standalone application which is accessed remotely (like a web interface), or is run on the server directly.

You could also integrate the admin interface in your normal game client but only make it be visible for admin users (make sure the server also checks the user permissions before applying any configuration changes. You don't want players to be able to change the server configuration by hacking the game client).

Another option to get a GUI is to use XML for your configuration files and create XSD definitions which clearly define how the configuration files are structured. There are XML editors available which provide a quite foolproof GUI when provided with a detailed enough schema definition.

• THANKS.Finally user which provides answer not just post something which isn't even related to question. Nov 1 '15 at 19:11
• If an answer solves your issue, then you have to mark it as correct, That gives both you and Philipp reputation. Nov 2 '15 at 23:17