Platform Game Generator                                                                   PGG - Platform Game Generator
Home Manual Demo Download Screenshots Bugs Samples Links  

PGG Manual

Download the PGG Manual here.

PGG Structure Diagram

Define Start Statement

Now were going to start to program our own platform game, from the beginning. Here is an example of the first part of the code for a game;

define start-

The 'define start-' clause is where all the most basic characteristics of the game are defined. Everything defined here is a constant setting - it cannot be changed somewhere else in the code. It's not essential, without it, all of the game settings would be set to default (it's recommended you change as much as possible so you can be sure the game will be playable in the graphics you give it). Above, shows all of the options you have in the initial clause. Say you didn't include the turnwhilejump statement, the PGG program would then while interpreting wouldn't see it so it would set it to its default (turnwhilejump default = yes). Note : all of the PGG language is case sensitive. I feel case sensitive language causes confusing code, for this reason none of the statements accept capital letters. i.e. GraviTy (1.8) would not be accepted. However, it is possible for you to use capital letters in define statements, this is not recommended.

Explanation of statements

Default = 400,300
This specifies the screen size in pixels (viewable area). The first integer is the width of the screen and the 2nd integer is the height. This makes it possible to create totally different screen shapes. Please note;

  • This should be the same size as the screens graphics you have created.
  • A new screen is loaded once the player has reached the end of the screen.
  • Enemies can be placed outside this area but they will not be seen.
  • You might, for some games, want the game to change screens before the player has reached the end of the current screen, this is accomplished by setting the screensize to be LESS than the level graphics.

Default = 1.5
This specifies the gravity level in the game environment. i.e. the player will fall of a edge faster if the gravity is set higher. The gravity level is specified with a float or int. Higher level of Gravity will result in a faster falling rate. Please note;

  • 1. Due to the way PGG is implemented, high gravity levels i.e. greater than 1.75 can cause errors when coming to collision detection. The fall though effect can happen. This effects platforms and thin floors, be sure to avoid using these if you want a high gravity level.
  • 2. If you need to make the player fall faster consider changing the gamespeed value. (explained later)
  • 3. Changing gravity settings can cause unexpected results, make sure the game is fully re-tested if you change the gravity setting in a game you've produced. ie. Make sure all platform are all fully reachable if you've raised the gravity level. When lowering the gravity level, be sure no other 'unexpected' areas can now be reached within the game.
  • 4. In conclusion, the best method is to get the level you desire first, before finishing the program, to avoid re-testing.

jumppower (float);
Default = 2.5
This specifies the strength of the jump i.e. how high the player can jump. This can be specified as a float or an int. Please note;

  • High jumppower combined with low gravity levels result in an unnatural looking jump I.e. The player raises faster than he falls.

jumpresistance (float);
Default = 0.1
This specifies the slow down rate between after the player has pressed jump and when the jump has reached its peak. Lower values cause a more sudden change in direction when it reaches the peak of the jump. Higher values create and smoother jump. Please note;

  • Remember this value is called airresistance, therefore very high value will cause the player to be unable to raise from the ground at all!
  • A Value of zero, creates and completely 'angular' jump, i.e.. Jump up then sudden changes direction to fall back down.

walkspeed (float);
Default = 1
As the name indicates, this alters the speed at which the player walks when moving left and right. Please note

  • Because of the way PGG is implemented, increasing the walk speed will automatically increased the playerwalkanispeed (explained later), this is the animation speed between frames.
  • very high values can create errors with very thin blocks, avoid high values (>2)

walkinwall (boolean);
Default = yes
This doesn't mean 'can the player walk into a wall' as the name might appear as, it literally means do you want the player to appear as if he's walking in to a wall. By this, it means do the animations frame keep changing if the player is stationary but trying to walk into a solid block. This statement is not that important in the way it doesn't affect the way the game plays, it just affects it's appearance of the main player in certain places.

  • This is purely a design choice, many different commercial games have to set both ways.

keys(k1, k2, k3);
Default = none!
This specifies the controlling keys to play the game. Three different keys have to be specified;

k1 = left
k2 = right
k3 = jump
for example keys(q,w,p) would might that the key's 'q' and 'w' move the player left and right, and 'p' will make the player jump.

  • Test the keys after you've decided what they are to be, on most PC's with certain letters combinations, you can't press both keys at once, you should test all off the keys you've chosen don't cause any problems. i.e. can you hold down the left button and jump at the same time, and still be moving left?
  • If you wish to use special key (such as arrow keys or spaces) please refer to the ASCII table (please download the full version to view this).

Default = 0.75
This determines how fast the player sprite will stop moving after the controller has let go of the left or right button. The value should be between 0 and 1. Values greater than 1 will cause the player to speed up when the controller let go of the left or right button!

Default = yes
This means exactly what is says, it's a setting to change whether the main character can change directions in mid air. If this is set to yes, for example, the main character can jump in a right direction, then press left while in mid air, the character will immediately change direction. Therefore with this setting on, the way the player moves left and right on the ground is exactly the same as in mid air. This is not true however if it is changed to 'no', when it is set to 'no', the player cannot change direction from the original direction he was moving when he left the ground. Pressing the other key will result in the player slowing down but not changing direction.

  • Again this is purely a design choice, but the player does feel as if he has more control if this is set to true.

Default = 5
This states how many the lives the player should have in one game. Please note you shouldn't enter a value less than zero.

Define Player Statement

After the define start tag, you could include the define player tag, although any of the define blocks could be in any order.

define player-
  playerjump(jump_l.gif, jump_r.gif)

The 'define player-' clause is is where you state everything about the main character graphics. You can assign three left walking frames and three right walking frame + two frames for jumping left and right. The parameters within the brackets, should be the location of the image file. The image file should be either a .jpg or .gif image, although it much more recommended only .gif files are used for sprite images, for the follwing reasons;

  • 1) GIF images allow a transparent 'colour', so you won't see a block around the sprite if it not completely square.
  • 2) GIF's also usually take up less disk space than JPG's if they don't contain lot's of different colours.
  • 3) GIF's don't affect the quality of the image when it compresses it.

Explanation of statements

Default = none
The specifies the image of the first three frames while the player is walking left, and the frame when the player is stationary facing left.

Default = none
The specifies the image of the first three frames while the player is walking left.

Default = none
The specifies the image of the first three frames while the player is walking left.

Default = none
The specifies the image of the first three frames while the player is walking right, and the frame when the player is stationary facing right.

Default = none
The specifies the image of the first three frames while the player is walking right.

Default = none
The specifies the image of the first three frames while the player is walking left.

Important points to note: Here is a sprite captured from a commercial platform game. If you were to use this sprite, you should use the following stages to include this sprite within your own game in PGG.

  • 1. First you should extract the sprite you wish to use from a game. In this case I have taken a frame from 'Super Mario World', this frame could be used for the playerright1 statement. This is appropriate because this frame is clearly a frame which could be used to show the player is stationary, as well as (combined with others frames) walking.
  • 2. Next you want to crop or resize the image. This is very important, because of the way PGG is implemented, PGG looks for the image size when calculating collision detection. Therefore if the images hasn't been correctly resized, and has a 'block' around it. PGG will assume that block is part is the sprite. Obviously this will cause many strange affect within the game, such as losing a life when nothing hit you, or appear to be floating above the ground!
  • 3. The next stage is to make the colours which are not part of the sprite transparent. In this case the black part in the above image. This is important so you don't have a block around the character.

Default = 1
This specifies how fast the player frames alternate while walking left and right. Please note;

  • This value works together with walk speed. If you increase either value you should decrease the other to maintain the same animation speed.