SFML community forums
Help => Graphics => Topic started 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
-
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.
-
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".
-
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.
-
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...
-
There's a library for this kind of game: http://doryen.eptalys.net/libtcod/
-
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.
-
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.