Jump to content
The Dark Mod Forums

Connection to TDM with automation


Recommended Posts

My first task will be to make sure things are updated on the Linux side for the 2.13 release, but I can certainly have a look at your changes after that.

31 minutes ago, stgatilov said:

Now "Connection" menu contains only one item, which spawns the new window. Is it OK? Should it be moved somewhere else?

If that's the only menu item (and there are no plans to add any more), perhaps it should be moved to the Map menu?

31 minutes ago, stgatilov said:
  1. There are no icons for "pause" and "respawn" buttons. I guess I'll try to draw them myself (I use Inkscape a lot myself). It is obvious how to draw "pause", but what to draw on "respawn" icon?

You might want to look at the current directory of icons to see if there is anything suitable as a placeholder. Some variant of the "refresh" circular arrows might work, although it might also be confused with a simple connection refresh operation rather than respawning the whole game.

31 minutes ago, stgatilov said:
  1. It would be nice to have some verbose words about the new GUI window. Should it be in tooltips or in manual/help? Should I try writing them (judging from feedback over wiki page, I'd probably avoid it) ?

There should definitely be explanatory tooltips in the GUI, since most people don't read manuals and it won't necessarily be obvious what a pure icon button does. I'll update the online manual itself once the functionality is finalised and any GUI tweaks are finished, so that screenshots can be taken.

  • Like 1
Link to comment
Share on other sites

27 minutes ago, OrbWeaver said:

If that's the only menu item (and there are no plans to add any more), perhaps it should be moved to the Map menu?

Sound good to me.

I think if something needs to be added, it should be added to the GUI window. The menu interface was temporary from the very beginning, and I hope it will never be used again.

Quote

There should definitely be explanatory tooltips in the GUI, since most people don't read manuals and it won't necessarily be obvious what a pure icon button does. I'll update the online manual itself once the functionality is finalised and any GUI tweaks are finished, so that screenshots can be taken.

Ok, I'll write some initial tooltips then.

  • Like 1
Link to comment
Share on other sites

I checked out your branch. Everything built fine on Linux, and the basic functionality is good — seamlessly launching the game and going straight into the correct map is very convenient.

There's a sizing issue with the dialog: widgets are cut off and the bottom buttons are not visible at all.

834572738_Screenshotfrom2021-08-1020-37-02.png.b90d5e872a4bcd48e15a852cb0519c48.png

The SetSizerAndFit() method is convenient for setting a window sizer and automatically setting the minimum size, otherwise you might need to explicitly set the minimum size based on contents as the Light Inspector does:

SetMinSize(contents->GetEffectiveMinSize());

Probably I should find a way to refactor this into the TransientWindow base class, since we have a lot of problems with dialogs being shrinkable to nothing regardless of contents.

Note that your branch is based on master from about a month ago; I recommend rebasing on the latest master (either mine or Greebo's) to get the latest changes and minimise possible merge issues. I will be interested to see how the hot reload functionality interacts with the 2.13.0 light brightness slider (hopefully it does not collapse under a flurry of tiny updates).

Overall this is a massive improvement from the menu-based version, especially the autolaunch and dmap. I can definitely see myself using this as the main mechanism for testing map changes, rather than manually running the game from a terminal. Good job.

  • Like 1
Link to comment
Share on other sites

18 hours ago, OrbWeaver said:

There's a sizing issue with the dialog: widgets are cut off and the bottom buttons are not visible at all.

The SetSizerAndFit() method is convenient for setting a window sizer and automatically setting the minimum size, otherwise you might need to explicitly set the minimum size based on contents as the Light Inspector does:

I think I initially resized the window in wxFormBuilder, then got annoying problems with activity indicator, and finally forget that sizes should not be constant.

I hope I'll remember where to look for information if I do any GUI in the future.

UPDATE: I added SetMinSize just before calling Layout.

Quote

Note that your branch is based on master from about a month ago; I recommend rebasing on the latest master (either mine or Greebo's) to get the latest changes and minimise possible merge issues.

I tried merging the branch, it worked fine, no conflicts.
Nobody except me changed Game Connection code, and my changes outside it consists of a tiny hack in MapExporter.

Quote

I will be interested to see how the hot reload functionality interacts with the 2.13.0 light brightness slider (hopefully it does not collapse under a flurry of tiny updates).

If you update entity spawnarg every frame, then it will be very bad with "Update after every change".
This mode schedules update on next frame after every change (delaying by one frame does not increase latency but allows to move many entities at once). Also, "update map" is blocking.

If you update spawnarg only when mouse is released, then it should be OK.

 

Link to comment
Share on other sites

There is one more thing I forgot.

In my opinion, it should be possible to assign hotkeys to game connection actions. Defaults keys are not needed, but if mapper finds himself using something a lot, it should be possible to do it quickly from keyboard.

Aside from speed, there is also a problem of screen size. @Wellingtoncrab has a laptop with small screen, and even the new GUI window takes too much space on it. He should be able to use common features with GUI window hidden.

How is it usually done in DarkRadiant?

Link to comment
Share on other sites

The TransientWindows are usually just hidden when clicking on the X on their corner. They stay alive in the background and are toggled, like the SurfaceInspector or the Texture Tool. There are methods to override to run code right before the window is shown and after it's hidden, in case the controls need to be updated or listeners have to be unhooked.

In DR, keyboard shortcuts are assignable to all "commands" that don't require arguments to work. Commands are registered in the GlobalCommandSystem, if you do a text search for that you should find many examples. There is some support for UI stuff like toggling a checkbox and binding toggle shortcuts to registry keys, iirc this is handled the GlobalEventManager in the UI module, but I have to check to be sure.

Link to comment
Share on other sites

2 hours ago, greebo said:

In DR, keyboard shortcuts are assignable to all "commands" that don't require arguments to work. Commands are registered in the GlobalCommandSystem, if you do a text search for that you should find many examples. There is some support for UI stuff like toggling a checkbox and binding toggle shortcuts to registry keys, iirc this is handled the GlobalEventManager in the UI module, but I have to check to be sure.

What's the difference between command and statement?

I mean, I have this code:

    // Construct toggles
    _camSyncToggle = GlobalEventManager().addAdvancedToggle(
        "GameConnectionToggleCameraSync",
        [this](bool v) {
            bool oldEnabled = isCameraSyncEnabled();
            setCameraSyncEnabled(v);
            return isCameraSyncEnabled() != oldEnabled;
        }
    );
    // Add one-shot commands and associated toolbar buttons
    GlobalCommandSystem().addCommand(
        "GameConnectionBackSyncCamera",
        [this](const cmd::ArgumentList&) {
            backSyncCamera();
        }
    );
    _camSyncBackButton = GlobalEventManager().addCommand(
        "GameConnectionBackSyncCamera", "GameConnectionBackSyncCamera", false
    );

As you see, _camSyncToggle is created from lambda and directly tied to toolbar button. But _camSyncBackButton is created as a command in CommandSystem, then same-named command is created in GlobalEventManager, which is finally tied to toolbar button.

Why can't we delete the last three lines?
What do they even do?

UPDATE: Both of these two things work in toolbar, and both of them show up in Keyboard Shortcuts and work properly from shortcuts too.

Link to comment
Share on other sites

I'm not fully up to speed on the precise division of responsibilities between CommandManager and EventManager, but as I understand it "Commands" are things which can be executed from the console (so you can actually type in "GameConnectionBackSyncCamera" and it will work), whereas "Events" are things which are hooked into the UI (but events are usually built on top of commands).

If you removed the last three lines I think you would only have the command, which means you could back-sync the camera by typing in the console but the clickable button would not work.

It's possible (but I haven't tested) that everything in this case could be done through the event manager without needing to create a command, since it's likely nobody would actually want to sync the camera by typing in the console.

Link to comment
Share on other sites

41 minutes ago, OrbWeaver said:

It's possible (but I haven't tested) that everything in this case could be done through the event manager without needing to create a command, since it's likely nobody would actually want to sync the camera by typing in the console.

I wonder what is console used for?
Is it worth exposing game connection toggles/buttons for console?

What about Python scripting?
Can it generate an event? Can it run a command?

Link to comment
Share on other sites

A few months ago I changed a few things to the simpler and the last registration, calling EventManager.addCommand with twice the same argument should not be necessary anymore, since the events automatically find the correct command when they are connected to controls.

42 minutes ago, stgatilov said:

Is it worth exposing game connection toggles/buttons for console?

A whole lot of things are possible through the console, and while you don't have to expose the game connection commands to the console, it doesn't hurt at all. You get that console access for free anyway, since creating a command is necessary for the UI to connect to, and creating a command automatically makes it accessible through the console entry box.

42 minutes ago, stgatilov said:

What about Python scripting?
Can it generate an event? Can it run a command?

No events. But Python scripts can at the very least run console commands like "TexShift '0.3 0.4'". But most core modules have a "proper" Python interface and you can work with those natively. There's a huge wiki page describing the interface, and there are example scripts in install/scripts/

3 hours ago, stgatilov said:

What's the difference between command and statement?

A command is the thing that is registered as callable function, like "TexShift" or "SnapToGrid". A statement can be more complex, calling one or more commands in a row, with and without arguments, like: "TexShift '0.1 0.2'; TexRotate '0.12'; ConvertSelectedToFuncStatic; UnselectSelection". It's more like a macro, similar to the "bind" command in TDM. You can also create those statements and assign shortcuts to them, they are persisted between sessions.

Link to comment
Share on other sites

I added commands for all the features except for "Restart Game" with dmap on.
 

Right now "dmap" checkbox is purely GUI dialog thing, it is not stored in GameConnection singleton. So, I added command "GameConnectionRestartGame", but it never dmaps regardless of what is ticked in the dialog currently.

I'm not sure if users need to have a separate shortcut for Restart game + dmap or if they need the current state of dmap checkbox to be respected...


Also, I have noticed these "advanced toggles" (used on checkboxes) are not very good:

  1. The hotkeys are broken with them. If you only use hotkeys, then it works properly. But if you start mixing clicks on checkbox and using hotkey, then sometimes hotkey simply tries to always set false or to always set true, without changing state.
  2. Since advanced toggles are set directly in EventSystem, they cannot be used in DR console. They can be toggled by shortcuts though, so I'm not sure it is a big problem.
     

Also, there is some naming confusion.

I originally called two approaches "reload map" and "update map", although the latter term is pretty stupid and I would be happy to find a replacement. But the thing is: both approaches are "hot reload" to me (in fact, the difference between them is mostly on the DR side).

For now I keep this naming convention in the code (if it is changed, it has to be changed everywhere at once). For the GUI dialog, I have used @OrbWeaver terms to make two approaches sound distinct. However, the commands still use the naming convention from the code. And if power users decide to configure shortcuts or execute commands, they will face the differences between dialog and code terms.

Link to comment
Share on other sites

I just wanted to ask, instead of getting through 8 pages of posts, if there's a small documeation or mini tutorial on how to use this. This seems very, very useful to check everything out right ingame.

"Einen giftigen Trank aus Kräutern und Wurzeln für die närrischen Städter wollen wir brauen." - Text aus einem verlassenen Heidenlager

Link to comment
Share on other sites

Create a game shortcout in your darkmod folder.

Right click on TheDarkModx64.exe > create shortcut then right click on your shortcut you have just created "TheDarkModx64.exe" go to Properties in the target add https://i.imgur.com/TPrZ4Xt.png

Quote

+set com_allowConsole 1 +set com_automation 1

 so it'll be something like that:  "game folder location" TheDarkModx64.exe +set com_allowConsole 1 +set com_automation 1

launch your shortcut open console type: map your_mapname then go to radiant toolbar > connection and enjoy ! 🙂

 

Edit: as I see sometime it's bugged so you have to type again in the game console com_automation 1

Edited by IZaRTaX
Link to comment
Share on other sites

OK thank you! And when do I use the various options for under the connection tab? I was changing the ambient light and wanted to see how it looks ingame instantly, so I tried reload map file command from the menu but it didn't do anything.

"Einen giftigen Trank aus Kräutern und Wurzeln für die närrischen Städter wollen wir brauen." - Text aus einem verlassenen Heidenlager

Link to comment
Share on other sites

1 hour ago, SeriousToni said:

OK thank you! And when do I use the various options for under the connection tab? I was changing the ambient light and wanted to see how it looks ingame instantly, so I tried reload map file command from the menu but it didn't do anything.

The ambient light is usually controlled by the location script system. Script-controlled entities including anything with def_attached lights usually aren't supported that well by hot reloading. You might get it to work by selecting your info_locationsettings entity and respawning it from the connection tab.

Link to comment
Share on other sites

  • 2 weeks later...
On 8/15/2021 at 4:35 PM, SeriousToni said:

I just wanted to ask, instead of getting through 8 pages of posts, if there's a small documeation or mini tutorial on how to use this. This seems very, very useful to check everything out right ingame.

This forum thread was originally created only to discuss development of the feature with @greebo and @OrbWeaver.

As for "How to Use", there is technical description on the wiki:

It starts with some technical details which scare people away. Although I still recommend reading them sooner or later.
The article also contains usage instructions in "DarkRadiant" section.

I guess I'll update the article once the new pack of changes is incorporated into DR. It would become much easier to start using the feature than it is now, so perhaps "how to start" instruction would become totally unnecessary.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

6 hours ago, stgatilov said:

This forum thread was originally created only to discuss development of the feature with @greebo and @OrbWeaver.

As for "How to Use", there is technical description on the wiki:

It starts with some technical details which scare people away. Although I still recommend reading them sooner or later.
The article also contains usage instructions in "DarkRadiant" section.

I guess I'll update the article once the new pack of changes is incorporated into DR. It would become much easier to start using the feature than it is now, so perhaps "how to start" instruction would become totally unnecessary.

Thanks. I didn't know of the wiki article. Guess I searched the wrong keyword.

I did skim trough it. I like that there is much explained - something that some topics still miss to do in the wiki. So that's great. However for someone who touches this for the first time there might be a little quick setup guide too. So one can follow the text and try it out immediately by themselves. I think it's easier to grasp. But that's not critique - I both like the feature itself and also that there's an extended wiki article already. Just didn't find it :D

  • Like 1

"Einen giftigen Trank aus Kräutern und Wurzeln für die närrischen Städter wollen wir brauen." - Text aus einem verlassenen Heidenlager

Link to comment
Share on other sites

  • 4 weeks later...

I wonder what's the state of the new Game Connection GUI?
I guess I'm not going to work on it in the near future, and it is actually done.

The only thing which should be added is "Advanced Settings" for Restart Game button. I mean, "dmap" checkbox is OK as it is, but I imagine experienced users will be glad to control additional dmap arguments:

  • noAAS: I recall someone wanted this checkbox: it allows to reduce dmap time in half if you don't care about AIs.
  • noFlood: makes a lot of sense for a WIP map, since otherwise user is forced to fix all leaks before playing it.

 

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

    • 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
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
    • nbohr1more

      Please vote in the 15th Anniversary Contest Theme Poll
       
      · 0 replies
    • Ansome

      Well then, it's been about a week since I released my first FM and I must say that I was very pleasantly surprised by its reception. I had expected half as much interest in my short little FM as I received and even less when it came to positive feedback, but I am glad that the aspects of my mission that I put the most heart into were often the most appreciated. It was also delightful to read plenty of honest criticism and helpful feedback, as I've already been given plenty of useful pointers on improving my brushwork, level design, and gameplay difficulty.
      I've gotten back into the groove of chipping away at my reading and game list, as well as the endless FM catalogue here, but I may very well try my hand at the 15th anniversary contest should it materialize. That is assuming my eyes are ready for a few more months of Dark Radiant's bright interface while burning the midnight oil, of course!
      · 4 replies
×
×
  • Create New...