-
Howdy, I am working on a project similar to this and inspired by Sebastian's video and project in general. I have implemented a system for saving custom chips, which I thought was genius back when I did it, but now I started experimenting with a larger number of inputs and it is awfully slow. This is my current way of saving a chip made by the user:
Then when the chip is placed, the program did not need to know which chips the one that we placed had, and only had to find the correct states and display them. This worked fine, and still does up to around 16 inputs, anything above that becomes really slow. I was trying to find how you guys/Sebastian did this, but could not find anything so I thought I would just ask. I did try to separate the stuff into multiple threads but that did not really work since that meant that the different threads have been overwriting the states of the others and thus messing up the simulation. I am doing this in Godot4 using GDScript, if that matters. I really hope any of you can help me out a little bit. Love the work you all put in. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @gro-david, we use a simple system for saving chips: when you save a chip, we serialize and store a JSON representation of everything on the screen, including the current chips, connections, signals, and anchor points for wires. During the loading process, we first check if the saved data is compatible with the current version. If it isn't, we update the save file accordingly. After that, since a chip may depend on other chips, we reconstruct each chip recursively by instantiating each one and storing the object for later reuse. If you’d like to explore the code yourself, you can find all the related classes in the Asset/Module/SaveSystem folder. Be aware that there are a few issues, and the JSON representation isn't optimal at the moment. It could be improved by reducing some unnecessary redundancy. |
Beta Was this translation helpful? Give feedback.
Hi @gro-david, we use a simple system for saving chips: when you save a chip, we serialize and store a JSON representation of everything on the screen, including the current chips, connections, signals, and anchor points for wires.
During the loading process, we first check if the saved data is compatible with the current version. If it isn't, we update the save file accordingly. After that, since a chip may depend on other chips, we reconstruct each chip recursively by instantiating each one and storing the object for later reuse.
If you’d like to explore the code yourself, you can find all the related classes in the Asset/Module/SaveSystem folder. Be aware that there are a few issues, a…