2
\$\begingroup\$

I'd like to get into online games programming. I thought that as a start i'd be a good idea to implement an online database that would store the progress and score for a game i have made, i'll probably want to implement an account system too.

My issue is, i can't see to be able to ask google the right question. I don't know where to start. I've touched some on SQL and PHP, HTML and XSL, but, to me they're just languages, i can't see the big picture, how do these things connect to form a working service? I'm not looking for a solution, i just don't know what should i learn.

I'm not looking for knowledge on sockets, i'm familiar with network programming, i just don't understand the "modern" process of handling databases. I'd be very happy if somebody could lay out the structure of a database, how you put it out on the web, how you access the information and change it (not in a direct solution, just "this is done by programming a filter in SQL"), what languages are used for it, etc.

\$\endgroup\$

closed as off-topic by Philipp, Alexandre Vaillancourt, Engineer, Gnemlock, Tyyppi_77 Jul 18 '17 at 12:26

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about "how to get started," "what to learn next," or "which technology to use" are discussion-oriented questions which involve answers that are either based on opinion, or which are all equally valid. Those kinds of questions are outside the scope of this site. Visit our help center for more information." – Philipp, Gnemlock, Tyyppi_77
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    \$\begingroup\$ This is not where I would start with making games. Start with the rendering and gameplay first. \$\endgroup\$ – notlesh Feb 15 '12 at 6:15
  • \$\begingroup\$ "for a game i have made", i don't think i was being vague here \$\endgroup\$ – dreta Feb 15 '12 at 7:31
  • \$\begingroup\$ @stephelton: what if he wants to make a webgame? ^^ \$\endgroup\$ – o0'. Feb 15 '12 at 8:21
  • \$\begingroup\$ @Lohoris he still has to draw things and there is still some gameplay mechanicisms involved... \$\endgroup\$ – notlesh Feb 15 '12 at 15:04
5
\$\begingroup\$

The database is the backend, your game is the client. Since you can't (well, technically you can but you really shouldn't) connect to the DB directly, you'll have to write some kind of middleware for that.

The middleware usually runs as a web-service or deamon on a server and exposes an interface for you to access/store game data. This stuff can be implemented in a lot of different languages.. basically any language that you can run on a server and access a database with.

For things like highscores, achievements etc. you can write a simple PHP (or Ruby, Java,..) script that you can access via HTTP. A common architecture for web APIs like this is REST. If you would implement a highscore system as RESTful service, you might have an URL like this:

http://my.server.com/highscores

Sending a GET request to that URL would fetch the scores from the DB and return them (you could send them as XML, JSON or similar).

To add a new score-entry, you maybe have an URL like:

http://my.server.com/highscores/add

And you would send a new Highscore to that address using a HTTP POST request. Then you read out the POST data and insert it into the database.

Of course you don't have to conform to any architecture (such as REST), but I'd say it's good practice.

Here are some things you should be aware of when you do something like this for the first time:

  • Don't trust the client. If your game can send a highscore, anybody else can do so also... this question touches on that topic.

  • Always validate and sanitize incoming data (remember, don't trust the client). Being sloppy with these things will make your service susceptible to SQL injection attacks.

\$\endgroup\$
  • 1
    \$\begingroup\$ thank you, at first this didn't sound like the answer i was looking for, but after googling for the past 2 days it all became clear. i create a database, put it on a server, then i create a script as an interface to run on the server and use URLs to query the server and recieve or send the information i want, it's exactly like you've said, i'm just a dummy, thank you so much. \$\endgroup\$ – dreta Feb 16 '12 at 2:18
  • 1
    \$\begingroup\$ @dreta You got it right. Glad it helped. \$\endgroup\$ – bummzack Feb 16 '12 at 8:29
1
\$\begingroup\$

I just want to complement the @bummzack `s answer.

RESTful service is a good idea to implement the programming interface between the game clienet and server.If you plan to implement the communication way with this type of architecture.I recommend the existed website developing framwork such as Lumen, a light-weight framework.

Firstly, native language such as PHP is verbose and inconvenient to implement the RESTful API, but the route of framework can easily bind the controller and URL,and convenient to maintain.Besides, the database model of framework also is powerful to operate the data with OOP style.

Secondly, popular website framework such as Django and Laravel is built for developing the entire website with the MVC architecture, but their "view" part just for the HTML output.You know, the "view" of online game is the game client itself.So the heavy-weight framework maybe not suitable,because the bigger space taking and the runing efficiency(some view relative modules will be loaded in the entrance of framwork).

However,Lumen just is one of recommended frameworks,hope to it can help you:)

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.