Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
mgr_inz_rafal

[GZDoom] Keep the game active in windowed mode, when in background

Recommended Posts

Hello,

How to keep GZDoom running in windowed mode in a background (non-active) window? Currently, when I switch to other app then GZDoom freezes...

 

I tried "-noidle" param but without luck.

Share this post


Link to post

When you have GZDoom open in windowed mode and then open another app, GZDoom will loose focus.

So, the only thing you can do is switch from one to the other and back.

 

The only app which will keep GZDoom running is something like a recording app to record the game.

Share this post


Link to post

It's ok that the game loses focus, but I would like, for example, monsters to continue chasing the player, even if the window is in background.

Share this post


Link to post

That... would kind of suck. Like, what if the window lost focus for some reason, and by the time you came back to the game, you were a corpse on the floor?

 

Personally I can't stand it when I can't pause a game. People got lives, yo. And sometimes you just need to get up to get a drink or deal a deuce or something. 

Share this post


Link to post

@Dark Pulse, judging by your answer it seems that I didn't make my intention clear :)

 

That would definitely not suck in my case. For the tool I currently develop I simply need GZDoom to keep running while it stays in the background. It seems there is no easy solution for this I'll try to modify GZDoom myself. I'll post the solution here if I find one :)

Share this post


Link to post

Well, if you don't mind my asking, what could you possibly need that would mandate it running, unpauseable, in the background?

 

Short of an always-online game mode, or some sort of extreme challenge mod, I don't see what really would require it.

Share this post


Link to post

Sure I don't mind.

Please see the video below. I am creating a tool that runs in separate process and controls the DoomGuy. The tool is intended to run on other PC and control the game via network, but for debug purposes I run it on the same PC as Doom game, but in separate window. I'd like the game to remain active and react to commands even if I have other windows focused.

 

To achieve that I added the "-active_in_background" parameter to the GZDoom.exe and modified the following code:

 

	case WM_ACTIVATEAPP:
		if(!active_in_background)
		{
			AppActive = wParam == TRUE;
			if (wParam)
			{
				SetPriorityClass (GetCurrentProcess (), INGAME_PRIORITY_CLASS);
			}
			else if (!noidle && !netgame)
			{
				SetPriorityClass (GetCurrentProcess (), IDLE_PRIORITY_CLASS);
			}
			S_SetSoundPaused ((!!i_soundinbackground) || wParam);
		}
		break;

 

And here's the video:

 

 

Share this post


Link to post

@boris it's a little bit too late, but thanks anyway. It's good to know.

 

On the other hand, if I use the mentioned "cvar" the game gets "PAUSED" when the focus leaves the window. So it's kinda active, but not really active :)

Share this post


Link to post
10 minutes ago, mgr_inz_rafal said:

On the other hand, if I use the mentioned "cvar" the game gets "PAUSED" when the focus leaves the window. So it's kinda active, but not really active :)

Indeed, not what you'd expect at all. I played around a bit, and apparently vid_activeinbackground is for updating the windows, and not for the game logic (what actually makes sense in regards to the cvar name). If you set i_soundinbackground to true, then the game logic will keep running. But if you have i_soundinbackground true and vid_activeinbackground false you won't see what's going on, because the screen doesn't get updated. So you'll have to set both i_soundinbackground and vid_activeinbackground to true.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×