Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I've just finished my game and I'd like to add some ranking functionality to it. I have a mySQL database running on my website and want to be able to insert and retrieve data from it. My knowledge in server side programming is basic to none and I'm wondering if you could provide me some tips on how to approach this. My game was developed in C++.

1) Should I look for I library written in C/C++ that handles this client/server communication directly?

OR

2) Should I implement it through a script (say python) and somehow interface it through my C++ code. By interfacing I imagine I'd call .py passing in a string as argument, and somehow receiving a string as return. (table entries, error messages, etc). Also I don't want anyone messing up with the database. I don't know, the source code would be there with connection authentication and I assume anyone knowing python could adjust it to inject any value in the database. Well, If that is a good approach what libraries could I use to interface C and Python (or any other say Java).

share|improve this question
1  
Have you thought about building a simple REST API on your website, that your C++ game can consume by sending the appropriate GET/POST? –  Nate Aug 14 '12 at 20:13
2  
add comment

2 Answers 2

up vote 1 down vote accepted

Write a script in perl, python, or some other convenient scripting language that processes a form which specifies the game, who won etc. You can develop and test this script using any web browser. Use a network package such as libcurl to submit these forms from within the c++ application.

You will need to take some steps from the beginning to prevent fraud and accidents from trashing your rankings. For example, make your request include a md5 checksum to authenticate it and prevent altering the request, and keep track at the server to prevent the same request from being used twice.

share|improve this answer
add comment

Have you thought about using an existing service to handle your online leaderboard ? If you want to focus on your game this might be a better idea.

I think Scoreoid would be particularly suited for your usecase, it handles hosting, user authentication, https security...while still giving you the freedom to implement your user interface and features the way you like (it's a rest HTTP based service so all client code is implemented by you).

I was looking at Scoreoid for an Android online leaderboard (post here) but it works on all platform which is quite nice.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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