• Recent Tutorials

  • Artillery Game Tutorial - Part 1: Introduction


    Welcome to the first in a series of tutorials that I hope will help new developers and fans of the genre. When I first started to learn about computers and even before I got serious about programming, one of the first PC games I ever owned was a shareware game called 'Scorched Earth'. It was a cleverly designed game where you were in a tank against up to 9 other tanks on a landscaped 2D screen, and the main idea was to try to destroy all of them and be the last one standing to win the round. Do this for a chosen number of rounds and whoever has the highest score at the end, wins the game.

    In addition, you had many nice features where you could buy all kinds of different weapons and items to aid you in fighting. This money was earned as you played and destroyed other tanks for points. Different tank types, fuel to get around, levels of computer AI, randomly generated yet configurable land and many other things that made this an exciting, addictive and extremely fun game. The 'Artillery Game' genre was born, and I was hooked!

    You may have also played a more recent game that is based on the same concept of game play called 'Worms'. It also falls under this genre. It has had several sequels that have been leading the way of this type of game adding new things in each edition of the series.

    Throughout this tutorials series I will be teaching how to design an Artillery Game yourself. It will feature the basics of the game play and then move on to the many neat features and systems you see within these great games.

    Scorched Earth 1.5

    What do I need before we start?

    I will be using Lazarus and JEDI-SDL to create the game. I however, will not cover how to use Lazarus or JEDI-SDL. This does not mean that if you have not used it before you will not be able to follow along. The concepts and game play design will be independent of this. You may substitute with any Object Pascal compiler/IDE or graphics library you like instead.

    I will also be making use of objects using Object Pascal. I will assume that the reader knows at least the basics of 'Object Oriented Programming' or OOP for short. This will help to keep the code clean and manageable as we go though it's development.

    Though you do not need to know a lot of math for this game, it would most certainly help in some cases. More specifically with the game physics portion where we get into a small bit of trigonometry. But it is not by any means an obstacle, so please read on!

    Direction and Scope

    Like all tutorials, I will start by covering the basics first. We will create the game as we go along separating each step so that it'll make for easy consumption and act as a reference for later.

    We'll start off in the 2nd installment with how to generate the battlefield, draw and display it. Then in the 3rd, placing the tanks into the battlefield. After we'll move along to the tank controls, the game's physics for fired shots and collision detection. Then we'll later learn tank damage, wind and weapons explosions. These are the basic features of the game before you can go ahead and make it all fancy afterward.

    Worms World Party

    And now, our humble beginnings; Enter The Code!

    We will start out with the main source that we will build upon and GraphicsUnit.pas to help speed along some of the graphics handling.

    When run it should show the included background scene. You can then press Esc to close the program. If you are new to JEDI-SDL or even Pascal then you will be able to play with this further to get a better grasp of how to work with the two before you jump onto Part 2.

    Download the source files here!


    The project file included already has Delphi Compatibility mode enabled, which is required. But ensure that you have it on in case you are copying and pasting my code into a new project of your own making.

    You will need to supply the path to the JEDI-SDL folder for the SDL header!

    In Lazarus go to Projects -> Compiler Options... and click on the Paths tab. There in the Other Unit Files (-Fu) field change C:\Documents and Settings\WILL\My Documents\Pascal Projects\JEDI-SDLv1.0\SDL\Pas\ to match the path of your own copy of JEDI-SDL.

    Lastly, since I have not supplied the sdl.dll file along with the source, you will be required to make a copy of the file to their the source directory or a location within your system's path.

    Once complete you should be able to compile and run it without any problems!

    End of Part 1

    That's it for now. In the next tutorial, 'The Dirt' we'll start to get into the good stuff where we'll be creating the play-field on which we'll be causing our mayhem!

    - Jason McMillen
    Pascal Game Development
    Comments 3 Comments
    1. Traveler's Avatar
      Traveler -
      I like the way these articles are looking. Hopefully more will start to appear now that anyone can add one.
    1. WILL's Avatar
      WILL -
      Thanks! I have 3 more ready for this series, but I'm going to space them out a bit. I believe it'll take 2 more to complete the core of the tutorial then I can add more to just play around with all the fun aspects of the game genre. Writing and editing articles is just like using Blogger or Twitter so it's east to do if you enjoy writing.
    1. Cody Averett's Avatar
      Cody Averett -
      Yes I agree. These are very helpful. Scorched earth is a classic and a good choice for this tutorial.