The Game Domain

The game domain (in these guides I also call this the 'world') is a 2D region that encloses the play-area of the game, all game entities and actions occur inside this region. Many of the examples shown in the programmer guides use the display area as the world (see the Marketplace Patrol sketch ).

world size equals display size

Display and game domain areas are the same here

In many games this is not the case and the game world is much larger than the display area. The library supports a game world of any size. Okay so computers don’t do infinite, but your game might open a 800x600 pixel window but the world might 10, 100 or even 1000 times larger than that. In fact it could be larger still, the only limited is the accuracy of 64 bit floating point numbers. In this situation the library allows you to zoom in/out and pan across the world (see the City Patrol sketch).

world size bigger than display size

Here the game domain is bigger than the display area

Domain coordinates and direction vector

Since the library uses the double data type throughout, the PVector class was unsuitable because it used the float data type. Instead the library provides the Vector2D class that has just 2 attributes (x and y).

The library uses this for all domain coordinates (e.g. entity positions) and all direction vectors (e.g. entity heading and velocity).