Friday 19 November 2010

Framework additions

I've been working on a new game recently, basically to put the game framework really through its paces. Most of it has been holding up really well. I have however, come across a few issues that I have had to address.

Firstly, I had not implemented a way in which to display a dialog on the game screen. The framework is based on a series of 'scenes', but it was not easy to display a dialog over these scenes, so I am currently addressing this.

I also noticed that all of my coding had failed to take into the account of the triggers that I created for timed events. In particular, a particle effect I use to trace the movement of the cursor. I have now changed this to use the triggers and have realised that the code is much simpler and more efficient. I also have more control to the frequency of the particle creation.

I do plan to implement a proper particle system, based on the special effects classes in the framework. This will allow the easy creation of particles with various properties, such as blending type, movement, gravity, spawn rate, fading and shrinking. At the moment, I create each particle emitter by subclassing the effect and effectInstance classes, so I will look at subclassing these and allowing them to be integrated into the existing effects routines.

Anyway, I have been going on about my framework, so here is a breakdown of the classes in the framework and what they are for:

Type Scene

This is the container object for each scene within the game. To make this useful, this class must be extended with the event handlers overridden. It handles the automatic processing of the game loop, events and drawing.

Type SceneSound

This is the new sound object used within the scene.

By using thes SceneSound, rather than the TSound, we can control multiple instances of the playing sound And it will also respond To the Pause And Resume of the Scene Object.

Type Sprite

This is the sprite object used within the scene. Sprites are not created directly, but with the NewSprite method of the Scene object. Although the Sprite object can be used as is, it is also possible to subclass it to allow some automated processing, such as animation.

Type Trigger

Triggers are used to create timed events to be triggered during the game.

Triggers are not created directly, but with the NewTrigger method of the Scene object.

Type EffectInstance

This is the base object for all special effects instances. On it's own, this type can do nothing, so it must be subclassed.

Type Effect

This is the base object for all special effects. On it's own, this type can do nothing, so it must be subclassed.

Type GUISystem

This object, although not directly accessed by the programmer, controls all aspects of the in-game GUI system. This system is skinnable and can therefore be easily customised for individual projects. This is NOT a replacement for GUI systems like MaxGUI, the GUISystem in the framework was created for in-game menus.

Type GUIElement

This is the base object for all GUI elements. On it's own, this type can do nothing, so it must be extended.

Type GUIButton Extends GUIElement

This is the standard push button Object used by the GUI system. This object can have three images to show state and three sounds to trigger on mouse over, down and up events.

Type GUIToggle Extends GUIButton

The Toggle Button object acts like a normal button, but with the added advantage of being sticky, when set down. This is also useful as a check box in options menus. In a group, it can be used to simulate a radio button.

Type GUILabel Extends GUIElement

A static text label for displaying information.

Type GUILives Extends GUIElement

This object displays a number of images to indicate the number of lives left in the game.

This could also be used for other information, such as missiles or ammunition. The images used to display the information can be automatically animated, if desired.

Type GUITextField Extends GUIElement

This object will allow users to enter simple, single line textual information to the game.

Type GUIEvent

This is the parameter passed to the OnEvent method. This contains the ID of the object that triggered the event, as well as what action was performed.

I have a few other classes that I am planning to implement in the near future:

Type ParticleEffect Extends Effect

As I said before, I would like to implement a particle system to the framework. I often find myself using particle effects, so it would be beneficial to create a class that can automate this process.

Type Dialog

Again, I have already talked about this. This class with display a dialog over the top of a Scene to allow the display of information, or request a user response. I plan to make this pause the scene in the background, so it would be ideal for a Pause dialog or in game options menu.

Type DeltaSprite Extends Sprite

I haven't really had to consider delta timing in any of my projects yet, but I can see that it could be very useful for some games. I therefore plan to implement this soon, so that I have it in place when I need it. The DeltaSprite will not need as much processing from the scene object as it would handle movement and animation automatically, as well as the real-time velocity of the sprite.

No comments:

Post a Comment