Jump to content

14 posts in this topic Last Reply

Highlighted Posts

Posted:
Last Online:  
 

Hey everyone!

I've been tinkering with a new plugin that brings a modern, 3D city-building camera right into the game. You can click and hold the Middle Mouse button (M3) to pan & tilt the camera, with a new smooth zoom experience, as well as use WASD to move the camera (optional to enable/disable). It seriously changes the whole vibe of building!

It's still in the BETA stage, and I wanted to share it with the community to get your thoughts. You can check it out and grab the files here:
https://github.com/UncleUncleRj/SC4-ModernCamera/

Feel free to test it out and play around. Let me know what you think! ✌️

  • Like 7

Share this post


Link to post
Share on other sites
Posted:
Last Online:  
 

Interesting idea, it is nice to have more people developing SC4 DLLs :). Other DLLs may also hook the middle click message in the city view, but there is no way to know if that would be a conflict.

From the Mac symbols, Maxis defined button up/down message codes for the middle mouse button, but they never got around to checking for those messages in the game's window procedure or adjusting the rest of the code to provide middle mouse button support. I find that a shame as you could do some fun things with a ViewInputControl that had middle click filtering, such as implement this type of mod. The city right click scrolling is implemented as a ViewInputControl.

Looking at the code I have a few notes:

  • Deriving from cRZMessage2COMDirector could have saved you the effort of reimplementing the QueryInterface/AddRef/Release logic.
  • SC4 has a built-in way of hooking window messages, the AddWinProcFilter function in the cIGZCanvasW32 interface.
    • My Region Census UI DLL uses that interface to implement a middle click hook in the region view.
  • Like 4

Share this post


Link to post
Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    @Null 45 Cool! Thank you for the advice. I went ahead and tested this out and got a huge performance boost while dragging the camera around over the previous model. I'll merge the code and make a new release probably later today.

    EDIT: Okay, I've updated the plugin. It's still got the same glitches, strange behaviors etc (still alpha) - but the performance improvement is tangible.

    I'll work on it some more when I can. If anyone else wants to collaborate, or fork it, or whatever - feel free! Honestly, I'm kind of new at this (git/github) - but I'm trying to learn it quickly.


      Edited by robo_d  

    updated the progress
    • Like 3

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    8 hours ago, robo_d said:

    EDIT: Okay, I've updated the plugin. It's still got the same glitches, strange behaviors etc (still alpha) - but the performance improvement is tangible.

    You should be able to replace both the mouse and keyboard hooks with that filter function, and maybe rename it from HandleCanvasMouseMessage to something like CanvasMessageFilter. Although that would make the filter method more complex. It also looks like the keyboard filter is only used for debug logging, so perhaps that code could be removed from release builds or gated behind a debug logging switch in an INI file.

    The modern approach for SC4 DLLs is typically to reference the main gzcom-dll repository as a submodule without modifying its code, which allows you to easily update to new gzcom-dll versions. Git submodules also used for any simple dependencies that are header only (e.g. WIL - which greatly simplifies using various Windows APIs), with more complex libraries like boost being handled through a C++ package manager.

    I also have a repository of common SC4 DLL code that contains code for logging, INI reading, version detection, memory patching, etc.

    Also, it is customary for SC4 DLLs to list all dependencies and their licenses in the project's readme.

    • Like 2
    • Thanks 1

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    I think the idea is fairly similar to the extension to memo's 3D camera DLL that I toyed with a few months ago. It was mostly for experimental reasons so I never really tied it in to the middle mouse movement, just a cheat code to open a dialog where all the view angles and zoom/magnification could be tweaked with sliders. But perhaps there's code here that you could re-use/integrate in your work.

     

    https://github.com/caspervg/sc4-render-services/tree/main/src/sample/camera-view-input

     

     

     

     

    • Like 5

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    @CasperVg  @Null 45  Wow! Thanks for sharing your work - I've been working on the plugin and have released a major update. It no longer clips through the ground causing misrenders, no longer has trouble with vanished walls at odd angles, and has better overall performance. I've also updated my repo to try to better incorporate community standards as per Null45's recommendation.

    I still have more work to do before I complete the plugin - if you guys try it out and want to help - please try to break the camera using camera movement, if/when you do, please press F8, then exit the game. There should be a SC4-3DMouseCam.log file in the plugins folder. Please DM me with a quick summary of what you did and attach the .log file. TY!

    WARNING - Again - do not yet try on important cities/regions without backing them up!

    • Like 2

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    I've released a new update. It completely overhauls the original camera. Please take a look and tell me what you guys think, the good the bad and the ugly.https://github.com/UncleUncleRj/SC4-ModernCamera/releases

    thank you!

    PS I changed the title of this thread to reflect what I hope this plugin is more closely resembling.

    • Like 2

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    On 6/19/2026 at 5:45 PM, Rj Simas said:

    Please take a look and tell me what you guys think, the good the bad and the ugly.

    It works for me, but since it is a Debug build it won't work for most people due to needing to have Visual Studio 2022 with the C++ tools installed to get those debug CRT DLLs. Even beta DLLs should be Release builds for public distribution because the Microsoft Visual C++ 2022 redistributable does not include the debug versions of the runtime.

    Is there a way to reset the camera to the Maxis defaults?

    • Like 2
    • Thanks 1

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    3 hours ago, Null 45 said:

    It works for me, but since it is a Debug build it won't work for most people due to needing to have Visual Studio 2022 with the C++ tools installed to get those debug CRT DLLs. Even beta DLLs should be Release builds for public distribution because the Microsoft Visual C++ 2022 redistributable does not include the debug versions of the runtime.

    Thank you, that's good to know.

    3 hours ago, Null 45 said:

    Is there a way to reset the camera to the Maxis defaults?

    I'm working on this currently.

    • Like 1

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     

    This mod "in beta" is great! It makes using the 3D camera mod a lot easier. I also love being able to step in to so many different zoom levels! Feedback that I have is that it breaks mouse wheel scrolling through the UI. If you can't implement anything to fix that, that's okay.

    • Like 1

    Fun fact: Buffalo sauce contains the entire DNA sequence of buffalo, so you can clone buffalo while eating buffalo wings with buffalo sauce at Buffalo Wild Wings in Buffalo, New York. I've never tried it, though.

    Share this post


    Link to post
    Share on other sites
    Posted:
    Last Online:  
     
    4 hours ago, Turnstyled said:

    Feedback that I have is that it breaks mouse wheel scrolling through the UI

    That is due to the fact that it prevents the game from receiving mouse wheel messages as a brute force way to bypass the Maxis mouse wheel zooming behavior.

    That Maxis code could be jumped out with a memory patch that redirects to code the DLL provides, but that is more complex to implement due to the fact that it requires working directly with x86 assembly language. I found the location of the cSC4View3DWin_GZOnMouseWheel function in the v641 binary (0x007e6b50), and I also found what I think is a good hook inject point (offset 0x007e6c1a).

    I may have to try building the plugin and submitting a PR if I get the patch working.

    • Like 2

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     
    20 hours ago, Turnstyled said:

    This mod "in beta" is great! It makes using the 3D camera mod a lot easier. I also love being able to step in to so many different zoom levels! Feedback that I have is that it breaks mouse wheel scrolling through the UI. If you can't implement anything to fix that, that's okay.

     

    15 hours ago, Null 45 said:

    That is due to the fact that it prevents the game from receiving mouse wheel messages as a brute force way to bypass the Maxis mouse wheel zooming behavior.

    That Maxis code could be jumped out with a memory patch that redirects to code the DLL provides, but that is more complex to implement due to the fact that it requires working directly with x86 assembly language. I found the location of the cSC4View3DWin_GZOnMouseWheel function in the v641 binary (0x007e6b50), and I also found what I think is a good hook inject point (offset 0x007e6c1a).

    I may have to try building the plugin and submitting a PR if I get the patch working.

    Thank you both for pointing this out, and for the input. I will also look into this!

    • Like 1

    Share this post


    Link to post
    Share on other sites
  • Original Poster
  • Posted:
    Last Online:  
     

    Okay, I managed to fix the scrolling problem, I had to log and debug what area IDs the plugin was treating as 3D world surfaces vs SC4 UI and just have it target world surfaces.

    Great! And with that 1.0 is officially released!

    Thank you to everyone!

    • Like 3

    Share this post


    Link to post
    Share on other sites

    Sign In or register to comment...

    To comment in reply, you must be a community member

    Sign In  

    Already have an account? Sign in here.

    Sign In Now

    Create an Account  

    Sign up to join our friendly community. It's easy!  

    Register a New Account


    ×

    Thank You for the Continued Support!

    Simtropolis depends on donations to fund site maintenance costs.
    Without your support, we just would not be in our 24th year online!  You really help make this a great community. *:thumb:

    But we still need your support to stay online. If you're able to, please consider a donation to help us stay up and running. This helps sustain a platform where we can share our community creations for years to come.

    Make a Donation, Get a Gift!

    Expand your city with the best from the Simtropolis Exchange.
    Make a Donation and get one or all three discs today!

    STEX Collections

    By way of a "Thank You" gift, we'd like to send you our STEX Collector's DVD. It's some of the best buildings, lots, maps and mods collected for you over the years. Check out the STEX Collections for more info.

    Each donation helps keep Simtropolis online, open and free!

    Thank you for reading and enjoy the site!

    More About STEX Collections