The aim of the first four main sections of this tutorial is to bridge the gap between traditional A-level programming and the online game demonstration programs and tutorials aimed largely at more advanced programmers. These sections should prepare you for Jason McMillen's republished Artillery Game Tutorial which follows. Game development will give you the opportunity to read and write advanced Pascal code. It should be enjoyable and rewarding for confident student programmers. You will learn how to use the SDL (Simple DirectMedia Layer) multimedia library to gain low-level access to audio, keyboard, mouse, joystick and 2D display. SDL also facilitates the use of OpenGL. (OpenGL is a 2D and 3D graphics application programming interface which provides access to visual functionality such as lighting and texture effects).
Before tackling the SDL, you will need to have a good understanding of the material covered in at least these basic Pascal tutorials: Constants and Variables, Selection Statements, Iteration, Arrays, Procedures and Functions, Random Numbers and Records. You should also know how to use pointers and other language features described in the Preliminary Knowledge section of this tutorial.
Getting Started with SDL provides the practical details of files required and set-up procedures to enable you to run demonstrations and write Pascal gaming code.
Useful SDL Subroutines provides guidance on the use of a few commonly used functions and procedures selected from the many available. We include two straightforward programs demonstrating the use of these key subroutines.
Sources of Help directs you to and describes a range of resources that we have found most useful in learning how to program with SDL.
Artillery Parts 1 - 4 builds a game in stages. Four tanks placed on a randomly created landscape fire in turn a shot with adjustable power and elevation. We are very grateful to Jason McMillen, Editor in Chief of Pascal Gamer Magazine and Co-Founder and Webmaster of Pascal Game Development, for permission to republish his Artillery Game Tutorial.
In the final sections we encourage aspiring students to try the Box2D physics engine and the GLScene and Castle game engines.
Follow the numbered links below to access these sections.
Since we wrote most of this tutorial several students have become fluent with SDL and have contributed instructive programs. See, for example, Steven Binns's MyFirstSDL to get started, his TesterGameEngine and Max Foster's MrSnugglekins for 3D graphics, and Christopher Winward's AStar for 2D graphics. SDL2 is now available to Pascal programmers, and we look forward to contributions that use it. An image stored as a SDL_Texture is stored in the graphic board's RAM and manipulations are hardware accelerated. (We have had success on a 64-bit PC with the 32-bit SDL2.dll but not yet with the 64-bit library). Steven Binns writes superb comments to turn his My_first_sdl2 into a guide to getting started with SDL2. A recently available, and in our opinion easier, alternative to SDL/SDL2 is PasSFML. PasSFML integrates well with the Box2D physics engine.
Smart Mobile Studio is ideal for web programs, and we provide an extensive tutorial, student Smart Pascal programs and converted student games to inspire you. See also a game development section in another Pascal dialect, Oxygene for Java.