• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
MisterVicodin

C++ and MySQL for the server

14 posts in this topic

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?

0

Share this post


Link to post
Share on other sites

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.

Edited by SimonForsman
0

Share this post


Link to post
Share on other sites
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.
1

Share this post


Link to post
Share on other sites

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.

0

Share this post


Link to post
Share on other sites
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.
0

Share this post


Link to post
Share on other sites

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?

0

Share this post


Link to post
Share on other sites

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?
0

Share this post


Link to post
Share on other sites

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!

0

Share this post


Link to post
Share on other sites



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!


Google: socket tutorial. There are plenty of examples on basic client server communication out there.

You could also pick some higher level networking library (RakNet for example) and look for tutorials on that instead. Edited by SimonForsman
0

Share this post


Link to post
Share on other sites
The FAQ for this forum has links to game network coding.

In very brief, to create a server, you can start as such:

1) Call socket() to create a TCP socket.
2) Call bind() to bind the socket to your given port, and IP address 0.0.0.0 (IPADDR_ANY).
3) Call listen() for basically historical reasons.
4) Now, enter a loop that does the following:
4.1) Put all active sockets in an FD_SET.
4.2) Call select() with that FD_SET to test readability of sockets. Perhaps use a timeout so you can run periodic events even if the server is idle.
4.3) For the listening socket, if it returns readable, it means someone is connecting; call accept() on it and allocate a data structure with incoming buffer and client information. (This is empty for now.) Put the mapping from socket ID to buffer/client information into a hash table.
4.4) For each connected socket that is readable by select(), call recv() once to attempt to fill up the incoming data buffer in the per-socket data structure. Recv() will not block the first time you call it after select() says it is readable.
4.4.1) Decode, remove, and dispatch any complete packet(s) that are in the receive buffer for this socket/client.
4.4.2) If recv() returns 0, or the client sends a "quit/disconnect" command, or the client is sending bad packets, close the socket, and de-allocate the buffer/client information structure for this socket.
4.5) Goto 4.1

That's really all there is to the basic server loop, based on select(). This will easily get you to many hundred simultaneous users.
1

Share this post


Link to post
Share on other sites

The FAQ for this forum has links to game network coding.

In very brief, to create a server, you can start as such:

1) Call socket() to create a TCP socket.
2) Call bind() to bind the socket to your given port, and IP address 0.0.0.0 (IPADDR_ANY).
3) Call listen() for basically historical reasons.
4) Now, enter a loop that does the following:
4.1) Put all active sockets in an FD_SET.
4.2) Call select() with that FD_SET to test readability of sockets. Perhaps use a timeout so you can run periodic events even if the server is idle.
4.3) For the listening socket, if it returns readable, it means someone is connecting; call accept() on it and allocate a data structure with incoming buffer and client information. (This is empty for now.) Put the mapping from socket ID to buffer/client information into a hash table.
4.4) For each connected socket that is readable by select(), call recv() once to attempt to fill up the incoming data buffer in the per-socket data structure. Recv() will not block the first time you call it after select() says it is readable.
4.4.1) Decode, remove, and dispatch any complete packet(s) that are in the receive buffer for this socket/client.
4.4.2) If recv() returns 0, or the client sends a "quit/disconnect" command, or the client is sending bad packets, close the socket, and de-allocate the buffer/client information structure for this socket.
4.5) Goto 4.1

That's really all there is to the basic server loop, based on select(). This will easily get you to many hundred simultaneous users.

I did not understand any of this except how to open a socket. Can someone just add me on Skype so in case i need help i will have someone to help me out?

0

Share this post


Link to post
Share on other sites
If you do not understand that description, then you need to first do step 0: Learn to effectively develop software. This includes being good at at least two different programming languages, and being able to read and understand the manual pages and documentation of the system libraries.
If you do not yet have those skills, you cannot develop a robust game server. Right now, you're trying to learn calculus, from a textbook written in Latin, without knowing any Latin. You need to learn the Latin before you can learn the calculus.

If you want one-on-one help, there are many contractors and consultants that will spend their time helping you out. That will cost money, though.
1

Share this post


Link to post
Share on other sites

If you do not understand that description, then you need to first do step 0: Learn to effectively develop software. This includes being good at at least two different programming languages, and being able to read and understand the manual pages and documentation of the system libraries.
If you do not yet have those skills, you cannot develop a robust game server. Right now, you're trying to learn calculus, from a textbook written in Latin, without knowing any Latin. You need to learn the Latin before you can learn the calculus.

If you want one-on-one help, there are many contractors and consultants that will spend their time helping you out. That will cost money, though.

Actually, i have successfully coded many many things in about 6 or 7 other languages. And learning to effectively code has nothing to do with it. I was asking what requirements i need. Suchas the include files. I have now coded a server btw. I was simply asking for the required information needed to be able to code a server. And actually, calculus is a good suggestion but is not actually necessary. Anyways. Thanks guys for all your help. I followed a WinSock tutorial to get started and coded the rest of the server myself. Hoping that i will have my MMORPG done by December. Good day everyone.

-1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0