GMP API Documentation

Overview

Welcome to the GMP API documentation. This document is meant to be a companion to the GMP code, explaining its features in depth. A quick survey of this documentation is helpful before starting the tutorial.

GMP builds upon the architecture used by your web browser to build and manage dynamic HTML pages. Many game coding tasks are quite similar to making a dynamic web page.

The API also provides a wrapper around many web page architecture features so that they will work with the built-in game loop. This includes the way events and UI rendering are handled.

The GMP API is quite small. It contains 3 global objects (G, G.M, G.KB) and 2 classes (G.Block, G.Gob). These components are summarized below, and described in detail later in the document.

G - The Global Game Object

G is the 'engine' of GMP, and is the parent of all other classes and objects in GMP. It also runs the game loop and tracks objects, methods and variables in your game. Some other game engines have a similar object called a Director.

G.Block - The Game Code Container Class

Objects of this type organize your game code into logical blocks. They also contain all game-specific code such as sprite definitions and game play AI. Users of other game engines may want to think of this as a Scene class.

G.Gob - The Game Object Class

Gob stands for Game object, and objects of this type are the items in your game -- things like layers, viewports, puzzle pieces, characters and scenery. Gobs contain AI and state, and have UI components made of HTML.

Users of other game engines may recognize this as a Sprite class. Gobs are a bit more flexible than sprites.

Most game items will be visible 'sprites', but they can also be more abstract items like layers, viewports, fields, and waypoints.

G.M - The Global Mouse Input Manager Object

G.M captures and processes mouse input, making it accessible wherever you need it.

You can use its variables to schedule mouse triggered logic within the normal flow of your game code, or have it execute mouse event triggered code immediately with hook functions.

G.KB - The Global Keyboard Input Manager Object

G.KB captures and processes keyboard input, making it accessible wherever you need it.

You can use its variables to schedule keyboard triggered logic within the normal flow of your game code, or have it execute keyboard event triggered code immediately with hook functions.

Next: G - The Global Game Object