The Nuts and Bolts of Demo Mode


Similar to a splash screen, demo mode is a distinct mode that a game enters when a game is not underway. This mode is different from "game over" and "game not over" modes, and is entered when the game program first starts, as well as in between games . A single Boolean global variable is sufficient to keep track of when a game is in demo mode. This sounds very much like how the splash screen was managed in the previous hour . Demo mode differs from a splash screen in that it involves demonstrating the game, which means that sprites must be allowed to move around. If you recall, the splash screen for the Space Out 2 game deliberately disallowed sprites to be drawn.

The key to making demo mode work in a game is to simulate a game being played without actually involving a human player. One way to do this is to start up a new game as normal, and simulate key strokes using code that is somehow timed. Of course, this also involves disabling the real keys used in the game so that the player can't suddenly jump into a demo mode game. Although this approach can work very well, and is ultimately the ideal approach to creating a demo mode because it shows how the player interacts with other characters in a game, it is more difficult to create. The coding to replace a human player with a computer player can get tricky, and usually involves some degree of artificial intelligence programming. One work-around for this approach is to "record" the keystrokes made by a player during a real game, and store them in a file. You can then "play" the keystrokes back to recreate the demo game. This technique obviously requires some extra work, but will most likely be a lot simpler than trying to establish realistic AI for the computer player.

A simpler approach to creating a demo mode for a game is to simply show how the characters in the game move around without attempting to simulate the human player in the game. In other words, you aren't actually trying to make it look as if a human player is guiding his character through the game or otherwise interacting with the game. Instead, you're just demonstrating how the computer-controlled characters within the game move around and interact with one another. This approach simplifies things considerably because you aren't in a situation in which you have to try and control an otherwise human player using computer logic. Keep in mind that the whole premise of demo mode is to show off a game and make it look appealing. In many cases, it is sufficient to just show a few characters within the game to achieve this goal.

Creating a demo mode that shows a few characters and doesn't actually simulate play is still somewhat of a challenge because you have to create and use sprites just as if you were starting a real game. However, in this case, the idea is to disable any interaction from a human player other than initiating a new game. If you think about it, creating a demo mode for a game such as Space Out involves several changes throughout the game to allow it to appear somewhat as if the game is being played even though there is no user interaction. The remainder of the hour focuses on how to add a demo mode to this game.



Sams Teach Yourself Game Programming in 24 Hours
Sams Teach Yourself Game Programming in 24 Hours
ISBN: 067232461X
EAN: 2147483647
Year: 2002
Pages: 271

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net