PHP Gaming: Part 2
First of all, this tutorial assumes that you:
-Have a list of game resources
-Have a list of the usages of your resources
-Have a list of all units, buildings, etc.
-Have a list of the creation of those units, buildings, etc.
-Have a way to obtain these resources, through production, research, or anything else you can think of
-Have decided to use ticks, turns, a combination, or something else!
If you do not have all of the above, i strongly suggest that you read "PHP Gaming: Part 1". However please do not reply to that tutorial, because it is rather old. Any questions, comments etc. about either tutorial should be posted here.
Now, assuming that you have those above items, let's get to PHP Gaming: Part 2!
First of all, we're going to skip the login and registration part of this, because I'm sure you all know how many login systems, user systems, and session tutorials there are just in these forums alone!
So, providing that you already have a way to login, and set two sessions (We'll call them $_SESSION['username'] and $_SESSION['password'] for now), we'll continue into actually creating your game.
Now, the easiest, however necessary step for a game, is to create an Overview page. You don't have to call it that, however it's pretty much necessary. This page should include things such as total amounts of resources, units, buildings, and possibly production if you want to. I personally have a seperate page for production, but you can do whatever you like.
For this tutorial, we'll also assume, that you have a table "Accounts" with all the accounts stored in it. Each row in this, will have different fields such as "Money", "Networth", etc.
On this main page, we'll call these values out of the database, and how we do that, is by selecting information from the row that has the username and password that is the same as the session.
VIEW ALL PHP Tutorials