Jump to content
The Dark Mod Forums
Sign in to follow this  
stgatilov

Connection to TDM with automation

Recommended Posts

Ah, thanks. Somehow, I did not yet stumble accross std::filesystem. The documentation also directly states, that it is derived from boost.filesystem.

The filesystem library was originally developed as boost.filesystem, was published as the technical specification ISO/IEC TS 18822:2015, and finally merged to ISO C++ as of C++17. The boost implementation is currently available on more compilers and platforms than the C++17 library.

Share this post


Link to post
Share on other sites
14 hours ago, greebo said:

Actually, I meant boost headers too. :) At least as far as the Windows compile is conerned, we don't need any boost to compile DR anymore.

After replacing the heavily-used helpers like boost::shared_ptr, boost::noncopyable, and the libs boost::thread and boost::filesystem, there weren't any references left except for a few string-manipulation functions and predicates. At this point I decided to bite the bullet and get rid of the entire boost dependencies - it didn't seem appropriate anymore to ship dozens of MB of headers just for those few string helpers.

Interesting, I didn't realise that.

I'd better check my recent changes, because I might have inadvertently added new minor usages of Boost without realising that the headers wouldn't be available on Windows.

Share this post


Link to post
Share on other sites

I'm trying to get camera location as GlobalCamera()->getActiveCamWnd()->get... .

Getting errors like this:

1>GameConnectionDialog.obj : error LNK2019: unresolved external symbol "private: __cdecl Matrix4::Matrix4(double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double)" (??0Matrix4@@AEAA@NNNNNNNNNNNNNNNN@Z) referenced in function "public: static class Matrix4 __cdecl Matrix4::byColumns(double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double)" (?byColumns@Matrix4@@SA?AV1@NNNNNNNNNNNNNNNN@Z)
1>GameConnectionDialog.obj : error LNK2019: unresolved external symbol "public: class BasicVector3<double> __cdecl ui::CamWnd::getCameraAngles(void)const " (?getCameraAngles@CamWnd@ui@@QEBA?AV?$BasicVector3@N@@XZ) referenced in function "public: void __cdecl GameConnection::UpdateCamera(void)" (?UpdateCamera@GameConnection@@QEAAXXZ)
1>GameConnectionDialog.obj : error LNK2019: unresolved external symbol "public: class std::shared_ptr<class ui::CamWnd> __cdecl ui::GlobalCameraManager::getActiveCamWnd(void)" (?getActiveCamWnd@GlobalCameraManager@ui@@QEAA?AV?$shared_ptr@VCamWnd@ui@@@std@@XZ) referenced in function "public: void __cdecl GameConnection::UpdateCamera(void)" (?UpdateCamera@GameConnection@@QEAAXXZ)
1>GameConnectionDialog.obj : error LNK2019: unresolved external symbol "public: void __cdecl ui::GlobalCameraManager::addCameraObserver(class CameraObserver *)" (?addCameraObserver@GlobalCameraManager@ui@@QEAAXPEAVCameraObserver@@@Z) referenced in function "public: static void __cdecl GameConnection::EnableCameraSync(class std::vector<class cmd::Argument,class std::allocator<class cmd::Argument> > const &)" (?EnableCameraSync@GameConnection@@SAXAEBV?$vector@VArgument@cmd@@V?$allocator@VArgument@cmd@@@std@@@std@@@Z)
1>GameConnectionDialog.obj : error LNK2019: unresolved external symbol "public: void __cdecl ui::GlobalCameraManager::removeCameraObserver(class CameraObserver *)" (?removeCameraObserver@GlobalCameraManager@ui@@QEAAXPEAVCameraObserver@@@Z) referenced in function "public: static void __cdecl GameConnection::DisableCameraSync(class std::vector<class cmd::Argument,class std::allocator<class cmd::Argument> > const &)" (?DisableCameraSync@GameConnection@@SAXAEBV?$vector@VArgument@cmd@@V?$allocator@VArgument@cmd@@@std@@@std@@@Z)
1>GameConnectionDialog.obj : error LNK2019: unresolved external symbol "class ui::GlobalCameraManager & __cdecl GlobalCamera(void)" (?GlobalCamera@@YAAEAVGlobalCameraManager@ui@@XZ) referenced in function "public: void __cdecl GameConnection::UpdateCamera(void)" (?UpdateCamera@GameConnection@@QEAAXXZ)

I have a feeling that some parts are not opened for plugins yet.

What's the right way to listen for DR camera movements and get position/angles?

Share this post


Link to post
Share on other sites

Symbols like Matrix4 are in the math library, which you can add to your link options.

However, GlobalCameraManager is only available within the radiant binary, so your initial assessment is correct — this part is not available for plugins. Historically there has not been any use of external plugins that interface tightly within the main UI (as opposed to adding new dialogs which plugins like Objectives and Stim/Response already do), which is why the CameraManager is not exposed in this way, although it is already a module with a defined interface so it could be refactored if necessary.

For now though, it might be simpler just to write your prototype code as part of the main radiant binary rather than as a separate DLL. It could always be separated out later if there was a need.

Share this post


Link to post
Share on other sites

This is how it looks right now.
Also attached the code of main class if anyone is interested.

 

One nuisance is that reloading a map works only after the map is saved. So when mapper moves something, he has to 1) save the map, and 2) click "reload map" button. It is of course possible to send reloadMap command automatically on save, removing one click. Also, reloading map from scratch takes a second or two for a large map (saving probably takes longer).

But I think it would be better if hot-reloading was possible without saving map to disk. In order to achieve that, I need the following features:

  1. Ability to detect which entities has changed (since some mark in the past). Which were removed, which were added, which were modified (it's OK to overestimate the last list).
  2. Ability to save every entity from selected set into in-memory text in .map format (spawnargs, brushes, patches --- all exactly as in .map file).
  3. Probably also some event which signals when an entity has changed.
  4. Worldspawn is out of question yet. But in future it would be necessary to do pretty the same things for world brushes and patches.

 

 

GameConnection.cpp GameConnection.h

  • Like 4

Share this post


Link to post
Share on other sites

That actually looks very cool. I was originally assuming you were just going to add an extra button along the lines of "Reload this map in the game", but you've gone all the way to full bidirectional camera synchronisation in real-time which could be extremely useful (and help get around the drawbacks of DR's very limited rendering).

I think there could be some improvements to the UI but that's something we can handle on the DR side.

I would be interested in testing your changes, but I'm not sure how to integrate them with just the new files attached to the forum post (or is it literally just a case of adding them to the build and everything happens automatically?). If changes outside of those files are needed, would you be able to produce a patch using git-format-patch which should cover everything and is very easy for other Git users to apply?

Share this post


Link to post
Share on other sites

This looks very cool already. And yeah, reloading map upon saving is probably a good idea, or maybe having a switch / checkbox for that, if mapper wants to control it manually in some cases. This should work even better with for two-monitor setup.

Share this post


Link to post
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.

Sign in to follow this  

×
×
  • Create New...