Search Helium

Home > Hobbies & Games > Video Games > Video Game Trends & Genres

How PHP games work

by Andy Hu

Created on: April 05, 2007   Last Updated: April 19, 2007

I've seen a lot of people register on the forums here to learn how to make a game. They want to learn PHP quickly, or get the scripts and learn how they work. Unfortunately, it's not so simple. :( Learning to code is only part of the way. To really create a game by yourself, from scratch, or close to it, you need to understand how most games function. And I am writing this article to teach you how some classic games work :)



RPG Games
There used to be many browser-based RPG games when Exofusion was still being actively developed. Everybody could just download the script, put it on their site, and voila! They suddenly became game owners. A lot of those games died out because the owners didn't understand the game script very well, and they could further add new stuff to their games.

The old PHP games functioned like this:
You would click a link, or submit a form by clicking a button, and you would be referred to another page. On that page, the backend of the script processes your input, and updates the database tables, then displays a text like "You gained 2 Strength!". This was pretty much how everything went. Some pages were more complex with more actions, but essentially, it's just like this.
It's the same with the battles. There was not much user interaction. You simply clicked a button or link, and you saw the results:
Quote
You hit Monster1 for 4 damage! (5 left)
Monster1 hit you for 2 damage! (6 left)
You hit Monster1 for 3 damage! (2 left)
Monster1 hit you for 3 damage! (3 left)
You hit Monster1 for 5 damage! (-3 left)

You killed Monster!
You gained 3 EXP and 5 Gold!

That was pretty much how it looked like. These games are fairly simple to code, the only relatively complex parts would be the battles. If you are just starting out, you should try coding one of these. Of course, you will need to implement something that would limit the number of battles a user can perform. A limiting factor such as 'energy', or number of battles per day/hour.



Strategy Games
Now, these games are much harder to code, and also much harder to learn and play. These types of games come in many different forms, but they usually have similar cores:
Ticks and/or Turns

Ticks are events that run every so often, maybe every 10 minutes or every 30 minutes. Between each tick, you may perform whatever action you want, but not much of it is processed until the tick occurs. If you attack somebody, the results only come in on the tick. If you buy soldiers or other stuff, that will only have an effect once the

Below are the top articles rated and ranked by Helium members on:

How PHP games work

Helium Debate

Cast your vote!

Are video games good or bad for teens?

Click for your side.

90551

Featured Partner

The Project on Government Oversight (POGO)

The Project On Government Oversight (POGO) is an independent nonprofit that investigates and exposes corruption and other misconduct in order to achieve a more accountable federal government. For over 25 years, POGO has advocated for ...more


CONNECT WITH US

Read
our blog
Helum for writers

Write and get published
Share with other writers
Polish your freelancing skills

Join our active writing community
Helium Content Source for Publishers

Quality articles from proven freelancers
Exclusive rights, fast turnaround
Brand engagement, business blogging -- our writers do it all

Get custom content today!

INFORMATION


Helium, Inc.
200 Brickstone Square Andover, MA 01810 USA
#