C++ Hot Reload Gem is ready!

I just want to let you know you have the C++ Hot Reload Gem ready to drop in the Gems folder and activate it. Will auto-configure itself! tested on 1.22 and 1.23 :slight_smile:

To thank the community and Lumberyard developers I publish it for free on GitHub so it’s available for testing, evaluation or non-commercial purpose projects.

https://github.com/CppHotReload/Lumberyard

All the feedback it’s appreciated, I hope it helps you with your projects :+1:

9 Likes

Looks promising!

However, once I add the Hot Reload gem to my project, the lumberyard editor will shut down after processing all assets. No error popups (probably some log somewhere I don’t know off yet).

When I disable the Hot Reload gem, the editor behaves as expected (meaning I can open my project etc.)

I’ll fiddle around a bit and post any findings, if any.

Edit: I’m running Ly 1.23

1 Like

what is hot reload what does it do?

Hey Never, thanks to try C++ Hot Reload. Please paste on Gist the debug log of Visual Studio. Debug log, not the build log.

You might need change the build configuration to match your project. Do you use incredibuild?

Thanks

Basically:

  • Calculate dependents and dependencies of your files
  • When you save a file the Gem detects a change
  • Generates a mapping of your variables to transfer to the new version
  • Wraps your modified files into a micro-dll
  • Creates a new pointer of your class (component)
  • Returns and restore that pointer for every instance you have in the game

Reloads and restore pointers only of your modified components.

Hi Prompt,

I’ve built the project as described here:
https://docs.aws.amazon.com/lumberyard/latest/userguide/building-your-lumberyard-game-project.html

Building seems to succeed, booting up the project seems to go fine, until it’s supposed to start the project. Here’s a gif with me scrolling through the build log and booting the editor:

That’s the build log, not the Debug log.

This is what I don’t need, the Build log:

This is what I need :slight_smile:

Btw: in the right bottom corner of Windows image You have the asset processor running, in the StarterGame takes forever to process all assets the first time. Might be your issue?

When the Editor opens you should see:
image

Thanks a lot for your feedback and Images @Nevey

Hi Prompt,

I’m not entirely sure how to get the Debug output (it doesn’t give me that option, probably have to run a debug but I guess that’s only possible when running the editor).

However, when building my project via VS with the Hot Reload gem enabled, I’m getting this error:

And this is my folder structure:

image
image

Hope it helps!

Can you confirm you have this file: image

I can, it’s there. Just noticed the cpp hot reload files are not visible in the solution explorer, even though the stdafx.h is in fact included in the project. I’ll try to add manually and see what happens.

I think I can help you in a more agile way in the Discord channel: https://discord.gg/9gsaNnD
Later we can post here the solution.

Best.

Hi Prompt,

Thanks for the support. But I think I’m putting Lumberyard on hold now as it seems like I need to invest a LOT of time in getting things to work as expected. Time I cannot afford right now. And I’m not talking about your HotReload plugin.

Thanks again for your support, I’ll be back :slight_smile:

Does this only allow for hot reload for variable value changes and things of that sort? Or is it more involved than that? I won’t really be needing to use c++ in my planned projects so that’s not why I’m asking but if the ability to change c++ on the fly is more involved then it may be possible to hook up a layer between Script Canvas and this hot reloading of C++ to make script canvas have better performance. This is all just speculation on my part but just throwing that in the mix to see what more knowledgeable people think.

Hi there, you can change the whole class structure, layout and signature, etc, everything. Is not based on vtable replacement nor binary patching (function offsets and pointers).

I made even a prototype having visual scripting writing C++ on files for max performance, Script Canvas as you said is based on LUA with hooks in C++, if those hooks are based on components you’ll be able to fully reload that. My knowledge on Script Canvas in Ly is very low, however let me know what you do and I can adapt the plugin.

I guess if you reload C++ you’ll need to reload at the same time the Script Canvas so those C++ hooks get updated.

@Prompt Hello, after adding the Hot Reload gem to my game project, the wood editor is shutting down after all the assets have been processed. There was also no error pop-up. I did the test in version 1.23. This is my feedback. Thanks.

You need to help me to help you. C++ Hot Reload Gem has now “abort()” calls if something is not properly configured or doesn’t fit with your project. That’s done to hunt down problems or misconfiguration.

So please run it from Visual Studio and pass me the debug log, not the build log (images before). That will give me the information I need. If you can join the Discord channel I’ll be able to support you super fast: https://discord.gg/9gsaNnD

Hi,

This tool sounds great! I would like to see it in action. Maybe I can help you to show where the problem is, as I see:

  1. When you create a new project in Lumberlyard 1.23 it don’t have a precompiled header. So the .pch file for this project is not generated at all and CppHotReload fires abort in CppHotReloadConfig.cpp at 345 line: if (foundPch.empty()) abort() - that’s why a new project don’t start.

Also the project code is not stored in /dev/Code/PROJECT_NAME/ folder (but it is in /dev/PROJECT_NAME/Gem/Code/). As I see generated object for it are stored in /dev/BinTemp/LUMBERYARD_BIN_CONFIG_DIR/PROJECT_NAME/Gem/Code/ (/Source as project structure etc.) folder.

  1. The StarterGame is an exception. It contains precompiled header, store code in /dev/Code/PROJECT_NAME/Game folder It have .pch file in dev\BinTemp\win_x64_vs2017_debug\Code\StarterGame\Game folder. So it’s look’s like good candidate for test CppHotReload tool. So I added a CppHotReload gem to it. Configure and recompile project. I sucessfully started Editor with the following logs:

    (C++ Hot Reload) - sys_game_folder=StarterGame, crc: 4136858
    (C++ Hot Reload) - Reading include file…
    (C++ Hot Reload) - Applying environment macros…
    [Error] (C++ Hot Reload) - Timeout: connect timed out: [2001:41d0:302:2100::2ac2]:80
    [Error] (C++ Hot Reload) - Your C++ Hot Reload license cannot be validated, please contact to: contact@hotreload.tech
    [Error] (C++ Hot Reload) - Something went wrong initializing C++ HotReload!

and after load a level I get such exception in CppHotReloadGem.cpp file at 97 line:

 if (!CppHotReload::IsWorking()) : 
Assertion failed! … Expression: cppHotReload && "C++ Hot Reload not initialized!"

Program: ....23.0.0\dev\Bin64vc141.Debug\HotReload_x64_mdd.dll
File: ..\..\..\Code\HotReload\HotReloadAPI.cpp
Line: 2624

and in some case in line 221:

const AZStd::string& guid = CppHotReload::RegisterPtr(typeName.c_str(), reinterpret_cast<void*>(currComponent));

exception: 0x00007FF8AB9C46F0 (HotReload_x64_md.dll)

I hope this will help to fix it because I really want to see it in action :slight_smile:

ps. PROJECT_NAME is not variable/constant, I just use it for any project folder.

Ok so I’ll try with a project without PCH.

The error you see about the license is because either has no connection or couldn’t connect with the license server (which will return a full license activation).

I validate every day that works, also from UE4 clients. Do you have anything blocked like when you start the Ly Editor? Always appear if you allow the Editor to connect to internet.

Thanks for the testing! Remember to join Discord.

That’s sounds good. I will wait for solution.

I cannot connect with server even with windows defender / firewall / antyvir disabled. Could you provide the server IP with port address so I will be able to test if I have communication with it ? If will be easier I can try to contact you at Discord.

Thanks!

I removed the ipv6 config from the license server. Should work now for everyone!