C++ and MySQL for the server

Started by
13 comments, last by MisterVicodin 10 years, 11 months ago

Is it secure and fast for me to make my C++ DirectX10 game retrieve data from my MySQL server via SQL queries that are run inside the client?

Advertisement

retrieving data is "secure" as long as you don't need to restrict in detail what data the client has access to. (having the client fetch for example a list of news directly from a SQL server is safe if the account used by the client is restricted to SELECTs on that specific table), it would probably be faster to use a cache layer between the SQL server and the client though.

Any semi-competent user will be able to retrieve the MySQL account used by the client and run their own queries with whatever permissions that account has, if you intend to use the SQL server to allow clients to modify and share the game state in a multiplayer game then no, it will be extremely insecure, and if the updates are frequent, very slow.

[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!
No, it is going to be neither fast nor secure to let a database be exposed to the greater Internet. One role of application servers is to filter the kinds of requests that a client will make, and turn them into sanitized back-end queries. There is not sufficient capabilities in SQL servers to do this; that's not what they're for.

Separately, for a real-time game, most developers end up reading the important data into RAM in a persistent process in the application server (call it "game server") and only write back to the database on occasional snapshots or specific events. This is usually done for efficiency purposes.
enum Bool { True, False, FileNotFound };

Definitely not; it is possible to do an effective DoS attack on a MySQL server even without access to any tables at all. You need to put a layer in between MySQL and the big, bad world.

So how can i securely transfer data from my SQL server to the program/video game?

I already suggested how this is done: You create a game server (application server) that talks to the database, and provides the necessary view of the data to the client.
Separately, it accepts requests from the client, computes the result of those requests, and returns the authoritative response to the client, as well as stores important outcomes back into the database.
enum Bool { True, False, FileNotFound };

I already suggested how this is done: You create a game server (application server) that talks to the database, and provides the necessary view of the data to the client.
Separately, it accepts requests from the client, computes the result of those requests, and returns the authoritative response to the client, as well as stores important outcomes back into the database.

Yes but you never explained how i would do this. Not everyone here have a Game Programming degree in C++ :P Lol. But do you have any suggestions on how i could do this?

What i mean is, what should i use to make the server? Is there a tutorial on this?

What i mean is, what should i use to make the server? Is there a tutorial on this?

You should use tools that are available to you, and that you are comfortable in using.
Successful game servers have been written using a variety of technologies, including but not limited to C++, Java, C#, Python, Visual Basic, Erlang, JavaScript, and C.

So, the first question is: What do you already know, and what do you have available to you?
enum Bool { True, False, FileNotFound };

What i mean is, what should i use to make the server? Is there a tutorial on this?

You should use tools that are available to you, and that you are comfortable in using.
Successful game servers have been written using a variety of technologies, including but not limited to C++, Java, C#, Python, Visual Basic, Erlang, JavaScript, and C.

So, the first question is: What do you already know, and what do you have available to you?

What i meant is how do i make a server? Idek how i would do any of this but no-one is even giving me a hint on how to start coding a server.

What i already know is basically how to do everything needed to make an online game except how to code a server. So any help would be great!

This topic is closed to new replies.

Advertisement