Getting started on web game dev
Have you ever wanted to create your own web game but were unsure how to go about it or what languages you would need to learn to do it? Or even know what languages to use but not how to get them to work on your home machine? Well this post should give you a starting hand.
Currently on the web, most browser based/PBB games are written in PHP/MySQL. Yes there are other languages used but I will cover these first. Both PHP and MySQL are open source languages, meaning they are free and have a ton of online communities and support. Personally I am using those languages for the few games I am working on/plan on working on.
So, what is PHP? PHP put simply is a server side scripting language which returns html to the clients browser. What this means is that PHP isn’t ran on the players machine, but ran on your server. This give’s a little security because players can’t see your code, meaning they don’t know passwords, variable names, equations.
MySQL? MySQL is your datbase. It is the thing that stores your players information, such as names, experience, levels. You can even use it to record money transfer in game, mail, friends, and any other form of information you would like to view later.
Now, you have an idea hopefully what both of these languages can do for you. But how do you get server side languages to work on your home pc so you can build and test? Well the easiest way is to download and install WAMP if you are using a Windows PC. (Mac version : MAMP Linux – A guide on setting up a LAMP )
WAMP is Windows Apahce MySQL PHP. Basically it installs a server (Apache) which is needed, since it basically turns your pc into a mini server to run PHP/MySQL which have files that interpurt the scripts. After you have WAMP installed, are good to go. Browse into your wamp directory and you’ll see a folder called www. You will want to place your scripts there for testing. So lets say you write your first PHP script :
<?php
echo “Hello world”;
?>
You save it out and drop it in your WAMP www folder. You go to your browser (no need to be online) and type in http://localhost/*name of file*
To create databases is also pretty simple. Click on the wamp symbol in your system tray and click PHPmyAdmin. There you can set permissions, create databases, and insert info. I will write a starters guide for myAdmin at a later date and demonstrate the basic way to connect, insert, delete, whatever using PHP.
So after that you may think that PHP/MySQL isn’t for you but you still want to create web games. Well for web games you need a back end (database) be it SQL, MySQL, Access (*shudder*), Oracle or whatever database language/server to have access to. You also need a scripting language of some sort, the two most popular PHP and ASP.NET, though others do exist.
You can also use other languages such as JavaScript, Java and XML to handle some of your information instead of relying on just your scripting language.
I hope this has given you the knowledge you need to know, not to script, but to know where to start looking. I know personally when I first started I didn’t know what languages to use, or what options I had.
Also, for anyone that develops, please feel free to post the languages and set up you use.
Ravenhawk said,
February 13, 2007 at 7:48 am
Your blog looks interesting. At the moment I haven’t done any web design that could be called “scripting” just a bit o’ html. I have programmed in Visual Basic and am currently learning C++. Eventually I hope to learn PHP and think it’d be fun to tinker with web games, so I’ll probably be keeping an eye on here, at least via RSS. =)
bardicknowledge said,
February 14, 2007 at 3:41 am
Thank you very much for expressing interest. I have a few articles I am working now currently, a few on development tips and one on the groundworks of security for a web based game.
Please feel free to flame forums with our address here, or to spam your friends inboxes
sotheworldturns said,
February 24, 2007 at 8:43 pm
Download MAMP here:
http://www.living-e.com/products/MAMP-PRO/download.php
DeveloperNtraining said,
May 2, 2007 at 7:09 pm
Hey, I just recently learned php and have had WAMP on my laptop 4 a few months now. I’m about to start developing a web based golf game and was wondering which language wud be my best choice. Since its not really an rpg or anything I don’t see mysql being of any use here and I’ve been told js is a last resort. any suggestions?
Kamino said,
August 26, 2007 at 2:46 pm
Hello, great article and blog.i`m interested in dev a web game, but need to learn php and mysql. if you`re interested i`ve found a guy wich sels the script for a game http://www.medievalfight.com i think the price is 150$
Ven said,
February 5, 2008 at 12:03 am
Thanks for the article. I’m confused about how some of this works together. For example, I would like to make a game like Travian or OGame, time-based multiplayer online browser games, but I don’t understand how they handle the time element of the games. A user can send their ships/troops to another location, and after a set period of time the ships/troops will arrive at that location.
It seems like you have to have some game loop in the background polling for events. I imagine this would be done in whatever language you prefer, C, C++, Java, PHP, etc, but it seems like it would have to keep track of all the events, and when an event occurs, it would update the SQL database so that the clients could pull that data and see the changes have been made.
I’m worried about the efficiency of this, as well as the scalability. If you have a large game with lots of users, a giant queue of events may or may not be taking up huge amounts of processing time. Basically, I would like to know if I have the overall concepts right, or if there is a better way to handle this situation. I would really appreciate any information or tips, because I’ve been searching in my spare time for days, and I haven’t found any answers yet. Thanks again!
bardicknowledge said,
February 5, 2008 at 1:42 pm
Hello!
We have actually discussed this before.. a couple of times actually. You can find the latest discussion here:
http://webgamedev.wordpress.com/2007/12/13/the-tick/
jmucchiello said,
February 6, 2008 at 4:26 am
Actually this discussion was much more detailed (at least on my part
) And the discussion talks specifically about Travian.
http://webgamedev.wordpress.com/2007/04/03/tickstimed-eventscrons-etc/