I've had a lot of problems with dynamic texts and I've been looking for a solution. I've just been wondering, for dynamic texts in the BGE, can I use .png files or not? What would I use? Thanks!
There are two methods to show dynamic text with the BGE.
They are easy to setup. You add the textobject, set the text in edit mode and start the game. Changing the text in game can be done via setting the attribute "text" in Python:
import bge textObject = bge.logic.getCurrentController().owner textObject.text = "my new text"
or if configured by setting a property called "Text":
The faces of the resulting object consists of several quads. The texture is rendered from an font while the game is running. You do no have access to the quads nor the textures.
This was the method before introducing the text objects (see above). A bitmap text object is a plain plane object.
You need a specific material setting Game Settings/enable Text:
Addional you need a special image as texture. It has meta informations regarding each single character encoded in the top line of the texture.
These data should never ever be changed. This also means you need an image format with lossless data compression such as .png or .tga (never jpg).
The UV mapping of the quad should fit the first character in the texture which is an @ character. This is the maximal bounding of an character. The BGE will derive the size of all other characters from this setting.
You can generate such textures with a tool called "FTBlender" from fonts of your OS. Alternative you can search the internet for bitmap text images.
This method allows you to manipulate the image of each single letter as long as you leave the metadata unchanged. This way you can get very artistic and colored characters.
I hope it helps
PS: here is a sample image- baloon.png: