Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Suggestion: Create Rendering thread and UI thread.  (Read 889 times)

profit

  • Bay Watcher
  • Finely Crafted Engravings... Or it didn't happen.
    • View Profile
Suggestion: Create Rendering thread and UI thread.
« on: December 25, 2008, 02:25:53 pm »

Playability would increase if the rendering and the user interface were done by separate threads so that no matter how much simulation and pathfinding was being done, the rendering and user interface could remain responsive.

This would help single and multicored machines but the people with multicored processors would probably feel the most benefit, as the user interface would NEVER lag and the fps would NEVER fall.    The game itself would still be slow as the simulation ground to a halt on larger forts, but the game would accept keystrokes and commands in a crisp and snappy fashion.

This would eliminate the up/down Z level change jumping more than one level on keypress and laptops with their slower speeds having erratic input that makes it appear you hit the key 4 times.

This may also give the users of multicored processors a tiny amount of speed increase, but the real value would be on the presentation of the program.

Logged
Mods and the best utilities for dwarf fortress
Community Mods and utilities thread.

Draco18s

  • Bay Watcher
    • View Profile
Re: Suggestion: Create Rendering thread and UI thread.
« Reply #1 on: December 25, 2008, 04:09:39 pm »

DF already does this.  I've seen as many as seven OGL threads.
Logged

profit

  • Bay Watcher
  • Finely Crafted Engravings... Or it didn't happen.
    • View Profile
Re: Suggestion: Create Rendering thread and UI thread.
« Reply #2 on: December 25, 2008, 08:46:31 pm »

I am betting the openGL API is doing it.  The actual render loop in the program which sends the data to the API does not appear to be.  If it was FPS would be simulation speed agnostic. :o

Logged
Mods and the best utilities for dwarf fortress
Community Mods and utilities thread.

Qloos

  • Bay Watcher
    • View Profile
Re: Suggestion: Create Rendering thread and UI thread.
« Reply #3 on: December 25, 2008, 08:59:25 pm »



What?
Logged

CobaltKobold

  • Bay Watcher
  • ☼HOOD☼ ☼ROBE☼ ☼DAGGER☼ [TAIL]
    • View Profile
Re: Suggestion: Create Rendering thread and UI thread.
« Reply #4 on: December 25, 2008, 09:18:54 pm »

I am betting the openGL API is doing it.  The actual render loop in the program which sends the data to the API does not appear to be.  If it was FPS would be simulation speed agnostic. :o
Except the "FPS" counter in DF is simulation "frames" per second, not display frames. How many time quanta are simulated in a given real second, if you will.

(Psst. He means that display speed would be independent/not care how fast sim was running)
Logged
Neither whole, nor broken. Interpreting this post is left as an exercise for the reader.
OCEANCLIFF seeding, high z-var(40d)
Tilesets

profit

  • Bay Watcher
  • Finely Crafted Engravings... Or it didn't happen.
    • View Profile
Re: Suggestion: Create Rendering thread and UI thread.
« Reply #5 on: December 26, 2008, 06:23:42 am »

I am betting the openGL API is doing it.  The actual render loop in the program which sends the data to the API does not appear to be.  If it was FPS would be simulation speed agnostic. :o
Except the "FPS" counter in DF is simulation "frames" per second, not display frames. How many time quanta are simulated in a given real second, if you will.

(Psst. He means that display speed would be independent/not care how fast sim was running)
You are right in that I am not exactly sure what the "frames per second" counter does count*, but it's immaterial as the user interface bogs down with the program and makes it act like you have tar under your keys as you press them.

* time to fire up fraps to get a real count.
Logged
Mods and the best utilities for dwarf fortress
Community Mods and utilities thread.

Mikademus

  • Bay Watcher
  • Pirate ninja dwarves for great justice
    • View Profile
Re: Suggestion: Create Rendering thread and UI thread.
« Reply #6 on: December 26, 2008, 09:36:35 am »

Could we PLEASE see a stop to all the threads requesting multi-threading? Had you searched you would have seen this brought up quite a few times already... You want to discuss the topic more necro an existing thread! :sigh:
Logged
You are a pirate!

Quote from: Silverionmox
Quote from: bjlong
If I wanted to recreate the world of one of my favorite stories, I should be able to specify that there is a civilization called Groan, ruled by Earls from a castle called Gormanghast.
You won't have trouble supplying the Countess with cats, or producing the annual idols to be offerred to the castle. Every fortress is a pale reflection of Ghormenghast..

Draco18s

  • Bay Watcher
    • View Profile
Re: Suggestion: Create Rendering thread and UI thread.
« Reply #7 on: December 26, 2008, 11:47:50 am »

I am betting the openGL API is doing it.  The actual render loop in the program which sends the data to the API does not appear to be.  If it was FPS would be simulation speed agnostic. :o
Except the "FPS" counter in DF is simulation "frames" per second, not display frames. How many time quanta are simulated in a given real second, if you will.

(Psst. He means that display speed would be independent/not care how fast sim was running)
You are right in that I am not exactly sure what the "frames per second" counter does count*, but it's immaterial as the user interface bogs down with the program and makes it act like you have tar under your keys as you press them.

* time to fire up fraps to get a real count.

Or open up your init file and find your GFPS setting.
Logged

profit

  • Bay Watcher
  • Finely Crafted Engravings... Or it didn't happen.
    • View Profile
Re: Suggestion: Create Rendering thread and UI thread.
« Reply #8 on: December 26, 2008, 12:56:07 pm »

Could we PLEASE see a stop to all the threads requesting multi-threading? Had you searched you would have seen this brought up quite a few times already... You want to discuss the topic more necro an existing thread! :sigh:

Those threads mostly deal with multicore support.  While multicore support requires multithreading, multithreading does not by itself make a program take advantage of multicored proccessors.   Breaking off a UI thread from the main loop is nothing like making Mutex's, stopping Loop-carried Dependence, and preventing Data-race Conditions for multi-cored support.  (While fairly easy to do, it requires a significant change in programming style)

And the reason I said that I was going to use FRAPS draco18s is because according to information you quoted in that message he said that the real frames per second is different that what is reported.

But I just checked and FRAPS reports frames per second matching Dwarf fortress so indeed the render loop is embedded inside the simulation loop and NOT a separate thread no matter if their are 7 openGL threads or not.
Logged
Mods and the best utilities for dwarf fortress
Community Mods and utilities thread.