Sign in to follow this  

Help with having my own game server for my own game

Recommended Posts

Hi all! Me and a friend are thinking of going into indie game development. We want to make a game on the netbook platform using the Intel Atom SDK. We will be making a simple game where people can upload their high-scores (they will need to register on to the server), compare their scores with friends, other people in their country/region and the world etc. So we will be using minimal bandwidth and cpu processing power. I was wondering if (possibly wrong) I could I just make a website that is dedicated to that game/games using a web host such as dreamhost, godaddy, justhost, hostcleat etc. The the application will auto log into the website to send the back back and forth. Then a SQL (if I am right) database on the server will then sort out the high-scores and send the user the high-score details about their friends etc? Is that how to go about it? If not how so? I heard about dedicated servers will this be the proper way? If so will I be able to use winsock to send the data to the dedicated server? Also will I be able to have an application on the dedicated server written in C++ to manage the high-scores, the login information, registration etc?. Any help will be appreciated! Kelvin

Share this post

Link to post
Share on other sites
For a simple high-score board, the easiest thing will be what you describe-- the game will post the score and the username to a web script (e.g. php,python,etc) which will write it to a database. The game can then pull the high scores list via a web request or people can view them online.

This is how most web flash games do it.

The problem is cheating.

As long as game logic happens on the client side, you can't prevent cheating. Usually they do it one of two ways:

1. Post their own username/high score directly to the server bypassing your game client. You can minimize this by obfuscating/encrypting the score posting string.

2. Change the score values in memory using a cheat/debugging tool. You can make this harder by obfuscating score values in memory so it's not obvious to someone looking at the values which one is score or how the internal values translate.

But if your game is even modestly popular, someone will hack the high score.

To answer your question about dedicated, for this kind of usage, you don't need a dedicated server. Even a cheap shared web host should be able to handle hundreds or thousands of high score posts per minute.

Share this post

Link to post
Share on other sites
Hi thanks for the feed back, yeah I thought a couple of for encrypting the data packets like use the time and day and month to change the order of the pack information and changing the letters to numbers and numbers to letters then symbols etc.

Do you know of any webhost that will allow me to use their web service to manage the highscore's? I am currently using dreamhost arm for my portfolio website and they said they would not permit it :(.

Share this post

Link to post
Share on other sites

there are two (probably much more) solutions to your problem.

1. You use a Webscript (cgi, perl, php ...) to receive the scores and playernames. Save them in some way in a database and let the clients get them the same way. You need some webspace with a database and some scripting functions.

2. You write your own server. For this you need at least a virtual server. They are cheap and you get a static IP adress and/or domain. You could also use it for a website.

You shouldn't use values like date or time for your encryption. Look into the documentation of your programming language. Probably there are much safer function for encryption available.

You can test both way without spending money on some hoster. Use an old PC (or virtual machine or even dev machine) and install a webserver and/or write some prototype of an own server.

Share this post

Link to post
Share on other sites
I'm kind of surprised Dreamhost doesn't allow this. My guess is that whoever got your request saw "game" and "hosting" in the same email and thought, "we don't do that."

What you need for a high score is just a web script with a database. Did they say what exactly they don't permit?

Share this post

Link to post
Share on other sites
Erm i think i scared them off because i was a little vague with my question...... how should I have worded my e-mail???

This is the e-mail I sent them

> Hi sorry was not sure what topic to put this question under.
> Me and a fiend want make a game where people can register and submit their
> high-scores. On to a website host like this. Is this possible?
> If so the game will auto log into the website and submit their high-score.
> Then I am guessing we will need to use the SQL database to manage the
> highscores? Then the website will send the high-score data back to the game
> such as regional, country, friend high-scores.
> Is this possible? If so, if you have any idea how would i get the game to
> send the data to the website? You can just summarize the answer. As i can
> just do further research if you point me in the right direction.

Share this post

Link to post
Share on other sites
The problem with shared web hosts is that, if you get any kind of volume, then the service will get overloaded and you'll have to move to something dedicated.

Storing highscores is easy. Here's some PHP that will probably do it:

mysql_connect("localhost", "someuser", "somepassword");
mysql_query("use mydatabase");
$name = mysql_real_escape_string($_GET['name']);
$score = 0 + $_GET['score'];
mysql_query("insert into scores(name, score) values('$name', $score)");
$r = mysql_query("select count(1) as place from scores where score > $score");
$q = mysql_fetch_assoc($r);
echo "You are number " . (1 + $q['place']);

Assuming a schema something like:

CREATE TABLE `scores` (
`name` VARCHAR(255),
`score` NUMERIC(12,0),
PRIMARY KEY (`name`, `time`),
KEY `scores_score` (`score`)

You probably want to have some user names and passwords and whatnot as well. You could easily put this up at a site like, and hit it using your favorite HTTP url getter library (curl, http-get, XMLHttpRequest, WinInet or whatever).

However, the big problem is that people will cheat. They will figure out how your game sends the scores, and send their own scores. There is no way that your server can know whether the score that comes in is from your game, or from a hacked program made to look like your game. Putting encryption and hashing into the game doesn't really help, because users can just disassemble the game to figure out how that works, and then do the same thing in their hack.

There is more information about this problem in the Forum FAQ.

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