Intro How to make a Web Game

Category : How to make web game     Tags : mmog   pbbg   tutorial    

I believe you are just another one out of thousands web game fans out there who are eventually wanted to make your own web game. Making you own web game and running it online is indeed fun and is more challenging than playing some web games itself.
But before I would even touch the topic 'How to make a web game', I just wanted to know how much you would willing to sacrifice onto such project? Not in terms of money but I mean in terms of time and effort. 1 month, 3 months, 6 months or 1 years?
Making a web game is a big project, eventhough if it was only a simple web game with a few basic functions. It would takes months of time just for the preparation and another few months to do the programming, debugging, testing and balancing before it could be put into real test. Unless you are really good in web programming or have a team of professionals for the project, you ain't going to have a web game within a couple of months time.

So, you got to have abundance of time(several months or even years), really hardworking and are very passionate about making your own web game. Otherwise, just get on with your life playing web games instead.

Still Eager to make a web game?
OK, assuming you know nothing about making web site and programming. You just have no clues what to do and where to start building your web game project and yeah, you've got the time!
This is what you should do;
Forget about php programming and learn HTML and CSS to make a static web page. You shouldn't run when you can't even walk. Start from the basic!

Learning HTML and CSS
You don't need any special program or software to do this, just use the notepad (for windows pc) available on your computer and start hand coding a webpage using HTML tags and some CSS. You may find it troublesome to hand code a webpage at first but when you go further down to PHP programming, it would even takes more hand coding job. Your objective now is to make a web page template of the web game you wanted to do, just imagine how you want the main page of your web game to look like.
There is a whole list of websites out there where you could get tutorial about HTML and CSS for free. w3school is a good website with extensive tutorials for all web programming language.

Also, you would like to participate on some webmastering community discussion to learn more and ask question when you run into any problem.
HTMLForums is a good webmastering community forums to discuss about everything you need to become a webmaster.

Document your web game project.
I'm sure you already have some idea of what kind of web game you wanted to make. So, get the pen and paper and start document your project. Jot down all the information and details about the game. Draw some images or interface of every function of the game.

A good detalied game document would ensure you to have a smooth work during the game programming phase. If you think you could just rely on those idea in your brain and get on with the programming without document then that would be something really really bad. That is what exactly I did when I firstly developing my own web game. The idea in my brain seems perfectly nice that I jump into programming instantly. Everything seems to be functioning accordingly but eventually those ideas in my brain got depleted, and my game is still not completed!
I tried to think and think and think for new ideas but it end up with a lots of modification and re-programming work and somehow, I dropped the the game.
So, don't start progamming a game until you have prepared enough detailed information about the game.

Get started with PHP
As you started to learn PHP programming, you need to install a server environment on your computer in order to execute the PHP files. There are many easy installer program out there which could do the job with only a few simple steps.
XAMPP
EasyPHP
WAMP

Once you have installed the web server program on your computer, you can start executing php scripts from your computer as well as managing your MySQL database to develop your project.

MySQL
While PHP acts as your dynamic script in executing functions and producing output to the end user, MySQL is a database program. You need to have a database to keep all kind of information in your game such as accounts information, characters, weapons and so on. All server program comes with phpmyadmin which is used to manage your database.

As you learn up more and more PHP functions, you could start to do a few simple php function such as creating a login system with the integration of MySQL database, an account signup system and so on before you could get into your game system programming.



Comments
kiki
13 Jul 2010
Yes lerning mysql and php 2 years and where is god damn tutorial.
Josh
31 Jul 2010
MySQL?!?!?!?!? That is by far the stupidest choice i have ever heard. No one in their right mind would do that, if you wanted to actually make it secure and easy for beginners. Start with .csv files. They are simple, fast and secure. You can just use this code for it:

<?php
$csv = "THIS IS WHERE THE LOCATION GOES";
$handle = fopen($csv, r); // This reads the csv file to write to the file. Look up php fopen on goodle to get more ways to open a file
$while (($data = fgetcsv($handle, 1000, ",")) == TRUE) {
/*
So how this part works is that it starts by reading the first line and each field is seperated by a comma so if you wanted to get the username's password for logging in. You would use a script similar to this (Feel free to tinker with it until you find your right match)
*/
if ($username == $data[00]) {
if ($password == $data[01]) {
$logged in = true;
}
}
}
fclose($handle); // And then we close the connection to the server
Restless
28 Aug 2010
I disagree with Josh. Though it's useful to know about files and how to work with them in php, MySQL is free and easy enough to work with and eventually will be needed to power any serious site. Files can only do so much and can, in the end, create a lot more problems and slow downs than a mysql database.

When I first started learning php I went with files, but it was much more annoying than simply working with a database, so I am speaking from personal experience when I say I agree with the choice to use a MySQL database with beginners rather than files (comma separated or other). Sure they may have to learn more security measures, but security should be a constant learning experience right from the start anyway. Better to start well than to try to fix bad habits and poor coding later.
lala
16 Oct 2010
i don't really care , but when you make an article " How to make a Web Game " i exepcted you to learn me to do one , not to tell me only stupid stupid things like i need to know html bla bla ... go and shout yourself, thank you .
mister
24 Oct 2010
learn u too? lmao...give up
Andreas Sørensen
21 Nov 2010
I am making a webgame at the moment with some friends, and I am seeking answers to some simple questions:

We are building in php, and most elements are getting into place, so soon it will actually be playable! BUT I have one small snag, I can't decide on how to record time passing in the game.

e.g. This game is sort of settlers in space. You start off on one planet, then you get to explore other planets in your system, then later move on to other systems, eventually you will bump into other players and then there might be friendship or conflict.
Anyway,
When you build buildings and units, then we wanted a 'tick' counter to count time passing, and doing this in php, I thought could be done in several ways, my QUESTION is just, which way is better?

i) either I do it the hard way, use time stamps for everything. Every time someone loads a page then every process (building something) gets updated. A script goes through everyones build processes and ticks them along (50% done -> 75% done because X number of hours has gone by since last time someone loaded a page).
This method just still seems difficult and not very efficient.
II) a tick script that loads independently - This is a very old approach I use to use a long time ago. I got a computer server which loads the tick page and it it set to refresh every X time, when it does everything moves along a bit. of cause the game grinds to a halt if the computer goes down!
III) there should be a way to make some code run on the server, but then you would need more control/access to the server, and right now I have external hosting, and they don't allow tinkering with their servers - understandably, also since they probably host lot's of people on one machine!

Anyway, help would be appriciated :-)
JerichoHM
15 Mar 2011
Josh you obviously don't know anything about MySQL if you think its insecure! CSV files? Really? At least go XML! CSV are hardly practical. XML at least is commonly used as a data store, but for a larger situation like the potential scale of a Game a true database is the most optimal and SECURE solution.

In all truth however security lands in the developers hands when they are creating the program and setting up... well everything! If you leave your MySQL DB as root with pwd root then you are the reason its insecure. If you have your scripts access ANY data through root instead of custom logins for read and write behavior then again... its your own fault!

CSV is great for you outlook data backup, but it is a PLAIN TEXT FILE! if anyone with any sense broke into your "Secure" server and got that file they have everything... oh and yeah CSV is easily parsed by humans because its commas! Even if someone managed to get to your server the DB is protected by passwords and encryption! I also want to point out that with MySQL DB in PHP you connect and disconnect from the DB as well as open and close (not exactly correct terms) the tables so... two layers of security just there.

I also want to agree with other posters about the lack of any actual valuable information on this site. If someone is searching for "How to make a php game" then assume they know what they want. Start with "if you don't know php then go here and learn to code" then move into VALUABLE info. You have shared absolutely nothing here that Google won't tell the most novice people.
Powerslave
18 Jun 2011
@Josh: How the f*** come a CSV being more secure than a database? Don't give tips when you yourself don't even have a clue.

@Andreas: Make a research on Cron
Powerslave
18 Jun 2011
@Josh: Please, for God's sake, go and damn learn, because you're ignorance is really dangerous at its current state. Otherwise I really hope you never make anything that gets used by others... This habit is one of the main causes of script kiddies being able to compromise websites "security" just after watching some crappy youtube howto...
Powerslave
18 Jun 2011
*you're -> your
Powerslave
18 Jun 2011
dear webmaster/developer, you seem to htmlspecialchar() user input more times than needed :)


Post Your Comment Here

Your Name
Email Address
Homepage
Custom Search


Make Web Game Tutorial
Part 1: How to make a web game
Part 2: Learn HTML to make your webite
Part 3: How to use CSS to format your website

Ads