Aren't Bitmap Fonts supposed to be quicker?

Blitz3D Forums/Blitz3D Programming/Aren't Bitmap Fonts supposed to be quicker?

Fry Crayola(Posted 2004) [#1]
Perhaps I've been doing it wrong. I have a single image (single frame) that contains all the letters I wish to use, and a type that stores the necessary data about where those letters are.

I then use DrawImageRect to draw the relevant letters to the screen.

In speed tests over 10000 iterations in comparison with just using Text, Text comes out on top, twice as fast as the other. And as an added plus, I can use whatever colour I want on it.

Normally, I'd just shrug and use Text, but I'm thinking it could just be that my computer can handle the text drawing operations better, and that others might see slowdown. I've no other system to hand to check this.

Am I doing anything wrong with bitmap fonts, or is it just a quirk of the computer?


GfK(Posted 2004) [#2]
Normally, I'd just shrug and use Text, but I'm thinking it could just be that my computer can handle the text drawing operations better, and that others might see slowdown. I've no other system to hand to check this.
The Text command is spectacularly slow on some systems. I seem to recall a particular problem with Nvidia cards about a year or so ago. Any use of the Text command would slow the game down to 1fps - even if the code was doing nothing but printing text.

I think DrawImageRect is pretty slow and isn't the best solution. Load the characters as an AnimImage instead, and just use 'Drawimage image,x,y,frame'.


Genexi2(Posted 2004) [#3]
Try using the letters of your bitmap font, and store whatever the text is using those letters into a new image inside of Blitz and draw that instead, it'll be faster since it needs to blit the single image onto the screen instead of each individual letter.


Fry Crayola(Posted 2004) [#4]
Yeah, but it has to put those individual letters into that new image. Which would take the same length of time as drawing it to the screen.


Rob Farley(Posted 2004) [#5]
Also, if you can get away with it, use drawblock instead of drawimage, you don't get a transparant colour, however, it's a shed load faster.


Fry Crayola(Posted 2004) [#6]
Need the transparent colour, I'm afraid. I'll have to give that AnimImage a go.


Gabriel(Posted 2004) [#7]
You posted this in Blitz3d, but does that mean you're making a 3d game? If so, most people will recommend not combining 2d drawing operations with 3d drawing operations. If it's a 2d game using only the 2d commandset of Blitz3d, ignore me ;)


Fry Crayola(Posted 2004) [#8]
It's a 3D game in as much as it uses the 3D commands of Blitz to generate 2D effects in a single surface system.

I want to use the added 3D features such as lighting, transparency, and so forth.


Rob(Posted 2004) [#9]
www.playerfactory.co.uk --- try fontext, it comes with libs for Blitz3D.

It's the fastest font system I have used in Blitz as well as the most attractive looking.

It has libs for 2D and 3D...


Rook Zimbabwe(Posted 2004) [#10]
I used BMPFont the free version for my 3D game with 2D font letters... no noticible lag in gameplay even on an old Compaq Prosigna 150 running W2k.

-Z


jhocking(Posted 2004) [#11]
If you're doing a 3D game then try to avoid using 2D commands. Mixing up 2D and 3D commands slows things down a lot. Bitmap fonts in 3D are done by using the font bitmap as a texture on quads displaying the text. I recommend FONText too, but there are some free 3D bitmap font systems which are pretty good; I think Rook's suggestion of BMPFont one of those.


Caff(Posted 2004) [#12]
FONText gets my vote too, very fast + easy to use libs.


Boiled Sweets(Posted 2004) [#13]
I also used a mix of 2d/3d fonts with BMPFont with no slowdown on a GeForce 4 MX (quite an old card), running 1024*768*32. Runs at 85 FPS fine.

Personally I think these modern cards (with decent drivers) don't suffer too much with slowdown when mixing a bit of 2d with 3d.