-2
\$\begingroup\$

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 ?

\$\endgroup\$
5
  • \$\begingroup\$ Are you talking about a database? \$\endgroup\$
    – Anko
    Commented Oct 31, 2015 at 16:53
  • \$\begingroup\$ It could be in database but i think after that it will be overheaded with too much things on it. \$\endgroup\$
    – JMII89
    Commented Oct 31, 2015 at 16:55
  • 3
    \$\begingroup\$ 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. \$\endgroup\$
    – Anko
    Commented Oct 31, 2015 at 16:58
  • \$\begingroup\$ 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 ? \$\endgroup\$
    – JMII89
    Commented Oct 31, 2015 at 19:10
  • \$\begingroup\$ -1 question is unclear \$\endgroup\$
    – Lucien
    Commented Nov 1, 2015 at 14:57

4 Answers 4

1
\$\begingroup\$

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.

\$\endgroup\$
0
1
\$\begingroup\$

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.

\$\endgroup\$
2
  • \$\begingroup\$ I use boost asio not normal sockets. \$\endgroup\$
    – JMII89
    Commented Oct 31, 2015 at 21:25
  • \$\begingroup\$ Ugh... Programming video tutorials... \$\endgroup\$ Commented Nov 1, 2015 at 2:37
1
\$\begingroup\$

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.

\$\endgroup\$
2
  • \$\begingroup\$ 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. \$\endgroup\$
    – JMII89
    Commented Nov 1, 2015 at 13:13
  • \$\begingroup\$ Oh my bad. Didn't read fully. Use yaml \$\endgroup\$ Commented Nov 1, 2015 at 20:49
1
\$\begingroup\$

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.

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .