SFML community forums

Help => Graphics => Topic started by: Pixel_Outlaw on February 20, 2011, 07:57:20 am

Title: My fake Text console is pretty slow...
Post by: Pixel_Outlaw on February 20, 2011, 07:57:20 am
I've been thinking about making one of those text only games. I want to mimic the early DOS games where everything is made of text. I thought SFML would be a good choice as it handles graphics and user input. I want a text buffer of 64 characters across by 48 characters down. I have it working but as you can see from the FPS display I'm getting less than 20 frames per second.

Here is a picture of a randomized output....

This display is like ANSI. Each character in the window should have a background color and a foreground color.

(http://img34.imageshack.us/img34/2977/patchwork.png)

Here is my entire source...
http://www.filedropper.com/copyofsfmlconsole
Title: My fake Text console is pretty slow...
Post by: Laurent on February 20, 2011, 10:23:09 am
Unfortunately SFML shows its limits with this kind of drawing. There's probably not much you can do, unless you did a stupid mistake (like benchmarking in debug mode or using outdated graphics drivers).

You can also switch to SFML 2 if you want improved performances.
Title: My fake Text console is pretty slow...
Post by: Groogy on February 20, 2011, 12:09:14 pm
I'm guessing he's running in debug. It's common to miss. We do it all the time at the University when we want to benchmark and then realize "Aaaah damn I forgot to change to release".
Title: My fake Text console is pretty slow...
Post by: Nexus on February 20, 2011, 01:33:23 pm
Sometimes, it's not even enough to change to release configuration. For example, you may have to deactivate the debug runtime, too (in MSVC "start without debugging"). If you use the STL a lot, disabling security features like checked iterators or indices in release mode is another option.
Title: My fake Text console is pretty slow...
Post by: Pixel_Outlaw on February 21, 2011, 01:11:08 am
Thanks for the responses.

Would the SFML binding of OpenGL be worth looking into for this? I'd like to ask before I start because OpenGL has a habit of making simple things overly drawn out...

I really wonder how old systems were made to handle this kind of thing yet modern ones struggle...
Title: My fake Text console is pretty slow...
Post by: bastien on February 21, 2011, 05:46:18 am
There's a library for this kind of game: http://doryen.eptalys.net/libtcod/
Title: My fake Text console is pretty slow...
Post by: Groogy on February 21, 2011, 08:46:58 am
Quote from: "Pixel_Outlaw"
Thanks for the responses.

Would the SFML binding of OpenGL be worth looking into for this? I'd like to ask before I start because OpenGL has a habit of making simple things overly drawn out...

I really wonder how old systems were made to handle this kind of thing yet modern ones struggle...


Did you even try running the application in release mode or without a debugger at all like we said? Would be nice to know if it helped.
Title: My fake Text console is pretty slow...
Post by: Pixel_Outlaw on February 21, 2011, 09:18:56 am
Yes, I did with very similar results.
I'm using Code::Blocks running in release mode.

If you wish to test it for yourself, I have posted a link to my code and sprite there in the first post. I am using an older computer.

I'll admit that I don't know a lot about Code::Blocks but did my best to configure it for both debug and release modes according to the SFML tutorial.


ALSO,

I've found that I can draw 60, 80 character monochrome strings with acceptable results. I may just skip the colored text option. The problem then becomes getting a pixel perfect font that is 8x8 characters like the old DOS windows.

This is less than ideal but I suppose it will have to do since drawing thousands sprites is so darn taxing.