Graphics
From BSGame
| This article is a stub. You can help by expanding it. |
[edit] Graphics in BSGame
This library has gone through many graphic library conversions over the years. The project started on DirectX 7, then later moved to DX8, and is now in Managed DirectX. In addition to this, there is another two conversions of BSGame being developed. One is still in VB.NET and is moving to SlimDX, and another conversion is in C# and XNA. Because those conversions are not yet complete, this article will focus on the Managed DirectX version.
[edit] Textures
All image files used in any game is called a texture. BSGame in particular, uses many textures (read hundreds). Rather than using tilesets like many games, each individual texture is a separate file. These files are then packed together into a relevant texture "pack". Our texture packs are very basically similar to zip files (though very different at the same time). A pack contains many individual images in a very simple structure
- Image
- Name
- Size
- Image Data
- Dimensions
- Extra Info
The pack file is then encrypted and compressed. This makes our textures very small and efficient in loading and saving. The big hurdle with our texture packs is simply, they must be run through a converter anytime any change is made. The converter is very simple too, it takes a big texture, splits them into separate textures and then packs them together, and vice versa as well. However, a pack cannot be viewed through any normal editor and therefore must be run through the converter each and every time a change is necessary.
These texture packs also work differently than might be expected inside the actual library. Many games run through a tried and true (but utterly fail) method of Encrypt/Compress when including the file with the game, then when the game is run, Uncompress/Decrypt the file for reading, then Encrypt/Compress again to prevent stealing of artwork. While this works, it doesn't take a genius programmer to develop a utility that watches their HDD for changes when they run the game and simply make copies of the files or lock them from being deleted when they become available. Instead of this method, everything in the BSGame library is done in memory. Textures are uncompressed/decrypted in memory and then converted into a compatible DX texture all in memory. This is not only faster, but is slightly more secure.
[edit] Drawing techniques
As a given, BSGame does a lot of the drawing work for you. Each component is capable of drawing itself with little need of external methods. However, practically everything in BSGame is overridable. Examples can be found in the BSGame Example included with the Library.

