Save Data for Script Canvas?

Hi I have been messing with trying to learn some c++ to work in LY, but to be honest I have never really touched it in my life, and script canvas is my favorite thing to do, my real question is when will script canvas have a save feature like to an xml file. I looked around and unreal’s blueprints have a save feature, I know they are different and that cannot be a full explanation, but I also did some more looking and even Cryengine back in Cryengine 3 when LY was born it had a save system. Yes LY did have a save system right out on beta 1.0. Why is this not a feature yet for script canvas? I have been working on a game for over 6 months now and it is all going pretty well, lots of help from others as I build it, but I just recently realized my game is unplayable without this one feature. And flowgraph was taken out so any visual saving feature now is gone. I was looking at other posts and saw that someone working at LY was going to look into it and even put a sticky note on his pc, but that was in July and we are still here without it. I really hope this does not get overlooked, because I have been trying to use LY for a long time now, and my only other choice is to go to Unreal if necessary to continue my games progression. image_2021-02-08_194825 This is what flowgraph had back in 2016.

1 Like

I would like to know if this is a feature coming within the next version if possible. Even in a PM if you do not want to share any bad news with the community, because if it is not coming I will need to start the transfer of everything and the rebuilding in another engine that gives me all the tools I need to create a successful project. Thanks for your time and I hope to hear from a dev soon. :+1:

1 Like

I also hope that the preservation function will be implemented in the near future. Or at least the details of how to implement it with c++
However, I am also poorly versed in the c++ to the introduction of the necessary functions in the script canvas, just mandatory, and should stand first in the road map

1 Like

I posted that a while ago, unfortunately shifting priorities, resources, and the challenges in the past year made it difficult to do much progress on it. The problem with that gem is that it was designed in a very C+±centric way, which makes it non-trivial to add Script Canvas support, the data payload from Script Canvas would need to be marshalled into that SaveData binary format, and then It would support only a subset of Lumberyard’s types.

That said, I’ve been thinking about this problem and I have a potential solution you could consider. There are libraries that add JSON support to Lua (such as GitHub - rxi/json.lua: A lightweight JSON library for Lua). Using Script Events, you could send data from a Script Canvas graph for which you implement a Lua Script Event handler. Once the data is received by the Lua script, you could use json.lua to save this data out to file.

Conversely, when you load a json file from Lua with lua.json, you could send a Script Event that passes in the data and a Script Canvas graph would receive it.

It’s not an ideal setup, but it may unblock you, we could work through this idea on discord if you’d like to give it a try.

3 Likes

Honestly yes I would love to try this LY is my favorite pick for an engine, and I will try anything necessary to get rid of the only block I am having.

Cool! The first step would be to do the basic setup for communicating Script Events between Script Canvas and Lua. I need a bit of time to setup a 1.27 build and I’ll follow up with some examples on how to do this.

2 Likes

Thanks, I have downloaded the json.lua folder from github, not sure where to start with this, but I will wait to see what you come up with. :+1: (WashedUpR6#8009) not sure if you want to do this on discord dm, forums, or discord server.

1 Like

I’ve made some progress on this tonight, I am able to send data from Script Canvas to Lua and save that data as a JSON file. I am now working on loading the data from a Lua script and sending it back to Script Canvas. Once I get that working well, I will write a tutorial for you; my goal is to make it easy for you to adapt it to your needs.

It’s getting a bit late, but I will continue on it tomorrow.

3 Likes

Thanks for all your hard work, I would love a tutorial on it also to learn on how to add it into our pipeline with the exact needs like you said. I can’t thank you enough.

Hey @WashedUpStudios,

I wrote the instructions as a tutorial, hopefully it’s enough to get you started, feel free to ask questions and let me know if you run into any errors in the tutorial and I’ll update it.

I used Visual Studio Code to write the document, if you use VS Code you can press Ctrl+Shift+V to see the document as its formatted.

Edit: Alternatively, I uploaded it to github here

Save Tutorial.zip (59.3 KB)

5 Likes