Larian Banner: Baldur's Gate Patch 9
Previous Thread
Next Thread
Print Thread
Page 1 of 2 1 2
#121151 15/10/03 09:45 AM
Joined: Jun 2003
apprentice
OP Offline
apprentice
Joined: Jun 2003
<img src="/ubbthreads/images/graemlins/div.gif" alt="" /> is pretty greedy. It refuses to gracefully share CPU time with other programs - it has a complete tantrum if I alt+tab out. What are the chances <img src="/ubbthreads/images/graemlins/riftrunner.gif" alt="" /> will be a little more sharing?

#121152 15/10/03 10:15 AM
Joined: Mar 2003
Location: Belgium
veteran
Offline
veteran
Joined: Mar 2003
Location: Belgium
it's not only <img src="/ubbthreads/images/graemlins/div.gif" alt="" /> but a lot of other games to, it's called the "Message pump" only used in games, i continiously polls the system for messages and if there are none, then it performs calculations which are very intense for the CPU.

BUT, you could implement a "active" state in the game and if the game is not active, the the message pump switched to a normal polling mode.


Viper
#121153 15/10/03 10:52 AM
Joined: Mar 2003
Location: Netherlands
addict
Offline
addict
Joined: Mar 2003
Location: Netherlands
Message pumps are an inherent (SP?) part of any Windows program with a GUI. Besides the problematic issues related to ALT-TABbing out, Divinity just runs at a too high priority after doing that, which causes the scheduler to grant Divinity too many processing time which is wasted anyway. It is a pre-emptive scheduler, so the one wiht the highest priority wins the battle of gaining CPU time.
Most likely it does that because running at a below normal priority would cause it to be too unstable.

Last edited by Myrthos; 15/10/03 10:52 AM.

See me @ The Locus Inn & RPGWatch
#121154 15/10/03 11:14 AM
Joined: Mar 2003
A
veteran
Offline
veteran
A
Joined: Mar 2003
Apart from that, I generally suggest NOT to switch to other processes (programs, that is) while playing resource-hungry games.


When you find a big kettle of crazy, it's best not to stir it.
--Dilbert cartoon

"Interplay.some zombiefied unlife thing going on there" - skavenhorde at RPGWatch
#121155 15/10/03 11:17 AM
Joined: Mar 2003
Location: Belgium
veteran
Offline
veteran
Joined: Mar 2003
Location: Belgium
it has nothing ot do with priority, it's just that there a message pumps for 'regular' windows apps and there is a specific pump for games.
games use the PeekMessage function to see if there are messages, if there are, then it handles them and continues with what it was doing which is intensive math and game related functions. 'regular' apps do not need to do all that in between so that's why a gamne is always almost using 100% of your cpu and apps not. if you make a math intensive app, it can also use 100%.

a game calculates a frame, peeks for messages and continues to the next frame.


Viper
#121156 15/10/03 11:43 AM
Joined: Mar 2003
old hand
Offline
old hand
Joined: Mar 2003
Someone's been doing his homework <img src="/ubbthreads/images/graemlins/think.gif" alt="" /> <img src="/ubbthreads/images/graemlins/winkwink.gif" alt="" />


Mr Kej, Second Member of the Guild of Off-Topic Posters *** Visit Aviorn's Inn, my Divine Divinity fansite ***
#121157 15/10/03 07:38 PM
Joined: Mar 2003
Location: Netherlands
addict
Offline
addict
Joined: Mar 2003
Location: Netherlands
Viper, I've been programming multitasking applications for nearly a decade now on various platforms. On a pre-emptive multitasking operating system, the program with the highest priority has the CPU. It has to 'release' the CPU to other apps by going into an idle mode (normally accomplished by waiting for an event). Windows default behaviour is to automatically boost the priority of a program in the forground and to reduce the priority of the program in the background.

A game can be as time consuming and power hungry as it wants. As long as there is an app wanting to do something at a higher priority, the game stops, regardless of how many messages there are.

As games normally run in Full Screen DirectX mode it's the forground application. To increase performance the thread it runs in is normally boosted to a high priority. When pressing ALT-TAB, the game should switch itself to a lower priority to not interfere with what you want to do in Windows. If not then it keeps on doing useless things.


See me @ The Locus Inn & RPGWatch
#121158 15/10/03 07:44 PM
Joined: Mar 2003
Location: Belgium
veteran
Offline
veteran
Joined: Mar 2003
Location: Belgium
that's true, but I just wanted to explain that the high CPU usage is not the priority alone, it's normal that apps with higher priority get more CPU time than others, but usually, in like 99% of the cases a normal does NOT need a lot of CPU time, when working normally with windows (word, ...) the CPU is on like 2% maybe, only when you do sth, like start an application up of compile one (for the developpers under us) the CPU goes up.

I think we're both right but I just explained the diff. between a game and a regular app <img src="/ubbthreads/images/graemlins/winkwink.gif" alt="" />


Viper
#121159 15/10/03 07:52 PM
Joined: Mar 2003
A
veteran
Offline
veteran
A
Joined: Mar 2003
What I never understood, was, why games never show the windows around them ... I mean the title and this stuff.


When you find a big kettle of crazy, it's best not to stir it.
--Dilbert cartoon

"Interplay.some zombiefied unlife thing going on there" - skavenhorde at RPGWatch
#121160 16/10/03 04:09 AM
Joined: Mar 2003
veteran
Offline
veteran
Joined: Mar 2003
That's bevcause they are "full-screen applications". If you press F11 in Internet Explorer, it changes to full-screen mode as well. The window borders are just standard graphics libraries that most applications access and apply.

#121161 16/10/03 06:37 AM
Joined: Mar 2003
Location: Belgium
veteran
Offline
veteran
Joined: Mar 2003
Location: Belgium
true, but in games there CAN be implemented a windowed mode


Viper
#121162 16/10/03 07:32 AM
Joined: Mar 2003
Location: Netherlands
addict
Offline
addict
Joined: Mar 2003
Location: Netherlands
Games run in full screen DirectX. There are two modes of DirectX, which are windowed and full screen.
The first is used when you want to display somethhing fast in a window (like DVD and other media players).
In full screen DirectX mode there is no Windows GUI, it's not that the borders, menu and such are hidden. They simply don't exist. This is a difference from 'normal' windows apps that run in full screen mode. Here the menus, borders etc. are just hidden but still exist.


See me @ The Locus Inn & RPGWatch
#121163 16/10/03 08:56 AM
Joined: Mar 2003
A
veteran
Offline
veteran
A
Joined: Mar 2003
Meaning if I would program my own browser using directx , it would be full screen as well ? <img src="/ubbthreads/images/graemlins/silly.gif" alt="" />


When you find a big kettle of crazy, it's best not to stir it.
--Dilbert cartoon

"Interplay.some zombiefied unlife thing going on there" - skavenhorde at RPGWatch
#121164 16/10/03 10:25 AM
Joined: Jun 2003
apprentice
OP Offline
apprentice
Joined: Jun 2003
Well, I've played a couple of other fairly memory/CPU intensive games that don't repeatedly flash and resize when I alt + tab out, so I'm fairly confident it must be possible. Icewind Dale 2, for example, LOVES it when I alt + tab out.

#121165 16/10/03 10:48 AM
Joined: Mar 2003
Location: Belgium
veteran
Offline
veteran
Joined: Mar 2003
Location: Belgium
the reason for this COULD be the following: when ALT-TABbing, DirectX loses it's device that it needs to draw, that is because an other app also uses the videocard and overwrites some of it's videomemory.
thus when you go back to the game, it's almost like restarting it but with the difference that you already got a game 'window' and I don't know how everything gets reloaded in <img src="/ubbthreads/images/graemlins/div.gif" alt="" /> so that it causes the flashes, but all resources DO have to be reloaded and such. some games handle it better than other <img src="/ubbthreads/images/graemlins/winkwink.gif" alt="" />


Viper
#121166 16/10/03 11:15 AM
Joined: Mar 2003
Location: Netherlands
addict
Offline
addict
Joined: Mar 2003
Location: Netherlands
Quote
Meaning if I would program my own browser using directx , it would be full screen as well ? <img src="/ubbthreads/images/graemlins/silly.gif" alt="" />

No, it can be either.


See me @ The Locus Inn & RPGWatch
#121167 16/10/03 12:13 PM
Joined: Mar 2003
old hand
Offline
old hand
Joined: Mar 2003
When Windows programming was in the beginning (and DirectX was not available/unusable), quite some games were made that run in a window. Those games are really annoying, as they run in 640x480 (the standard resolution back then), or less, but today they cover only so small an amount of the screen, that they're almost unplayable.
BTW, The LEDWars does have the blue title bar, and the menu bar, but no border. That's something I have seen with some games, but never with applications.


"In jedem Winkel der Welt verborgen ein Paradies"
#121168 16/10/03 10:35 PM
Joined: Mar 2003
veteran
Offline
veteran
Joined: Mar 2003
I have seen some games ALT+Tab very effectively. StarTopia will ALT+Tab fine from the menus. When you return to the game, it spends a minute or two to re-initialise the graphics card for it's purpose. Being a very graphically intensive game (many modern computers still can't run it at it's highest quality!) it makes sure that it has what it needs set up accurately. The wait is a pain, but it's a lot less than the start-up load time, and it's reliable!

#121169 26/10/03 12:30 PM
Joined: Sep 2003
journeyman
Offline
journeyman
Joined: Sep 2003
I'm coming a bit late to this discussion, but what the hell:

Quote
On a pre-emptive multitasking operating system, the program with the highest priority has the CPU. It has to 'release' the CPU to other apps by going into an idle mode (normally accomplished by waiting for an event).


This isn't true - it WOULD be true of a cooperative multitasking system, but not of a preemptive one. You can verify this by writing a program that just sits in a loop. You can still alt-tab away from such a program, which proves that the operating system can preempt a running thread that is in a loop. The "preemptive" name tag means that the OS will do exactly that.

Having said that, there is room for improvement for Riftrunner over DivDiv. Many games take very low CPU (<3%) when tabbed out.

Mind you, it isn't such a problem nowadays with XP and a hyperthreaded P4. If I alt-tab out of DivDiv, it sits there taking exactly 50% of the cpu, something which I assume is achieved using Intel's much-vaunted hyperthreading.

#121170 26/10/03 09:58 PM
Joined: Mar 2003
veteran
Offline
veteran
Joined: Mar 2003
The thing is that it shouldn't be taking much CPU time at all. The game should detect the ALT+TAB and freeze the game. There's no need for it to run anything apart from an ALT+TAB detecter. When you ALT+TAB back in, it should also recover all of it's resources properly and restore any damaged ones. The sound always corrupts for about five minutes after I ALT+TAB back into the game.

Page 1 of 2 1 2

Moderated by  Larian_QA, Lynn, Macbeth 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.5