The best way for game text?

Blitz3D Forums/Blitz3D Programming/The best way for game text?

Boiled Sweets(Posted 2003) [#1]
Hi,

what is the best way to display game text? Obviously the TEXT command is too slow. Some people have said using bitmaps for the text but what if I want to change it i.e. "Level 1" etc...

I have tried the GG_3D_Text_Library but with that I cannot set the EntityOder for a text entity to -1, says its not a camera or model so it gets drawn too far 'into' the z-plane.

I have tried the spritecontrol library but I use a camera with a zoom of 0.6 and that HAS to have a camera with zoom 1 or greater!

ARRGHH! How the hell do I do it? Surely someone has cracked this simple problem so that it works...

Thanks.


Sunteam Software(Posted 2003) [#2]
EASY - draw your text as the last layer. i.e. render your 3D scene then draw your 2d images on top with standard 2d drawing commands. As for changing text you load in an image which contains all the letters for your font in a row and equally spaced apart with equal width and height. Then just copyimage the appropriate letter from the loaded letters image to the backbuffer after your 3D render.

Hope that makes sense.


poopla(Posted 2003) [#3]
I would avoid mixing your 2d and 3d drawing as much as possible for speed optimisation. But it comes down to how much work ya want to do.


Boiled Sweets(Posted 2003) [#4]
Dev,

so how do you draw text using 3d commands?

I don't have that much to do just some game info, level, score and perhaps a timer type bar...

Sunteam,

do you have any sample code?


IPete2(Posted 2003) [#5]
Dweezil,

Search out Sswifts fonts and gui functions - this way is the way to go for optimised text on screen.

IPete2.


Boiled Sweets(Posted 2003) [#6]
Ipete2,

http://home.earthlink.net/~sswift/guidemo.zip

the link doesn't work and to use it in a commerial game cost $100. Surely there is a simple way? Is CreateSprite slow?


GfK(Posted 2003) [#7]
Get FONText. It costs less than £10 and does everything you're asking for, plus more besides.


Boiled Sweets(Posted 2003) [#8]
Gfk,

but whats wrong with CreateSprite? Is it considered too slow for text? OK so I have to create my font but..


Boiled Sweets(Posted 2003) [#9]
and FONText doesn't work - says missing HUDinclude.bb

And what is it supposed to do? Just create a bmp with the font? Then what use CreateSprite?

HELP!


Beaker(Posted 2003) [#10]
I can assure you that FONText does work. Which version are you using?

If you have a missing file it is presumably because you have downloaded the demo version and not actually bought it.


Boiled Sweets(Posted 2003) [#11]
MasterBeaker I downloaded the free version and the demo. The free one lets me create a bitmap of the font. Then what? How do I use it in B3D? Sorry if this is a silly question.

The FTDEMO version is 1.5 - if I go to the characters tab and only select numerics I get all sorts of other characters too - is that right?


ChrML(Posted 2003) [#12]
Well, my rules for the order is:

1. FPS Limitor
2. Input
3. Collission check
4. 3D Render
5. 2D Images/forms
6. Draw Text onto screen in/outside forms
7. Flip


jfk EO-11110(Posted 2003) [#13]
Hey, you can use a simple Quadbased Mesh for the Text. Build a single Surface Text System, that's pretty simple. Use a Bitmap that contains all required Characters. Build a Mesh that contains the Max. Number of Characters you want to use for Text Output as Quads, one Quad has 2 Triangles, Example:

_________________
¦/¦/¦/¦/¦/¦/¦/¦/¦

Now when you want to write some Text simply use VertexTexCoords() to assign the Quads to the right Characters on the Texture.

So when you write a Text with 500 Chars then it might use 1000 Polygons. Of course this Mesh sould be positioned in front of the Camera. You can use any Alpha- or Mask Mode, or even better: Blending Modes using Multiply aso.

Note: such 3D based Text is always a bit blurred, especially in low screen-resolutions. It's nice for a Hand full of chars, but not so usefull for tons of text.

Goodies: Fade in/out using alpha, Zoom in /out, rotate, explode it, whatever you want.


Beaker(Posted 2003) [#14]
The *demo* version of FONText only gives you random characters to preview.


SabataRH(Posted 2003) [#15]
If done properly, theres no speed hit when using 2d text commands over 3d renderings... You'll find when using 3d for 2d text you'll run into these problems, blurred text due to mipping, placement disorder due to configurable screen resolutions, jumping/popping; if you use any form of frame tweening.. and the list goes on.

Most current video cards arent effected by 2d commands, and quite frankly when i design a game im designing around features that current hardware will support. Save yourself some time and forget about 3d text, in the long run its not worth it.


jfk EO-11110(Posted 2003) [#16]
>>placement disorder due to configurable screen resolutions<<

Well, that's a problem that arises mostly with 2D Content, and not in 3D, right?

As I said before, it isn't a good Idea to use 3D Text for large Messages. But it will give you definitively cool FX Options such as Rotate and Zoom with one or two lines of code and no slowdown. Maybe you are right that 2D on 3D (especially Drawimage) isn't slow on most Systems, but it also has some drawbacks, like Un-anialiased Contours, no Semitransparence and more.