Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Live patch: refactor and logic nodes support #2283

Merged
merged 46 commits into from
Jul 26, 2021

Conversation

MoritzBrueckner
Copy link
Collaborator

@MoritzBrueckner MoritzBrueckner commented Jul 25, 2021

TL;DR: here is a video that showcases some of the changes: https://www.youtube.com/watch?v=mxklu7TfwBw

This PR improves the live patch system:

  • Support for light color and strength settings, more could be implemented easily by adapting the current code.
  • Many smaller changes to improve the overall stability
  • Added a list of operators that shouldn't trigger a rebuild
  • Support for live patching logic nodes:
    • Nodes now have their own property constructors for properties with a Haxe equivalent, e.g. IntProperty becomes HaxeIntProperty with an additional first parameter equal to the property's name. This was required to be able to listen to property changes, and in the future we could name properties different than property0 - property9 with only some minor adjustments needed in the code.
      Old node trees automatically get updated when a file saved before SDK 2021.08 is opened. External node libraries need to update this to support live patch, but outside of live patching the nodes will continue to work without getting updated.
    • Added custom socket types even for standard Blender types to be able to listen to socket value change events. This is also updated automatically for old files and external libraries should update this.
    • Supported operations:
      • Adding/removing links
      • Adding nodes
      • Duplicating nodes
      • Deleting nodes
      • Change properties and socket default values
      • Operators that change the amount of sockets
    • At the cost of slightly more memory, the way links between logic nodes are stored has changed to reduce complexity in the algorithms used for live patch updates (and other areas like node.runOutput() benefit as well).

Limitations:

  • The current way of sending live patch data to Krom is to write it to a file called krom.patch that is opened by the running game in regular time steps. This means that we can't reliably send multiple updates directly after each other in a short time span because some of them would simply go missing. As a result there are some limitations:

    • When dragging a link between nodes to another target (no deletion and then adding a new link, but re-target a link), only one related node is updated, which node is more or less randomly.
    • If multiple nodes are deleted at once with box select, only one of them is deleted in the running game.
    • If the game is re-exported because some changes unknown to the live patch system, the changed node setup is reset to the version in krom.js until the game is properly restarted. It would be possible to recreate the entire tree but not with the current file-based IPC for said reasons, there would be too many commands in a short time span.

    I tried to implement a named pipe as a node.js extern but unfortunately didn't succeed, maybe something like this could get implemented in Armorcore directly?

  • Also, there is no live patch support yet for reroutes, support for that will follow in a future PR (shouldn't be much work but I will have almost no time in August).

So using live patch for logic nodes remains rather experimental at the moment, it's likely that there might be some errors left as well although I thoroughly tested the changes.

This allows to listen for socket updates for the live patch system
@MoritzBrueckner MoritzBrueckner marked this pull request as draft July 25, 2021 14:58
@MoritzBrueckner MoritzBrueckner marked this pull request as ready for review July 25, 2021 15:02
@tong
Copy link
Contributor

tong commented Jul 25, 2021

Why not use a network socket for sending data ?

@MoritzBrueckner
Copy link
Collaborator Author

Yeah that would probably work as well. I have no experience whatsoever in network programming, so feel free to implement it if you want. The data is sent here and received here.

@tong
Copy link
Contributor

tong commented Jul 25, 2021

Just checked and there seems to be no support for sockets in krom :(

@MoritzBrueckner
Copy link
Collaborator Author

Can this be used on the Krom target?

@tong
Copy link
Contributor

tong commented Jul 25, 2021

I don't think so.
But this would allow to have live-patch functionality for the html5 target.

@luboslenco luboslenco merged commit ce75516 into armory3d:master Jul 26, 2021
@luboslenco
Copy link
Member

Amazing. Would be cool to eventually get sockets in Krom.

@MoritzBrueckner MoritzBrueckner deleted the live-patch branch July 26, 2021 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants