Wintermute Engine Forum

Wintermute Engine => Feature requests, suggestions => Done => Topic started by: adonf on April 12, 2006, 11:28:24 AM

Title: Suspend / Restart rendering
Post by: adonf on April 12, 2006, 11:28:24 AM
I'd like to suggest a couple of script functions to stop rendering the scene for a while in order to have whole chunks of script execute in an atomic fashion.

Here's an example: if I update 50 script Objects in a loop like this myobject[ i ].Update(), the engine might suspend script execution to render the scene before each Update. If VSYNC WAIT is enabled (typically in full screen mode), then I could be waiting for up to 50 times the screen refresh time, and that's a lot ! And the worst part is that if the Update method doesn't draw anything on screen then all those 50 renders could produce exactly the same image...

Something like Game.StopRendering() / Game.ResumeRendering() would be nice. It might impact the physical FPS (expecially if VSYNC WAIT is disabled), but if used carefully it could help speed up script execution tremendously and thus the game logic.

Cheers,
 Olivier

Title: Re: Suspend / Restart rendering
Post by: Mnemonic on April 20, 2006, 07:44:22 AM
Ok, I added an attribute for suspending rendering. If it's going to be of any use remains to be seen.
Title: Re: Suspend / Restart rendering
Post by: adonf on April 20, 2006, 11:06:30 AM
Ok, thank you. I'll try it as soon as wme_latest.zip is back online and let you know if i'm getting any speed improvements...
Title: Re: Suspend / Restart rendering
Post by: Mnemonic on April 20, 2006, 03:25:16 PM
Could you please also check if the video card selection now remembers the right device on your dual-screen system?
Title: Re: Suspend / Restart rendering
Post by: adonf on April 21, 2006, 02:35:41 PM
http://dead-code.org/download/wme_latest.zip returns an error. Was it moved to another location ?
Title: Re: Suspend / Restart rendering
Post by: Mnemonic on April 21, 2006, 02:48:41 PM
There is no "wme latest" currently available. The latest release is 1.6 beta 3. I'll be probably releasing next beta with the rendering suspend thingie.
But the dual screen fix is already present in beta 3.
Title: Re: Suspend / Restart rendering
Post by: adonf on April 24, 2006, 10:05:32 AM
oooops, sorry
Title: Re: Suspend / Restart rendering
Post by: adonf on April 24, 2006, 01:38:23 PM
So I did a couple of test, and here's what I'm getting:

The screen settings are saved and read correctly, but there are still a few problems with dual screen:
- in windowed mode the game opens in the first screen, regardless of the screen that was selected
- in full screen mode the game opens in the correct screen but if the user selects the second screen then the mouse pointer is stuck in the first screen; alt-tabbing out of the game and back in moves the pointer into the correct screen
- when the game is run in windowed mode and the window is in the wrong screen, the frame rate gets very, very low. In my case the game runs at 400 FPS in one window and 20 in the other one (but that's a good thing in a way because it lets me test the game as if I had a super slow PC)

I also tested the SuspendedRendering flag and I got a 40% speed increase when running at 20 FPS (see point 3 above). This is good, but not as much as I expected, because when I remove all calls to custom methods i get a 300% speed increase. I need to look into that in details.

But anyway, it means that custom object methods do *not* need to be avoided at all cost in minigames, and that's a relief for me.

Cheers,
  Olivier
Title: Re: Suspend / Restart rendering
Post by: Mnemonic on April 24, 2006, 02:15:34 PM
1) dual screen
Yes, thanks. I did some research in the meantime so I'll be looking into improving the multimon support.
The framerate drop when you move the window to secondary monitor is by design (by *Windows* design, that is). The Direct3D device is always bound to a specific monitor. Even if you move the window to another monitor, it's still rendered by the original device and the resulting image is then copied to the other device, hence the slowdown.
But WME should originally position its window to the correct monitor.

2) SuspendedRendering
Errm, there must be some confusion going on, because it's not yet included in beta 3 (or any other publicly available build). It will be present in 1.6 beta 4. Although I could release some working version now, for your testing purposes, since wme.exe is once again in publishable state :)
Title: Re: Suspend / Restart rendering
Post by: adonf on April 24, 2006, 02:40:13 PM
Quote from: Mnemonic
2) SuspendedRendering
Errm, there must be some confusion going on, because it's not yet included in beta 3[...]

note to self: run more than one test before drawing conclusions  ;D
Title: Re: Suspend / Restart rendering
Post by: adonf on May 11, 2006, 11:57:39 AM
Hi Mnemonic,

I tried Game.SuspendedRendering with a version of the engine that actually supports it (1.6b4) and I'm happy to tell you that on a low frame rate (15-20) the the scripts for our minigame run almost ten times faster than before. That's even better than when I removed all calls to custom object methods and put all the functions in a single script file.

On very high frame rates (~440 fps) I still get a speed increase of about 100%...

Thanks for this feature !

Olivier