I officially decided that I will be writing the series via a series of blog posts (such as I've been doing now), and then slightly alter the formatting of the posts and put it in a single PDF with the code completed and available for download.
I will put it up on some site as well as distribute it via P2P networks.
Monday, September 8, 2008
Project Planning
Here is another tutorial.
I'm going to walk you basically step by step on writing a Browser based games (PBBG - Persistent Browser Based Games) . First thing we need to decide is what genre we're going to create.
Here are a few different genres:
RPG
Strategy
Action
Adventure (pretty much coupled with Action I'd say)
Space
Virtual Pet
These all have their successors.
RPG has the mafia game scripts. If you Google PHP Mafia game you're bound to find some of the bigger ones.
Strategy - has tribalwars (www.tribalwars.net)
Action/Adventure - Not too sure what the successor of this genre is.
Space - Can't remember the name right now
Virtual Pet - Neopets, and other big sites as well.
Well I'm going to choose [b]Space Strategy[/b] for the game.
[b]Flourish your game plots[/b]
This is an important step. In order for people to enjoy playing your game... you need to have a point to it. Don't just throw up a home page saying click here to Register. That's boring!
I won't spend as much time giving the game I will write as much meaning as some of you would... this is all for demonstration purposes on how easy it is to write games in PHP using OOP!
I will try and write my tutorials in such a way that you can use or modify the code to work with any genre.
That's it for this tutorial though! Before you carry on try coming up with some ideas for your game, write down a purpose, etc. etc.
I'm going to walk you basically step by step on writing a Browser based games (PBBG - Persistent Browser Based Games) . First thing we need to decide is what genre we're going to create.
Here are a few different genres:
RPG
Strategy
Action
Adventure (pretty much coupled with Action I'd say)
Space
Virtual Pet
These all have their successors.
RPG has the mafia game scripts. If you Google PHP Mafia game you're bound to find some of the bigger ones.
Strategy - has tribalwars (www.tribalwars.net)
Action/Adventure - Not too sure what the successor of this genre is.
Space - Can't remember the name right now
Virtual Pet - Neopets, and other big sites as well.
Well I'm going to choose [b]Space Strategy[/b] for the game.
[b]Flourish your game plots[/b]
This is an important step. In order for people to enjoy playing your game... you need to have a point to it. Don't just throw up a home page saying click here to Register. That's boring!
I won't spend as much time giving the game I will write as much meaning as some of you would... this is all for demonstration purposes on how easy it is to write games in PHP using OOP!
I will try and write my tutorials in such a way that you can use or modify the code to work with any genre.
That's it for this tutorial though! Before you carry on try coming up with some ideas for your game, write down a purpose, etc. etc.
Saturday, September 6, 2008
PHP 101
This is one of the greatest OS (Open Source) tools widely available on the internet today. The simplicity of making websites with PHP is truly astounding if you think about it.
With the ever evolving PHP language, it becomes even better when a new version is released. Recently PHP 5.3.0 I think it was, was released. For those who want to explore can go here:
http://www.rooftopsolutions.nl/article/199
The main problem with PHP is that it's a very loose language in terms of coding practices. You can have the sloppiest code and it will still produce a web page. This is very bad if you didn't come from a Java or similar language background.
PHP has many similarities to C, and it also has some similiarties to Java.
For example, in order to do a function you go:
function Myfunction()
{
}
You also have something called reserved names. These "reserved names" are things used in PHP, or any other language that restrict you from using them as variables or function names.
So if I wanted to name my function 'function', you simple couldn't do that because PHP would generate an error.
I'm going to slowly integrate you in to OOP, and I will do very little with you in Procedural programming because I find it very in efficient for doing things in PHP 5.x+.
Before I continue, I will define for you Procedural programming and OOP.
OOP: OOP stands for Object Oriented Programming. It uses things like classes, and the classes themselves have functions grouped in to them.
Procedural Programming: This is a very simple way of writing your websites. You would write some code as your thinking it.
The Procedural way of making a website is ok in my books if you're doing one web page, and you don't need it for anything else. If you're making a more complicated website you will need to consider writing your web page with OOP.
This is what Procedural Programming looks like:
var $something;
var $something_else;
if ($something == $something_else)
{
echo "This is true";
} else {
echo "This is false";
}
?>
As you can see, we have that if statement there. Translating it in to human terms, it would be like "If something is equal to something else, then this is true. If it's not, this is false."
I am telling you that using the procedural code for one page is fine because you don't really need to reuse any code. When you are doing a big complicated system with registration, login pages, managing user accounts, etc. it wouldn't be obsured to think that you'd be writing hundreds of those if statements.
In OOP you wouldn't write many because you just reuse the code over and over again.
Enjoy this tutorial, it's not really going much in to how to do things yet... but you should hopefully be starting to get an idea of what PHP is.
With the ever evolving PHP language, it becomes even better when a new version is released. Recently PHP 5.3.0 I think it was, was released. For those who want to explore can go here:
http://www.rooftopsolutions.nl/article/199
The main problem with PHP is that it's a very loose language in terms of coding practices. You can have the sloppiest code and it will still produce a web page. This is very bad if you didn't come from a Java or similar language background.
PHP has many similarities to C, and it also has some similiarties to Java.
For example, in order to do a function you go:
function Myfunction()
{
}
You also have something called reserved names. These "reserved names" are things used in PHP, or any other language that restrict you from using them as variables or function names.
So if I wanted to name my function 'function', you simple couldn't do that because PHP would generate an error.
I'm going to slowly integrate you in to OOP, and I will do very little with you in Procedural programming because I find it very in efficient for doing things in PHP 5.x+.
Before I continue, I will define for you Procedural programming and OOP.
OOP: OOP stands for Object Oriented Programming. It uses things like classes, and the classes themselves have functions grouped in to them.
Procedural Programming: This is a very simple way of writing your websites. You would write some code as your thinking it.
The Procedural way of making a website is ok in my books if you're doing one web page, and you don't need it for anything else. If you're making a more complicated website you will need to consider writing your web page with OOP.
This is what Procedural Programming looks like:
var $something;
var $something_else;
if ($something == $something_else)
{
echo "This is true";
} else {
echo "This is false";
}
?>
As you can see, we have that if statement there. Translating it in to human terms, it would be like "If something is equal to something else, then this is true. If it's not, this is false."
I am telling you that using the procedural code for one page is fine because you don't really need to reuse any code. When you are doing a big complicated system with registration, login pages, managing user accounts, etc. it wouldn't be obsured to think that you'd be writing hundreds of those if statements.
In OOP you wouldn't write many because you just reuse the code over and over again.
Enjoy this tutorial, it's not really going much in to how to do things yet... but you should hopefully be starting to get an idea of what PHP is.
Labels:
education,
free tutorial free,
Introduction,
PHP 101,
PHP introduction
Tools
OK,
before we continue on much further lets discuss tools needed to do websites.
MANY people think that good websites are made with good expensive programs. They are WRONG. The best websites can be made with all free software with a few exceptions of skills, etc.
When I code a website, I always either use: Notepad/Wordpad (It comes with your standard Windows OS), or conText (http://www.contexteditor.org/index.html). Both of those options are free.
When you make layouts, you can do it with free programs, there are people who are really really good with making layouts in free programs. Again it falls down to your skill level.
I have the legit copy of Adobe CS2 (soon to get CS3), so I have no problems there.
Remember even though you have expensive software, you still need to know how to use it!
Hosting. This is another area that will vary for whatever type of website you are making. If you are making a very personal or not so personal but small website... you can get away with a minimal free web hosting account. There are web hosts out there that host you without ads, but most of those web hosts would either be friends that you know with a server... or Post 2 host hosting.
Post to host hosting is where you need to post 10-20 times in their forum each month in order to keep the hosting package.
Like I said, I can't really give one webhost that would suit every persons needs. I'm going to be going over PBB game creation tutorials where you can make your own game where people can register. PBB means Persistent Browser Based. http://www.tribalwars.net is a great example of a really popular PBB game.
So this is the summary:
Free coding programs:
- Notepad/Wordpad or any text editor if you're on MacOSX/Linux/Windows
- ConText (http://www.contexteditor.org/index.html)
Art programs:
- Gimp (It's an art program free to download)
- Photoshop (costs money)
Hosting:
- http://freewebspace.net (Free hosting)
- http://freewebspace.net/forums (Free/paid hosting forum)
- http://webhostingtalk.com (Mostly paid hosting forum)
- http://superbhosting.net (I use them, if you wish to put me as a referral and you pay for a year I can get you some money off the bill the following month via paypal)
Next tutorial I will start introducing xHTML/PHP
before we continue on much further lets discuss tools needed to do websites.
MANY people think that good websites are made with good expensive programs. They are WRONG. The best websites can be made with all free software with a few exceptions of skills, etc.
When I code a website, I always either use: Notepad/Wordpad (It comes with your standard Windows OS), or conText (http://www.contexteditor.org/index.html). Both of those options are free.
When you make layouts, you can do it with free programs, there are people who are really really good with making layouts in free programs. Again it falls down to your skill level.
I have the legit copy of Adobe CS2 (soon to get CS3), so I have no problems there.
Remember even though you have expensive software, you still need to know how to use it!
Hosting. This is another area that will vary for whatever type of website you are making. If you are making a very personal or not so personal but small website... you can get away with a minimal free web hosting account. There are web hosts out there that host you without ads, but most of those web hosts would either be friends that you know with a server... or Post 2 host hosting.
Post to host hosting is where you need to post 10-20 times in their forum each month in order to keep the hosting package.
Like I said, I can't really give one webhost that would suit every persons needs. I'm going to be going over PBB game creation tutorials where you can make your own game where people can register. PBB means Persistent Browser Based. http://www.tribalwars.net is a great example of a really popular PBB game.
So this is the summary:
Free coding programs:
- Notepad/Wordpad or any text editor if you're on MacOSX/Linux/Windows
- ConText (http://www.contexteditor.org/index.html)
Art programs:
- Gimp (It's an art program free to download)
- Photoshop (costs money)
Hosting:
- http://freewebspace.net (Free hosting)
- http://freewebspace.net/forums (Free/paid hosting forum)
- http://webhostingtalk.com (Mostly paid hosting forum)
- http://superbhosting.net (I use them, if you wish to put me as a referral and you pay for a year I can get you some money off the bill the following month via paypal)
Next tutorial I will start introducing xHTML/PHP
Welcome
I have a couple blogs. This one, and a different one I'm semi-active in.
My other blog I own isn't really suited for lots of programming stuff, so instead of infest it with programming tutorials... I'm going to keep it more dedicated to general stuff.
This blog, on the other hand will be dedicated to programming/scripting.
Take everything I say in programming as opinion. I am not the inventor of programming languages, nor will I ever be. I am not the best on the internet, though I am pretty good at it.
I started in Grade 10 or 11 in Social Studies. I was kind of bored, and saw someone else making a website. I was intrigued that he was able to remember all these different symbols, and how to place them to make some things appear on the screen in certain ways.
I started to take a look at code on websites, and just little tutorials here and there. I took some of the lines out of the code, and put random stuff in just to see what would happen. That, my friends is how I started to learn HTML 4.
It seems that this era of kids/programmers mostly learn how to do things by trial and error. Riding bikes, you sit on a bike and try going forward. Sure you might fall a couple times, but eventually you will learn how to ride without falling over.
That is what I did with Websites, I got on the bike and kept trying to pedal until I did it without falling. What I hope to accomplish with this blog is to help people learn how to make websites without falling over.
Keep checking back here, as I will try and post as often as I can.
My other blog I own isn't really suited for lots of programming stuff, so instead of infest it with programming tutorials... I'm going to keep it more dedicated to general stuff.
This blog, on the other hand will be dedicated to programming/scripting.
Take everything I say in programming as opinion. I am not the inventor of programming languages, nor will I ever be. I am not the best on the internet, though I am pretty good at it.
I started in Grade 10 or 11 in Social Studies. I was kind of bored, and saw someone else making a website. I was intrigued that he was able to remember all these different symbols, and how to place them to make some things appear on the screen in certain ways.
I started to take a look at code on websites, and just little tutorials here and there. I took some of the lines out of the code, and put random stuff in just to see what would happen. That, my friends is how I started to learn HTML 4.
It seems that this era of kids/programmers mostly learn how to do things by trial and error. Riding bikes, you sit on a bike and try going forward. Sure you might fall a couple times, but eventually you will learn how to ride without falling over.
That is what I did with Websites, I got on the bike and kept trying to pedal until I did it without falling. What I hope to accomplish with this blog is to help people learn how to make websites without falling over.
Keep checking back here, as I will try and post as often as I can.
Subscribe to:
Comments (Atom)