<< Chapter < Page | Chapter >> Page > |
This module is one in a collection of modules designed to teach you about the anatomy of a game engine.
Although the modules in this collection will concentrate on the Java game library named Slick2D, theconcepts involved and the knowledge that you will gain is applicable to different game engines written in different programming languages as well.
The purpose of this module is to teach you how to write a program that simulates the spread of a fatal communicable disease within a population (a pandemic) .
I recommend that you open another copy of this module in a separate browser window and use the following links to easily find and view the imagesand listings while you are reading about them.
In an earlier module titled Slick0210: Collision detection and sound , you learned how to write a non-trivial program involving thousands ofsprites, collision detection, and sound. We will take that concept considerably further in this module by writing a program that simulates thespread of a fatal communicable disease within a population (a pandemic) and displays the results in animated graphic form.
The disease has gained a foothold
Figure 1 shows the result of inserting a single infected sprite into a population of healthy sprites. Healthy sprites arecolored green and infected sprites are colored red.
By the time the screen shot in Figure 1 was taken, the disease had gained a foothold, several other sprites had become infected, andeight of the original 1000 sprites had died, leaving only 992 live sprites including the seven that are infected.
Figure 1 . The disease has gained a foothold. |
---|
The disease has spread into the population
Figure 2 shows the situation some time later when the disease has spread considerably. By this point, many sprites have becomeinfected (and are infecting others) and only 763 of the original 1000 sprites are still alive including those that are infected.
Figure 2 . The disease has spread into the population. |
---|
The disease has receded
Figure 3 shows the situation much later. For the set of properties used to run this simulation, the pandemic appears to be receding with 341 of the 1000 original spritesstill alive.
Notification Switch
Would you like to follow the 'Anatomy of a game engine' conversation and receive update notifications?