Previous column

Next article

Game programming – The “Why”, “What” and “How” with Graphics Objects

Lakshmi Prayaga, Lecturer, Computer Science Department, University of West Florida, Pensacola

space COLUMN

PDF Icon
PDF Version


Game Programming is the latest buzz word in the computer science educational curriculum. Many universities across the world are offering complete CS degree programs in game programming while others such as the Art institute of Portland have summer camps for teens in game programming (Ai of Portland, 2005). This brings us to three interesting questions, The “ Why”, “What” and “How” of game programming. This paper serves the purpose of analyzing these questions within the context of a Visual basic.Net application. A discussion on the choice of Visual Basic .Net as the environment to create and manipulate the objects in the game is also presented. The code used is also included in the paper.


The idea of using games for educational purposes in K-12 and also for higher education is well documented (Dempsey etal, 1997, cited by Seay and Scott). However, educators are split on the idea of using games in a class room. Some feel it is very effective to teach a concept while others feel it takes up valuable class time. But research (J.C.Herz , in JoyStic Nation, p 1-2 cited by Seay and Scott, Affisco, 1994, p.171 cited by Feldgen and Clua) shows that students these days have a totally different way of learning. They react more to interactive learning. In fact Affisco coins the word ‘Edutainment’ a combination of entertainment and education and points out that if students are not entertained while they learn, the instructor has lost them. Herz argues that, “If your memories have pop soundtracks or big-screen kisses, if you've ever told an anecdote with instant replays or a coda of stadium applause, it's because you've been brought up with media that furnish those conventions. Video games provide a new set of conventions, which are being rapidly assimilated, as you read this, by a legion of six-year-olds. Their mental grammar is going to reflect that, just as the baby boomers' worldview echoes the impact of television. But whereas TV turned kids of the fifties and sixties into a nation of screen watchers, videogames have created a cadre of screen manipulators ( p.1-2).” Continuing on this thought, Lave(1991) and Mcllelan(1995)argue learning happens within a context and culture of a society, i.e. it is situated. The typical student today(2000 – present) is very well versed in playing games on the computer. They acquire high levels of skills in playing these games and in trying to beat the computer. In addition, many argue that (Coleman et al. 2005) “videogames are the initial draw to technology for a number of students in the first place”, (Pleva 2004) they provide a “stepping stone for kids into the world of technology. Students who play computer games tend to be more comfortable with the technology and more adept at using it.”.

Ideas such as these expressed by educationalists show that games are here to stay and are being used as educational tools, and are in many cases successful at delivering educational content in a way that students internalize those concepts being presented. Seay and Scott cite a reference to an article in the American Scientist which shows that the IQ of present day students is increasing and one of the theories for the increase in IQ “is that our increased exposure to visually rich mass media---television, computers, video games -- has enabled us to perform better on spatial-visual tests. The theory states that the ability to interpret different forms of information from different media and make some kind of sense of it is what these IQ tests actually test for.”

The game environment is almost like a comfort zone for the student by which he is not intimidated. It is in fact his preferred choice of context to work in. It is therefore an area that can be used advantageously by educators to motivate students to be focused in and complete their assignments. In fact Feldgen and Clúa show that most students in the year 2003, chose the context of the game environment for their projects compared to the context of engineering, calculus or business and were also successful in completing their projects. This shows that the gaming environment has a heavy influence on the students mind and therefore also acts as a good motivator. Not surprisingly, many universities (GameDev.Net05) such as University of Pennsylvania, University of Denver, Middlesex University UK, University of North Texas have now started to think seriously about including game technology into the CS curriculum.


“Game programming is a subset of game development, is the programming of computer, console or arcade games. Though often engaged in by professional game programmers, many novices may program games as a hobby. Most software engineering students program games as exercises for learning a programming language or operating system. In fact, the Unix operating system and the C programming language exists because the original programmers wanted to play games” (Wikepedia 2005).

Game programming is both an interdisciplinary and an intra-disciplinary field. It is an intra-disciplinary field of computer science because it includes (Masuch, Freudenberg 2002). “Computer graphics, AI, simulation, user interface design are core components of every game. And more: network techniques, multimedia, databases and many other disciplines take part in game development”. It is an interdisciplinary fields due to its heavy dependence on photography, physics, imagery, audio and video technology, in short all elements of multi media technology.

The above topics provide the necessary background knowledge to deal with the complex relationships among many abstract and concrete components of game programming. Some of these components are the story line, picturization, characters, shapes, sound, interactivity and other multimedia effects. These components can broadly be classified into two categories, visual and non-visual. This paper focuses on creating and using graphics objects as the primary source of visual representation of the game being planned. Graphics objects form the core of game programming because images used in any game have properties which are similar to the properties of a graphics object. An example is that of an image bound within a rectangular or circular graphics object. We show how geometric shapes can be made into objects that have properties, events, and methods suitable for game programming.
In addition to introducing students to the idea of “objects”, game programming can be used to introduce introductory data structures such as arrays and records. Together, these topics form the core of an introductory object oriented programming (OOP) course with gaming as the context. As discussed earlier, students can relate to this context, and hence there is a better chance of meeting and improving student learning outcomes in an introductory OOP course. In recent years game programming is being introduced into the CS curriculum in many different ways such as (deLaet et al. 2005)“a games course for women, a software development course that uses games as projects, an introductory games programming course in Java, and an advanced graphics course that focuses on games”.

Regardless of which way a game programming course is introduced, there are some essential elements of the subject which must be taught. These include graphics objects, animation, physics of collisions, collision detection, collision response and multimedia effects. The elements of game programming presented in this paper implement the recommendations of Cunningham et al. (2004) as shown in Fig1.

Figure 1

Figure one provides a framework that explains the design process and is discussed below:

  • Problem statement: In order to create a game, it is important to formulate the story line, followed by identification of the individual components participating in the game and their relationships. An example is to visualize a scenario when in which a group of objects appear on the screen and start moving randomly.
  • Model: Once the statement of the problem is verbalized, the next step is to conceptualize or abstractly visualize a model that represents this problem.
  • Geometry: This conceptualization must now be translated into figures, outlines or geometric shapes. For example the objects can be thought of as spherical, rectangular, triangular or polygonal objects which have geometric properties such as points, angles, vertices and lines. Objects may also have irregular shapes, with pictures of trees, birds, animals etc.
  • Image: The last phase is to visually depict this model on the screen of a computer by using an image that corresponds to this model.

These four phases constitute the building blocks of game programming. As shown in fig.1, looping back to the initial phase (or to any phase from any phase, similar to the waterfall life cycle model in software engineering - Schach02) may occur many times during the design of the program. Only one loop back is shown in the figure to avoid clutter. The next section is a discussion on the implementation of these core concepts.


We discuss the implementation of the principles of game programming based on fig1 with reference to a specific game environment being designed. Graphical reusable/replaceable objects are used to illustrate the use of the four elements of game programming discussed above.

The problem statement/ story line of the game: The game being designed is a combat operation between different geometric shapes. The user/player controls one of the objects and the rest of the objects try to hit the user/player object and destroy it. The elements required at this stage include creation of objects for the game, the movement of these objects (animation) on the game board, the collision of objects, the result of this collision and audio clips to add sound effects to the environment.

The model: A model is an abstract visualization of the problem being discussed. The model for this game is the interaction between the two sets of objects, system/game controlled objects and the user controlled object. These shapes do not have any social skills, so when they interact with the user object the user object is either destroyed completely or shattered into smaller pieces. So, the outcome of the combat is collision, destruction or the survival of some objects

Geometry: The geometry is the crucial piece of game programming. It is at this stage that decisions regarding the size of the game board, the types of objects, the shape of the objects and the location of the objects on the board, have to be made. During the game, various geometrical transformations of the objects have to be performed, such as rotations, translations, scaling, etc. Students designing the game must therefore be particularly familiar with coordinate geometry, linear algebra and trigonometry to be able to make these decisions. The importance of geometry in game programing is also evident as it is included as one of the major courses students wishing to major in game programming must take. (Coleman et al. 2005). We assume that students entering to take a course on game programming have this pre-requisite knowledge.

Image: The images on the screen follow the decisions made in the geometry phase. Images translate the model into a visualization. Depending on the expertise of the programmer, imagery can become a very complex element of game programming.

Why Visual basic.Net: The choice of Visual basic.Net as the programming language to introduce students to game programming was the result of an experiment conducted on a batch of at risk high school students. These students were ninth graders who were participants of the “reach for tomorrow” program which is designed to motivate at risk students to acquire military scholarships and pursue higher education. ( The students had no prior computer programming experience and were also not very comfortable using the computer. The limitations under which the experiment was conducted were:

  • Limited amount of time (two and a half hours)
  • Students having limited computer experience
  • Zero programming experience

Given these limitations, I needed to choose a language that was user friendly and did not have a high learning curve. Visual seemed to fit this bill. I used to get the students develop a simple game that included the basics of game programming by

  • using picture boxes to hold the objects used in the game
  • simulating animations and movements with timer controls
  • simulating ideas of velocity, speed, direction
  • including the idea of collision detection and response

The result of this experiment was that the students enjoyed the experience. In fact students at this stage were motivated enough to experiment with changing the speed, direction, size and other aspects of the objects used in the program. This shows that choosing the proper context (games) and providing the proper and easy to use programming environment (user friendly VB.Net tool box) generates the required motivation for students to pursue their goals. Visual basic.Net is a very user friendly language because of its rich GUI environment. Presented below is the design of an application that includes the basic elements of a game program discussed so far.


The table below shows the design of the game in terms of the elements used in the game and their corresponding VB.Net elements.

Game Element VB.Net Element
An area to play the game PictureBox
The Players Graphics Objects
Movement of players Controlled by timer Controls
Collision - detection Intersectswith property
Collision – Response Simulation of Explosion and collision

The graphics objects used in this program are created by instantiating the shape object named ObjectShape. Since the objectShape is an object, we can reuse it and instantiate it as many times as necessary. The ObjectShape object has properties and events as follows:

  • Properties:

    Color, shape, size

  • Events:


Using this method we set up six small ellipses which are the opponents in the game and one slightly larger ellipse which is controlled by the user. The user controls his piece with the mouse, so he can move around the play ground.


To maintain clarity and for demonstration purposes the elements of game programming incorporated in this example are kept simple. These include animation/movement of the objects, velocity, collision, graphics objects and audio rendition.


Animation is provided by using a timer control. The timer control’s tick event is used to move the graphic object on the screen, horizontally, vertically or diagonally. The timer control’s tick event also checks for collision occurrence and if collision occurs, the function collide is called to swap the velocities of the objects. The code for moving the objects is included in the moveAround sub procedure.


Collision detection and response are other key elements of game programming. There are several kinds of collision responses that occur when objects collide. We discuss three types of collision responses - one in which an object bounces off a wall, one in which two objects have a head on collision and bounce off each other and a third in which an explosion or shattering occurs on collision

  • A ball hits a wall and bounces off. (code in the sub procedure moveAround)
  • A ball collides with another ball and the two balls bounce off of each other. (code in the sub procedure collide) In the sub procedure collide the velocities of the two objects are interchanged.
  • The collision response resulting in an explosion is achieved by disposing off the object (user controlled object) and creating six smaller objects on the screen. This creates the effect of an object being shattered and explode into small pieces.


The next element used in the game to provide sound effects is audio. SoundWav.vb is a simple class file used in the application to provide the functionality of playing a wave sound file when necessary. This is a modified version of a class file available on the internet (soundFile) We have used two different sound files for collision between the game objects and collision between the game object and the user object. When collision occurs between the game object and the user object we have a “crashing” or “exploding” sound, and when collision occurs between game objects we have a ‘ding’ sound. This completes the design of the game elements.

User Interface:

The program has two buttons, Wall Collision/Dispersion and Ball Collision (Figure2). The Wall Collision/Dispersion checks for

  • Collision of the small balls with the wall and if collision occurs the balls bounce off the wall.
  • It also checks for collision between the small ball and the large ball and if collision occurs the large ball shatters into small pieces. (Figure3)

The Ball Collision button checks for

  • Collision between two small balls on the screen and if collision occurs, the swapping of velocities takes place. (Figure4)
  • It also checks for:
  • collision between the small ball and the larger ball which is the user controlled piece and if collision occurs the user control is disposed.
  • Wall collision is also included in this button. See figures 1, 2 and 3 for the game in action


Figure 2

Figure 3


Part A – The Class file - Object Shape:

Part B Class for Sound File –

Part C – Main program:


Game programming can be a useful and powerful tool. It can be used in educational settings to help students understand abstract concepts through games, with which most students are familiar. Examples of introducing abstract concepts through game programming include OOP, data structures, principles of physics, chemistry and mathematics. We also believe that game programming can exert a positive influence on at risk students by providing them with much needed excitement and motivation to pursue higher education as was evident by our experience Additionally, game programming is also a good field with plenty of opportunities as a career choice. Several web sites such as International Game developers association( provide detailed information on the type of jobs available in the gaming industry along with the salary ranges. In attempting to promote this idea of introducing game programming to students, our future work will concentrate on developing a set of tools for the most commonly used game programming techniques with a grounding in physics as applicable to the gaming environment.


[Ai05] Art Institute of Portland, retrieved on July 10th, 2005 from:

[Seay,Scott97] Jerry Seay, Robert Scott, Education and Simulation/Gaming and Computers, 1997, retrieved on July 10th, 2005 from

[Feldgen,Clua04] Maria Feldgen, Osvaldo Clua, “Games As A Motivation for Freshmen to Learn Programming”, 34th ASEE/IEEE Frontiers in Education Conference, October 2004

[Lave,Wenger90] Lave, J., & Wenger, E. (1990). Situated Learning: Legitimate Periperal Participation. Cambridge, UK: Cambridge University Press.

[McLellan95] McLellan, H. (1995). Situated Learning Perspectives. Englewood Cliffs, NJ: Educational Technology Publications.

[Coleman etal05] Ron Coleman, Mary Krembs, Alan Labouseur, Jim Weir(2005), “Game Design & Programming Concentration Within the Computer Science Curriculum”, ACM SIGCSE 2005, pg 545.

[Pleva04] Greg, Pleva. (2004), “Game programming and the Myths of Childs Play”, Journal of Computing Sciences in Colleges, Volume 20, Issue 2, pg 126.

[Fernald05] Joseph Fernald (2005) “Game Development Schools – Part 1”, on July 10th, 2005 from:

[Wikipedia05] online encyclopedia, retrieved on July 10th from

[Masuch, Freudenberg02] Maic Masuch, Bert Freudnberg, Teaching 3D game programming, retrieved on July 10th from

[Delaet etal] Marianne deLaet, Kuffner James, Slattery michael, Elizabeth Sweedyk, “Computer games and CS Education: Why and How”, retrieved on July 10th from

[Cunningham etal04] Steve Cunningham, Werner Hansmann, Cary laxer, Jiaoying Shi, “The Beginning Graphics course in Computer Science”, Computer Graphics, Volume 38, Number 4, November 2004, pg 24

[Schach02] Stephen R. Schach (2002), Object Oriented and Classical Software Engineering, Fifth Edition, Chapter 3, pg66

[Coleman etal05] Ron Coleman, Mary Krembs, Alan Labouseur, Jim Weir(2005), “Game Design & Programming Concentration Within the Computer Science Curriculum”, ACM SIGCSE 2005, pg 547.

[] retrieved on July 10th, 2005, from:

[soundfile] “Play an Embedded sound file”, retrieved on July 10th, 2005, from:

[] retrieved on July 10th, 2005, from:

About the author

space Lakshmi Prayaga is a lecturer in the Computer Science Department, at the University of West Florida. She is the co-author of a text book, “Programming the Web with ColdFusion MX and XHTML”. She has presented several papers in conferences and workshops such as ACMSE, ELearn, EdMedia and NCEI. Her research interests include building visual tools to serve as teaching aids, web server technologies and computers in education.

Cite this article as follows: Lakshmi Prayaga: “Game programming – The “Why”, ”What” and “how” with Graphics Objects”, in Journal of Object Technology, vol. 4, no. 9, November-December 2005, pp. 39-58

Previous column

Next article