The next game on the agenda is Ping Pong. It should be familiar to most people who play games. Pong, the most well known incarnation of this game, was the first commercially successful video game. The gameplay is simple. Two paddles move vertically across the screen in an effort to bat a ball toward the opposite paddle. A player scores a point when the other paddle misses the ball and allows it to travel off screen. A victory is achieved if one player reaches a preset score.
Implementation should be straightforward, but the desired result of creating Ping Pong is not simply to have a Pong clone. The core deliverable of the project is the framework. The purpose of Ping Pong is to test and demonstrate the framework's effectiveness. It exists to give context to the framework. Accordingly, the framework will be the focus of this development iteration.
Three modules will be emphasized as I develop Ping Pong: graphics, input, and game management. The graphics module will handle drawing to the canvas. It will include two primary components: a library of functions to handle creating and drawing shapes and a management component that allows the developer to register drawable items without having to worry about drawing directly. Future versions of the module will include the ability to draw images, sprites, and effects, but the current iteration will focus entirely on shapes (such as a line, rectangle, sphere, or polygon).
The input module serves to alleviate the problems associated with Javascript's event system. Javascript's single-threaded nature clashes horribly with the browsers' asynchronous event system. The effect is not as profound in simple web apps, but in a real-time simulation such as a video game, events must be carefully and methodically managed to utilize user input effectively. The current iteration will include support for keyboard input. Mouse input will be added in later development cycles.
The game management module will be at the core of any framework application. It manages the game's flow from initialization to the game loop to termination. It handles timing in the game loop, makes it possible to pause the game, and keeps everything running smoothly and predictably. The single-threaded asynchronous issues described before will be handled by the game management module, as well. Further, navigation from real-time gameplay to menus (perhaps a simple pause screen or a complex configuration menu) or other forms of gameplay (such as moving from an overworld map to a game level) will be managed by the game module. It is intended to be flexible enough to handle any type of activity, whether it be a menu, gameplay loading screen, or anything else.
In addition to these modules, smaller modules may be created for utility functions and other tasks. For instance, object oriented Javascript is made easier by helper functions. These will be encapsulated in a util.lang module. Other utility modules will be added as needed.
Each of the framework modules will be developed alongside the Ping Pong game itself. As the requirements of the game are drawn out, the modules and their functions will be written to aid in the implementation of the game.
No comments:
Post a Comment