Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: My fake Text console is pretty slow...  (Read 2597 times)

0 Members and 1 Guest are viewing this topic.

Pixel_Outlaw

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
My fake Text console is pretty slow...
« 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.



Here is my entire source...
http://www.filedropper.com/copyofsfmlconsole

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
My fake Text console is pretty slow...
« Reply #1 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.
Laurent Gomila - SFML developer

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
My fake Text console is pretty slow...
« Reply #2 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".
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6278
  • Thor Developer
    • View Profile
    • Bromeon
My fake Text console is pretty slow...
« Reply #3 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.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Pixel_Outlaw

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
My fake Text console is pretty slow...
« Reply #4 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...

bastien

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • http://bastien-leonard.alwaysdata.net
My fake Text console is pretty slow...
« Reply #5 on: February 21, 2011, 05:46:18 am »
There's a library for this kind of game: http://doryen.eptalys.net/libtcod/
Check out pysfml-cython, an up to date Python 2/3 binding for SFML 2: https://github.com/bastienleonard/pysfml-cython

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
My fake Text console is pretty slow...
« Reply #6 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.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Pixel_Outlaw

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
My fake Text console is pretty slow...
« Reply #7 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.