Advertisement
  1. Game Development
  2. Programming
Gamedevelopment

Let's Prototype a Game: Trainpunk

by
Difficulty:IntermediateLength:MediumLanguages:

Making quick, simple prototype games is a great way to test out new gameplay ideas quickly, without committing to creating a full-blown game. I like to use Game Maker for this, and in this post I'll share one such game with you: Trainpunk, a train-based strategy game.

Editor's Note: This is a new type of post we haven't tried before. Please let us know what you think, and whether you'd like to see similar posts in the future!


Concept and Gameplay Demo

Here's a video of me sketching out the original concept for the game, and then of me playing the prototype game itself:

I'd show myself drawing the art as well, but it's so simple that there's no real reason to.

In the final game, two teams of trains try to attack the enemy base while being shot at by turrets. You play by applying upgrades using the buttons at the bottom.

Please download the final game (plus the source code and sprites) and tweak the gameplay as much as you like! You will need a copy of Game Maker 8.


Building the Game

Here's a rough outline of the steps I took to build the game. You could follow along from scratch, or use this to better understand the full source.

Step 1

Download Game Maker 8, and open it.

Step 2

Create a new GAME object, with these properties:

  • Sprite: "No sprite"
  • Solid: false
  • Visible: true
  • Depth: -999
  • Persistent: true
  • Parent: (no parent)
  • Mask: (same as sprite)

Give it these events:

Step 3

Create another new object, _Block, and make it solid. It's just for looks - it doesn't do much itself.

Step 4

Create yet another new object, called _BaseA, with these properties:

  • Sprite: _BaseA
  • Solid: true
  • Visible: true
  • Depth: -1
  • Persistent: false
  • Parent: (none)
  • Mask: (none)
  • The sprite is just a 16x16 block. Now, give it these events:

    Step 5

    Here's an image of the final game, for reference:

    This time, create a new object to represent one of the player's trains (a white rectangle on the tracks). Call it _TrainA and give it these properties:

    • Sprite: _TrainA
    • Solid: false
    • Visible: true
    • Depth: 0
    • Persistent: false
    • Parent: Make it the parent of _BaseA
    • Mask: (none)

    The sprite should be a 16x16 train, facing right. Give the object these events:

    Step 6

    We'll make the player's turrets now. Create a new object called _TurretA, and give it these properties:

    • Sprite: _TrainA
    • Solid: false
    • Visible: true
    • Depth: 0
    • Persistent: false
    • Parent: oBaseA
    • Mask: (none)

    I used the same sprite as for the player's train, here, but feel free to change it to a actual turret. It should be 16x16px. Add the events:

    Step 7

    The turrets have to shoot bullets, so create a new object to represent these. Call it oBulletA, and give it these properties:

  • Sprite: _BulletA //A thin
  • Solid: false
  • Visible: true
  • Depth: 1
  • Persistent: false
  • Parent: (no parent)
  • Mask: (same as sprite)
  • The sprite should be a thin bullet (1px tall by 16px wide, within a 16x16px transparent square), facing to the right. Here are its events:

    Step 9

    When the player can update their HP, the relevant button lights up:

    We'll create this button now. Create a new object called oUpgradeHP, and give it these properties:

    • Sprite: _UpgradeHP
    • Solid: false
    • Visible: true
    • Depth: -99
    • Persistent: false
    • Parent: (no parent)
    • Mask: (same as sprite)

    Give it these events, too:

    Step 10

    Duplicate oUpgradeHP three times so you have four objects - one button each for upgrading HP, RA, SS and AS. (oUpgradeHP, oUpgradeRA, oUpgradeSS, oUpgradeAS).

    Change the Left Released event's code for each:

    Step 11

    Duplicate oBaseA, oTrainA, oTurretA, oSpawnerA and oBulletA to create oBaseB, oTrainB, oTurretB, oSpawnerB and oBulletB.

    Change their Parents (from "A" to "B") and change all their code from:

    ...to:

    ...as required.

    Also set oTrainB to have direction = 180; in the create event, instead of direction = 360;. Last, choose left-facing sprites for each, where appropriate.

    Step 12

    Add all your tilesets, sprites, art and so on and create two new rooms: one is rm_intro, where you should only put the obj_Game, and the other one is the main room (rm_main).

    Build your rm_main like so:

    1. Place bases on either side.
    2. Place train tracks running from the bases (you can use the tileset in the source download).
    3. Place turrets to defend; when all turrets are dead the other team wins.
    4. Place spawners, which spawn new trains at intervals.
    5. Place the four Upgrade buttons.

    You could try to make the room symmetrical so it'll be somewhat fair, or place more turrets on the Enemy side for harder gameplay. It's up to you - the whole point of a prototype is to test things!

    Now play the game. As you play, consider what needs changing. Should the trains be faster or slower? Should upgrades come more frequently? Should the computer have an unfair advantage? Should the player have more input other than just applying upgrades? Tweak away!

    I hope you learned a little something about making games - but more importantly, I hope you learned how any idea can be quickly smashed together into a prototype.

    Editor's Note: This is a new type of post we haven't tried before. Please let us know what you think! Is there anything you'd like to see us do differently with the format in the future? Would you like more detail in the video, or a fuller set of instructions for actually building the game?

    Advertisement
    Advertisement
    Looking for something to help kick start your next project?
    Envato Market has a range of items for sale to help get you started.