AGE is composed of a fixed set of threads. Each thread works from its own message queue, and the threads communicate by passing messages. While a thread has no messages, it is sleeping.
Throughout, Game Object is referred to as GO.
An abstract class extending java.lang.Thraed that represents an AGE thread, and most threads subclass this.
An abstract class for all messages.
This interface represents the ability to receive messages.
Abstract class extending GameTask that implements the core apartment thread message loop.
Abstract class is the task running the main game engine "loop" and is the target of most messages.
This is the class you must subclass to implement a game.
The GameCycle class has several abstract methods that must be implemented. These methods function as callbacks.
The Game Cycle task maintains the update lock so GO updates and the drawing cycle do not conflict. The update lock is held:
At all other times the update lock is free.
The Game Cycle task also handles game control messages (Play, Pause, etc.) and forwards game control messages to other tasks, e.g. to suspend timers etc. while the game is paused.
This task is the timer for the desired framerate (in MS). Since AGE uses the SurfaceView in on-demand render mode, this task triggers a redraw at regular intervals.
It's desirable to adjust the framerate low when running on an emulator.
This task executes the GO's load resources method so it can initialize model data and obtain GL objects. Once the GO is loaded, it is passed to the Game Cycle thread to continue the install pipeline.
Each GO is passed a Resources interface that provides access to application-defined resources, e.g. images, strings, etc.
GL objects like Shader and Texture are also Resources, and the framework manages the lifecycle of these "behind the scenes" when the GL context changes, and manages re-creation of cached resources when the GL context is destroyed and re-created.
This task handles all the timers in the system. The timer works on a time base which is the smallest unit of time that is waited. Timer intervals should be a multiple of the time base.
Timers that expire on the same "tick" are batched and sent to the Game Cycle thread so their handlers can execute. Timer events run with the update lock active.
It is desirable to adjust the time base longer when running in an emulator.
Not a direct part of AGE, this is a "foreign" thread with AGE code attached to the RenderService. If it were not for this thread, AGE would not require synchronization.
When creating the SurfaceView, the AGE Renderer is attached, and it sends messages to the Game Cycle task at corresponding points in those callbacks, e.g. "surface ready".