Build your own RPG Game

Documentation Home > Getting Started - Installing the Demo Game

Getting Started, Read me first!
Getting Web hosting
Setting up WSFTP
Setting up Textpad
Configuring Game Setup file
File Permissions (chmod)
Test it out
Possible Problems

Getting Started, Read me first!

I recommend you do these few things before you create a web hosting account.

If you can do these items, then go right ahead and start setting up stuff to develop!

In order to build for this game all you need to know is how to type on a keyboard, use Textpad to edit and create text files, use WSFTP to upload and download text files and images to a web server - and eventually some PHP to enhance the game.

Good Luck! I wish you well - send me an email when you've got your game world built and maybe I can offer some suggestions!
- Rob (Eliia)


Getting Web hosting

I signed up a free web hosting account with http://www.hostsnake.com. The say they have no banner ads and support PHP, so I gave them a try. The sign up process was easy enough.

I gave some basic info and get a confirmation email. All the login info comes in the email.

FTP Server : eliia.hostsnake.com
FTP Login : your username
FTP Password: your password

So far, so good. Now I have a web hosting account that supports PHP. Make sure you try uploading demorpg3.jar and see if the server can accept it. Now I can move onto the next step, start up WSFTP and enter the information.

Lots of FREE PHP hosting options - http://www.0php.com/free_PHP_hosting.php


Top


Setting up WSFTP

Download WSFTP LE (545 kb)

WSFTP is a program that allows you to upload and download files from a web server. To set up WSFTP, unzip the zip file to get at the wsftple.exe file. Double click the file to run it. When you install it select Student and work from home - this will let you use the program for free (I think). Once you've installed the program double click the icon on your desktop to run it.

Here's a couple tweaking tips for WSTFP.

Here's a couple tips about uploading files. When using FTP there are two transfer types, Binary and ASCII (ass-key).

Binary is used for images, PDF, Word docs etc - basically anything not a text file.
ASCII is used for text files, and Perl files if you ever do Perl. Transferring a text file in Binary can make all the newline character disappear and then your code will be all on one line!
Auto is a safe way that if you aren't sure what type to upload as. Check this box if you're not sure.

WSFTP has a cool setting that allows you to specify a list of file extensions (.txt,.php etc) to always be uploading in ASCII. To set this list, click the Options button, Extensions tab, and enter your extensions in the list and click the Add button.

So, take the FTP connection info you just got and let's fire up WSFTP and create a FTP connection to your web account.

Remember your FTP username and password are case sensitive, so if your username is Eliia - typing 'ellia' won't work.

Here's a screenshot of where I put the details

Be sure to check the password checkbox.

Here's what WSFTP looks like once you've connected to the web server. The screen is split into two sections. The left section is your computer's files, and the right section is what's on the web server. There's two square arrow buttons in the middle to allow you to transfer files both directions. See at the bottom, ASCII, Binary and Auto - check Auto.

First thing to check out - make sure you can upload the demorpg3.jar file - if not, move on and try another free PHP web hosting company. I had to try a few. The company I'm using in this tutorial let me upload the jar file (at the time this tutorial was written).

Next you want to make your game folder, mine is called simplerpg. Then transfer all the game files into this folder you just made.

Click on each folder and transfer it across. Shoutbox (the chat system) is pretty bloated (has lots of icons and stuff). I've had problems sending it across and it's taken me a few tries - sometimes I have to upload each folder at a time inside the smilies folder... Just make sure all the orange ones upload - that's the default theme in the Shoutbox configuration file.

Once you've moved all your files over, we need to do a few more things before we're ready to test out the Demo game. Great work if you've gotten this far without a problem!
Top


Setting up Textpad

Textpad is my most favorite text editor program. It's so good I recommend that you buy it if you have the chance. You can buy it from their web site www.textpad.com.

Download Textpad and install it. You can use it for free, but it has this lil pop up reminder every once in a while. I check the show tips checkbox OFF! Then I click Configure in the menu, select Preferences and under View I check off Line Numbers. This will help when I explain stuff later about data files for the game. While you have Preferences open, click on Document Classes and make sure PHP is showing. This means PHP code will have syntax highlighting when you view it in Textpad.

You should be able to right click on setup.php and open it with Textpad. When I right click setup.php I select Open With, Choose Program, Textpad, Always use the selected program..., and click OK. So from now on you can double click PHP files and they will open in Textpad. I know, I'm genius :)

If you've gotten this far without problems, keep on going to the next step.
Top


Configuring Setup file

So you have setup.php open in Textpad, now we need to edit some settings to make the demo work for you. I'll describe all the settings here, but ones in red are the bare essentials to get the game demo to run on your web server.

There are two types of settings in the setup file - settings you should edit, and ones you shouldn't. You'll want to replace most of the setup file values. The ones in red need to be replaced.

SettingDescription
SCRIPT_FILENAMEThis is a value that you need to get by going to your info.php file in your web browser. Example: my info file lives at http://simplerpg.freehostia.com/simplerpg/info.php. When you can see your info.php file in your web browser, it's going to have a whole lot of settings - look for one called SCRIPT_FILENAME. You'll see a line like /home/www/simplerpg.freehostia.com/simplerpg/info.php, remove the simplerpg/info.php from this line. Replace the value in the setup file.
URLThis is your web address. For example, mine is: http://simplerpg.freehostia.com/simplerpg
gameFolderNameThis is the folder your game lives in. My example lives in /simplerpg as a folder. You can rename the simplerpg folder to be whatever you like, just change the name in the value too.
siteURLThis is a combination of your URL and your gameFolderName values.
startingMapThis is the number at the beginning of your starting map file. If you look in v2/maps folder you'll see my starting map is called 1_lower.txt and 1_upper.txt - this is where the 1 comes from. If you make a new map and name it differently, change this number to your number.
startingXCoordThis is one of two coordinates (X,Y) needed by the Java applet to know where to place your player when they start.
startingYCoordThis is the 2nd coordinate for your player's starting position
startingHealthThis is the amount of health the player will start with.
startingFatigueThis is the amount of fatigue the player will start with.
startingStrengthThis is the amount of strength the player will start with.
startingMindThis is the amount of mind the player will start with.
startingLuckThis is the amount of luck the player will start with.
startingGoldThis is the amount of money the player will start with.
startingBuildingThis is the name of the building your player will start at. If you look in data/buildings you'll see the data file.
currencyTypeThe name of the money used in your world
currencyAbbreviationThe short form version of your currency type
preferredExtensionI like to use GIf file because I can make them transparent and they will fit nicer in the game. Read the comment in the setup file about this.
invCellWidthThis is a number used by the inventory screen to make the items in the player's inventory display nicely spaced apart
viewIconThe image name of the view building icon. I put this here so you wouldn't have to go into the PHP code to change the image.
chatIconThe image name of the chat bubble icon. I put this here so you wouldn't have to go into the PHP code to change the image.
helpIconThe image name of the game guide icon. I put this here so you wouldn't have to go into the PHP code to change the image.
lockPickItemThis is the name of the item in your game that can pick locks. If you look in the data/items folder you'll see the text file and GIF image for this item.
trapProbeItemThis is the name of the item in your game that can probe for traps. If you look in the data/items folder you'll see the text file and GIF image for this item.
startingInventoryThese are the items that a player starts with when they begin the game. You can make the player's starting inventory anything you want, you just have to create the item text files and image files in the data/items folder.
maxVendorRowsThis value tell the vendor screen how many items to display across before making a new row if inventory items for sale.
Variables you shouldn't editThe game depends heavily on these values and unless you know what you're doing - I wouldn't edit them if I were you!

So close! We just need to do some finishing touches to the folders on the server so the PHP code can read and write to the text files. Continue on...
Top


File Permissions (chmod)

CHMOD is server permission stuff. In order to allow the PHP scripts to read and write to text files you may need to set some permissions on some folders.

First, try to create a character by going to your homepage, for example mine is http://simplerpg.freehostia.com/simplerpg. Try making a character in your game and get a access code.

If you can create a character - you're in business! Write down your access code and move onto the next step.

If you get an error (can not write), then we need to do the next step.

You may need to set the folder permissions on the data folder. Do this by clicking on the data folder in WSFTP and then right click on the data folder. Select CHMOD (UNIX) from the list that appears. Check off all the check boxes and click OK. Now the folder can be written to by the PHP script. Try making a character again.
Top


Test it Out!

So now you've set up your get code, created a test character and now you're ready to try the game out on your server. Click the login link, or go to your homepage and click the login link.

Enter your character name and access code. Your character name is case sensitive so Eliia and eliia are two different characters (maybe make both to secure a hold on your character name!). Your access code is like a password. It can't be retrieved so write it down!

If someone ever emails you saying they lost their access code, it's up to you to decide whether to give it to them. They should have to prove they know the character well!

So play the game and make sure of the following:

If you find no issues with the game, then you're in business! Now you can move onto making content for the game and/or expanding the PHP code!

Awesome work!
Top


Possible Problems

Java Applet won't load?
If the Java applet doesn't load for you, try going here and upgrading your Java Runtime Environment (JRE) plugin. Still having issues, try here.


My web account won't let me upload the .jar file!

This is a file type restriction set by the web host. You can't do much about this. Try looking for other PHP free web hosts. There's a link to a list of them here. At the time I wrote this tutorial fresshostia worked just fine.


I installed the files, but I can't set the CHMOD permissions on the data folder

This is a file type restriction set by the web host. You can't do much about this. Try looking for other PHP free web hosts. There's a link to a list of them here. At the time I wrote this tutorial fresshostia worked just fine.


I get some funky Java pop up error when the game first starts

Did you change the starting map info or any v2/ files? If you did, change the settings back to what they originally were and try to get the game to work without making any changes to the setup file (other than the values in red). Once you have it working, go slow and make one change at a time so you can tell which change caused something to break.


Visit www.createorconquer.com