Jump to content
The Dark Mod Forums

Possible To Assign A Hotkey To Start Doom 3 In Background?


Recommended Posts

Hey Orb, I think I suggested this to you a long time ago, but I was wondering if now might be a good time to look into it.

 

Not having direct access to doom 3 in Dark Radiant is a bit of a hassle, so I was wondering if we could work around this by somehow assigning the Doom 3 default F2 key, to basically pass this command to the doom 3 executable?

 

com_allowConsole 1 +set r_fullscreen 0 +set r_brightness 1 +set r_contrast 1 +set fs_game darkmod

 

DarkRadiant would somehow have to check where the executable is, based on the players setup preferences, and then pass the command to it.

 

Not sure if that would be hard, or if it's even possible, but if it's not too much work to do...perhaps we should think about getting it in there right away, just to give the editor a feeling of being connected...and just provide faster access to it as well. :)

Link to comment
Share on other sites

Do you mean whenever the F2 key is pressed, a copy of the Doom 3 executable will be spawned in the background?

 

What happens when the key is pressed multiple times -- will multiple copies of Doom 3 start up? Does Doom 3 intelligently reuse instances of the game if you try to start more than one copy?

Link to comment
Share on other sites

I don't think that this is a good idea. Fact is that Doom 3 takes a helluva lot of time to start. Most people will have a copy running in the background anyway. F2 makes sense when the engine is already loaded and you just have to pop the window in the front. Running Doom 3 with F2 is a pretty useless idea IMO. What you MIGHT do though is, to check wether D3 is already running, and then bring it to the front, but I don't think that you can pass parameters at this point. Probably not. Or we might be able to hack in an observer that checks wether D3 has been popped in front and if so use a pipe or some other mechanism to get the data and run the map. That might work (or not).

Gerhard

Link to comment
Share on other sites

I tend to agree that just launching the game is probably not all that valuable, although bringing it the front might be (if this can be done, it would certainly be Windows-specific but it may be possible).

 

It would be good if there was some way to pass commands to a running D3 executable, because then we could put a Build option in which would just call "dmap <mapname>" in the Doom 3 game.

Link to comment
Share on other sites

It would be useful to have a command there which starts it in windowed mode along with the settings needed for it to look like in the editor. For one, many people change their gamma in game, and they -need- to have a gamma of 1 to be able to see it properly, otherwise we'll get maps with wrong lighting etc.

Link to comment
Share on other sites

Not having direct access to doom 3 in Dark Radiant is a bit of a hassle, so I was wondering if we could work around this by somehow assigning the Doom 3 default F2 key, to basically pass this command to the doom 3 executable?

(In Windows) I have setup my Doom 3 icon with a keyboard shortcut like Ctrl-Alt-D, which is also possible in Linux (haven't checked, but I'm positive). I also have shortcuts for my texteditor (Ctrl-Alt-E) and DarkRadiant (Ctrl-Alt-R), this way I only need one hand to fire up these apps.

 

It would be good if there was some way to pass commands to a running D3 executable, because then we could put a Build option in which would just call "dmap " in the Doom 3 game.

There is an autoexec.cfg in the Doom 3 folder and I tested it once if it's possible to drop a testmap bonehoard in there. I think it worked, although I can't remember right now. :blush: Perhaps this is the place to start looking for such a feature.

Link to comment
Share on other sites

It would be good if there was some way to pass commands to a running D3 executable, because then we could put a Build option in which would just call "dmap <mapname>" in the Doom 3 game.

 

Using a named pipe definitely works, and it would work on all systems. That's the mechanism I also use for the lightgem, so it should not be a problem.

Gerhard

Link to comment
Share on other sites

I tend to agree that just launching the game is probably not all that valuable, although bringing it the front might be (if this can be done, it would certainly be Windows-specific but it may be possible).

Finding and giving focus to another application's window is definitely possible using the Windows API. Off the top of my head, you'd just use FindWindowEx to find its hwnd (window handle), and then call ShowWindow(hwnd, SW_SHOW) or something like that.

My games | Public Service Announcement: TDM is not set in the Thief universe. The city in which it takes place is not the City from Thief. The player character is not called Garrett. Any person who contradicts these facts will be subjected to disapproving stares.
Link to comment
Share on other sites

Using a named pipe definitely works, and it would work on all systems. That's the mechanism I also use for the lightgem, so it should not be a problem.

 

I take it that would require support from the SDK, i.e. the game would have to be changed to accept commands over a pipe? Or does it already?

 

Finding and giving focus to another application's window is definitely possible using the Windows API. Off the top of my head, you'd just use FindWindowEx to find its hwnd (window handle), and then call ShowWindow(hwnd, SW_SHOW) or something like that.

 

I thought there would probably be something like that.

Link to comment
Share on other sites

Doing this on windows is the easy part, that's not a problem. I thought you knew that. You can enumerate all kind of objects including windows, so it's easy to identify the Doom 3 window.

 

As for the pipe, yes, that would need to include some SDK changes. One thing that worries me though is, that this might introduce potential security issues.

Gerhard

Link to comment
Share on other sites

If you just restrict the piped data to only containing commands that are needed (like testmap) then it should be fine.

My games | Public Service Announcement: TDM is not set in the Thief universe. The city in which it takes place is not the City from Thief. The player character is not called Garrett. Any person who contradicts these facts will be subjected to disapproving stares.
Link to comment
Share on other sites

That somebody else can also pass in commands. If there are bugs in the code, it can introduce security risks. I'm not saying that this is dangerous per se, only that there is a potential because of the "remote control" feature, so we shopuld take care that this doesn't happen.

 

It wouldn't be the first time that a game is used to hack a system.

Gerhard

Link to comment
Share on other sites

I guess you could ensure that the named pipe was only accessible by the user who started Doom 3. I cannot immediately think of any situation where D3 accepting commands would grant more access to the machine than software already has -- after all, in order to write to the named pipe you would have to have write access to the filesystem, which means you could overwrite or destroy data anyway.

 

An alternative (and possible easier) option is to use the system that was employed in T3Ed, whereby clicking on a suitable toolbar button would start the game with the currently-edited map. This could be implemented by calling Doom 3 with the "+testmap <mapname>" command line option, with the name argument filled in automatically.

Link to comment
Share on other sites

I don't think it takes THAT long to load, at least not on my system (less than 10 secs). It might be faster if it is loading straight to a map, rather than going to the main menu first. It should also speed up on the second and subsequent loads due to caching.

 

We might even find that starting a "copy" of Doom 3 with command-line options actually passes those options to the running instance if there is one already. I will have to check tonight to see how Doom 3 handles double startup situations.

Link to comment
Share on other sites

That's pretty ugly though. The startup of Doom 3 is quite long, so nobody would like to always have to wait for it.

 

Just to open a testmap doesn't take long...especially compared to T3. If you have tried opening a testmap in T3...then you won't worry about Doom 3...trust me. :) Good lord, you could wait for close to three or four minutes for a map to load in T3Ed, since it's not blockloading in the T3 editor.

 

I opened up the warehouse map in just under 30 seconds on my humble old system, using the following startup options.

 

com_allowConsole 1 +set r_fullscreen 0 +set r_brightness 1 +set r_contrast 1 +set fs_game darkmod

 

I think the mod already has the intro movies set to not play, so that cuts it down too.

Link to comment
Share on other sites

I don't think it takes THAT long to load, at least not on my system (less than 10 secs). It might be faster if it is loading straight to a map, rather than going to the main menu first. It should also speed up on the second and subsequent loads due to caching.

 

We might even find that starting a "copy" of Doom 3 with command-line options actually passes those options to the running instance if there is one already. I will have to check tonight to see how Doom 3 handles double startup situations.

 

I don't think Spar has played with T3Ed, so he doesn't know the pain of loading it. lol I think it would be fine to do it as you suggest orb.

Link to comment
Share on other sites

N.H.: since you have a copy of Doom 3 to hand, can you test what happens when you load an instance of Doom 3, and then use ANOTHER shortcut to run Doom 3 with a "+testmap somemap.map" argument?

 

Does it reuse the original instance, or try to load another copy?

Link to comment
Share on other sites

Well I tried the double startup thing in Windows. It seems that Doom 3 does reuse instances, so clicking on the shortcut a second time brings the current window to the front, but commandline parameters are not passed through to the instance.

 

This means we have a pretty easy way of activating Doom 3 -- just run the executable, if it is already running it will get activated -- but we will need the named pipe if we want to send commands to the running instance.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • Ansome

      Finally got my PC back from the shop after my SSD got corrupted a week ago and damaged my motherboard. Scary stuff, but thank goodness it happened right after two months of FM development instead of wiping all my work before I could release it. New SSD, repaired Motherboard and BIOS, and we're ready to start working on my second FM with some added version control in the cloud just to be safe!
      · 1 reply
    • Petike the Taffer  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
×
×
  • Create New...