Making an online RPG game with PHP.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Dannerz
Forum Newbie
Posts: 10
Joined: Tue Dec 21, 2010 10:14 am

Making an online RPG game with PHP.

Post by Dannerz »

Hi I'm new to the forum and to PHP. I am reading about it at a how to website.

I'd like to know if it is possible to make a game using PHP.

These are the things I'd require:
*A way for people to make accounts.
*Saving variables online and changing them as the game is played. Each player account would have its own lists of variables.
*An online time system to change variables of accounts/players every minute or hour or day, even when the players are not logged into the site/game.

I've seen a few games online that are .php websites.
I've made games in GameMaker, if any of you have heard of it. I have a fair understanding of .gml
I'd like to take my understanding of programming to the next level, and make a multiplayer online game.
I don't want anything too fancy. I just want to make a simple game.

Any advice would be appreciated.

If I have posted in the wrong catagory then mods please move the thread. It's my first time. :3
cpetercarter
Forum Contributor
Posts: 474
Joined: Sat Jul 25, 2009 2:00 am

Re: Making an online RPG game with PHP.

Post by cpetercarter »

Yes, of course you can write a game such as you describe using php. Remember, however, that php scripts terminate and lose all the information they contain, when they have completed their work - they don't sit around waiting for a player to make his/her next move, for example. So you need to store information such a details of your players in a database. Learning how to use php to store and retrieve database information might be a good place to start. (PHP has modules for a wide variety of databases, but most people start with MySQL). After that, you might look at the way that php can pass information to the next iteration of the script, using GET and POST; and store information in SESSION variables and cookies.

You say that you want to update information automatically every hour/minute. If you design your database writing routines carefully, you may find that this is unnecessary. Otherwise, you will need to be able to place 'cron jobs' on your server, and your webhost may not permit this; or you can write a 'pseudo-cron job' which your php script calls every time it is run.

I hope this is helpful as a place to start. Please feel free to post again with any specific issues you need help with.
Dannerz
Forum Newbie
Posts: 10
Joined: Tue Dec 21, 2010 10:14 am

Re: Making an online RPG game with PHP.

Post by Dannerz »

In game maker, you can assign variables to arrays and "objects". these variables can be strings and values [numbers].
Also the format of the game maker scripting language has things such as built in functions and { } making codes between brackets.
But all of the PHP functions are new to me. I'm like an absolute newb who is interested. Thanks for your reply.
I hope to make friends with someone whom is good at PHP, then just ask them questions on yahoo or msn, as that may be
the fastest and most convenient. Thank you for answering my questions.
Dannerz
Forum Newbie
Posts: 10
Joined: Tue Dec 21, 2010 10:14 am

Re: Making an online RPG game with PHP.

Post by Dannerz »

I have just downloaded Alleycode HTML Editor.
It is what I was looking for, a program to write test and save scripts, html and php documents.

Now I need to run .php documents on my computer in a way that will work.
How do I do that? What else do i need to download?
cwheel3915
Forum Commoner
Posts: 28
Joined: Wed Apr 28, 2010 8:02 pm

Re: Making an online RPG game with PHP.

Post by cwheel3915 »

Im taking the assumption that you are using windows.

www.apachefriends.org/en/xampp-windows.html

Thats what you need to run php files, its like a webserver on your pc.
Peter Kelly
Forum Contributor
Posts: 143
Joined: Fri Jan 14, 2011 5:33 pm
Location: England
Contact:

Re: Making an online RPG game with PHP.

Post by Peter Kelly »

I used to have a script which you could have looked at for examples, really these RPG games are just maths and probabilities. But require a lot of work, I would recommend getting some proper web hosting but as cwheel3915 has suggested one of the best programs that compiles apache, php, mysql and phpmyadmin easily all in one program is xampp.
Dannerz
Forum Newbie
Posts: 10
Joined: Tue Dec 21, 2010 10:14 am

Re: Making an online RPG game with PHP.

Post by Dannerz »

I have XAMPP now.
I can run and test .php files.

Now i need to figure out how to make player accounts,
store and modify information of each player,
randomly select players then have them fight eachother.
Post Reply