- Scaling Systems -

When designing a game, a central concern to you is how objects should be represented in your variable structures for the game world. Choosing to use a scaling system presents you with greater flexibility when you manipulate this game world.

The basis behind a scale system can be best explained with reference to 2D games (3D games inherently have some scale system). For example, imagine a program which moves a sprite object left or right when the controller is pressed.

The most intuitive way to do this would be to alter the sprite's screen co-ordinate by 1 pixel for each movement iteration. Alternatively, implementing a scaling system would allow you to move the sprite by fractions of pixels. Instead of the sprite's co-ordinates being represented in screen co-ordinates (eg. a value of 0-319), the scaled representation values would be much larger than this (eg. a value of 0-{319*4096}, where 4096 is the scale factor). The scaled value is only converted to a screen co-ordinate at the screen control level (i.e. the sprite co-ordinate is set as the scale co-ordinate divided by the scale factor). At all other times, the scale co-ordinate is the only manipulated variable.

Choosing a representation like this presents flexibility which may be harnessed in a number of ways.

You may set up subtle speed differences between world objects:
Altering the players position by a certain value and altering a chasing enemy's position by 1.2*player_movement, will allow an enemy to gradually gain on the player.
Screen objects can be gently accelerated or deccelerated:
Subtly increasing the player's movement speed when a button is pressed and decreasing the speed when a button is not pressed will give this impression. Splitting the movement speed into X and Y vectors and applying acceleration and deceleration to these will give an impression of inertia.
Analogue controllers may be easily implemented:
Returned values from analogue controllers are typically on an integer scale (eg. -127/+127). This returned value can be multiplied by the greatest desired pixel increase (eg. 2 pixels per function iteration), then multiplied by the scale factor (eg. SCALE=64). Dividing this finally by the effective analogue range (eg. 127 in this example) returns the value that the object map co-ordinates should be altered by. With these example values, an analogue stick value of +1 will return a map increase of +1 (1/64th of a pixel). Although this increase will not be immeadiately apparent, after 64 iterations the object will have moved accurately according to the desired scales.
Scale systems may, of course, be applied to many aspects of a world object. For example, if your rotation lookup tables are at a resolution of 4096, having a rotation scale system larger than this allows you to produce more variety in rotation speeds.

The implementation of scale systems is partially necessary to compensate for the lack of floating point maths (i.e. fractional) in the Playstation. However, it is likely that scale systems will be a faster alternative to floating point maths for most hardware.

http://www.netyaroze-europe.com/~mrfrosty