Sunday, 30 November 2014

Invisible But Substantial!

Here's an invisible but quite substantial update. There are 2 improvements regarding the player sprite sheet graphic.

1. Instead of loading 20 (1 for each player) textures into memory, the player sprites now all share the same texture.

2. Instead of having the team colors in the image, thus requiring a whole  new sprite sheet image for each different kit color, the sprite sheet is key coded and the colors are changed in-game via a palette system.

Next we need templates for different kit designs.

This will allow for changing/creating kits in game.

Implementation of the shared texture is rather trivial. We let the team own a shared texture object and simply point all player renderable textures to this.

For the color palette, we make a list of pairs indicating the old color (from png image) and the new color to replace it with. For example, replace all instances of RGB(255,0,0) with RGB(0,0,255). Add a pair for each of the shades of red, and this results in the above sprite sheet magically changing to a blue kit... w00t!

No comments:

Post a Comment