-
Notifications
You must be signed in to change notification settings - Fork 27
Godot 4 Save Game #399
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
Godot 4 Save Game #399
Conversation
… instance of Tile.NONE stored explicitly
|
When serialising interfaces or inheritance hierarchies, you need to annotate the interface / base class with the types that implement / inherit from it, along with a type discriminator to store in the JSON (.NET 7 doc). The basic pattern is: This isn't possible to do for the If we keep the separation, I think fundamentally the solution is to make everything in AIData (and every class that implements it) strictly plain old data with no methods (beyond maybe those which access or mutate only internal members), but this seems like an non beneficial restriction for a game that relies heavily upon state and mutating it. I think we should revisit combining the two because issues like these require refactors that provide no benefit other than working around the dependency issue, and the only benefit we get from separating the game data and engine is ease of writing tools, but we can also get this separation by having two distinct namespaces within a single project containing engine code and game data code, if such a separation is necessary. @WildWeazel @QuintillusCFC @maxpetul |
Interesting, so... basically my take is .NET 7 missed it with polymorphic serialization, coming from a Java background where there are libraries like GSON that make it super easy. They do mention at the end of the article that you linked:
But the implementation of that is a lot more complex than it would be for the same thing in Java. As for the AI packages not all being in one area, the EngineStorage is part of it, but the larger-scale picture is extensibility. Everyone's always complaining about the Civ3 AI, so the idea was you could plug your own AI classes in for mods, from your own C# packages. As long as they conformed to the interface for that type of AI (combat AI, city building AI, strategic priority AI, etc.), you could customize them. I think this is similar to how Civ4 did it, although I never really got into Civ4 modding. For that to work, the implementing classes must be able to be outside of C7GameData. One option would be to give up on that customization option and say sorry, everything has to be in C7GameData. I see two viable ways to achieve the original goal though:
|
|
closing, this is stale experiment code |
does not directly address the discussion in #377, but adds the necessary signals to use the save game button in the game menu, and saves/loads games using c# references
it also ~halves the size of saves by not writing common boolean fields when they are
false, since upon serialising the save the default value if not present will befalse.