UK Webmaster Talk - Online Marketing - SEO


 

PHP Gaming - Part 1

This is a discussion on PHP Gaming - Part 1 within the Php and MySQL forums, part of the Programming / Scripting / Coding category; I've decided to start off an entire "series" of php gaming tutorials. So expect there to be much more to ...


Go Back   UK Webmaster Talk - Online Marketing - SEO > Website Design & Development > Programming / Scripting / Coding > Php and MySQL

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Notices

Reply

 

LinkBack Thread Tools Display Modes
Old 12-04-2005, 21:02   #1 (permalink)
WMT Addict
 
Join Date: Apr 2005
Posts: 120
iTrader: 0 / 0%
Shwaza will become famous soon enough
Default PHP Gaming - Part 1

I've decided to start off an entire "series" of php gaming tutorials. So expect there to be much more to come after this. I find running my game really fun, and i know my members enjoy playing it


For this part, we aren't going to even begin talking about the PHP of the game. The very first thing that you need to do if you are making a game, is structure it. A game that is very well coded, can be a lousy peice of ... if you don't have a good structure for it. I'm now going to take you through a few steps to get you started with your structure.

PART 1: Resources

First and formost, we need to get a list of resources, for your game. These could include anything such as Money, Food, Metal, etc. You need to have something to spend in your game. (also, i'll be talking about turns, and/or ticks later on).

Please make sure that you have gotten a full list of resources for your game, before we continue.

PART 1b: Resource usage

For this part, we're going to assume that our game has 4 resources: money, food, wood, and metal.

What you need to do, is figure out what your resources will do. It's all well and good if you have a bunch of resources, but it's completely useless if they don't do anything!

We're now going to make a list of what resources will be used for. Just as an example, here's what your list might look like:

Money: Building, researching, purchasing
Food: Keeping units alive, building
Wood: Building
Metal: Building, purchasing

Now, do something similar to that, but with your list of resources, and wait until you are done that, to continue on with this tutorial.

Part 2: Units/Buildings

Most games that you will play, have units, and or structures, such as troops, and barracks.

What we're going to do now, is make a list of all the different units and buildings we will be using.

For an example, here's a list of what you might have:

Light Troops
Heavy Troops
Houses
Barracks

It's a rather short list, and hopefully you'll have more in your list , but it's just to give you an idea.

Part 2b: Troops/Buildings creation

Since you've got that nice list of units or buildings, and that nice list of resources, we're going to combine the two, to give a purpose to the resources, and a way to obtain the units.

As before, we're going to make a list, and set it up like this:

Light Troops: 20 money + available housing
Heavy Troops: 50 money + available housing
Houses: 50 metal + 25 wood + 50 money
Barracks: 100 metal + 50 wood + 100 money

Now, you'll see that for the 2 types of troops, i also included "Available housing". If you are trying to make a realistic game, you will most likely want to give your units a place to live! So you should decide on a good amount that each house, or barrack can hold, then, in your script, you would add an if/else statement, to check if there is available space for your units.

So after you've made that list, continue on to part 3.

Part 3: Researching

Usually, games will have something like researching, production, or something like that. What you would have, is research, that will increase your production of units, and resources, so that every time you use a turn, or a tick occurs, you will recieve x amount of resources, and units.

For an example, i'm going to say that each research costs 100 money (you might want to give each kind of research it's own value, or possibly a dynamic value, like $price="$units / 100"; or something like that), per purchased.

So if you think you've got a good idea on how you're going to set this up, continue on to part 4!

Part 4: Turns? Or Ticks?

Well most likely 99% of all online strategy games rely on turns or ticks to run. What you have to decide, is which one will you use? Or both? I personally use both, because i thought it would be an interesting twist, however i declare the copywright on that! Haha, just kidding.

After you have made your descision, you have to decide what you want to do with them. This is mostly if you decide to use turns, because you have to decide if you will have players spend them to buy/create things, or if you want them to be something you do manually, and when you cash one in, it adds your resources via your production rate, to your total. I find that turns are most commonly used as a resource, and are spent, but the choice is yours! It's your game!


This is the end of the first tutorial on php gaming. By now, you should have a pretty good idea of what the structure of your game will be like, and you should be able to start coding it. That will be comming in the next tutorial, so stay tuned! :P

Thanks for your time, and please post your comments or questions here!

Also, if this has been helpful or interesting to you, i'd appreciate a little bit of reputation or WMT!

Have fun! Also, if you'd like to take a look at my game, i'm more than happy to get new players! http://kingdomsofbattle.com
__________________
Kingdoms Of Battle << Check out my free to play online strategy game!

SomeCoders - Coding blog, coding tips
Shwaza is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 13-04-2005, 00:38   #2 (permalink)
WMT Addict
 
Join Date: Apr 2005
Posts: 156
iTrader: 0 / 0%
clement is on a distinguished road
Default

Reputation added bro.
Nice tut, i'm waiting for the full part now..haha
clement is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 13-04-2005, 01:14   #3 (permalink)
Tim
Cool Newbie
 
Join Date: Apr 2005
Posts: 32
iTrader: 0 / 0%
Tim is just really nice
Default

Nice. Even though it's not really on the programming aspect of creating a game, it gives you a good idea about the actual game part Great work.
Tim is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 13-04-2005, 02:05   #4 (permalink)
WMT Addict
 
Join Date: Apr 2005
Posts: 120
iTrader: 0 / 0%
Shwaza will become famous soon enough
Default

Quote:
Originally Posted by Tim
Nice. Even though it's not really on the programming aspect of creating a game, it gives you a good idea about the actual game part Great work.
Oh it's commin :P I'm gonna write the second part soon, probably this week.
__________________
Kingdoms Of Battle << Check out my free to play online strategy game!

SomeCoders - Coding blog, coding tips
Shwaza is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 17-04-2005, 09:15   #5 (permalink)
Newbie
 
Join Date: Apr 2005
Posts: 2
iTrader: 0 / 0%
Zegg90 is on a distinguished road
Default

nice tut, can't wait till the next part
Zegg90 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
gaming, part, php

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Who wants a free gaming portal? robertall Ads, Offers & Services 0 19-10-2005 21:05
advertise on a gaming site randomman Ads, Offers & Services 3 23-07-2005 15:04
Flash Gaming site KF1 Website Design Forum 17 02-07-2005 08:19


All times are GMT +1. The time now is 16:46.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
UK Webmaster Forum © WebmasterTalk.co.uk | Design by Forbairt

Ad Management by RedTyger

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41