Savegame date contains unneeded data
Posted: Fri Jul 07, 2023 8:59 am
Hey Pixelcrushers,
I have a question about the savegame system of the Dialogue System.
We are writing away the raw data and combining it with other savegame stuff. Here is what we are using:
And it does all work as it should but I feel, that the savegame file is just much too big. It contains for example conversation descriptions and similar stuff that is totally unnecessary.
The only thing that my game needs are Quests (Name/Id and State) this is needed to drive the conversation selection. And Variables (Name, maybe Type, and Value). There is no need to have my actors in the save game nor any information about my conversations since this is never altered in any way but just selected via values or states in the Quests or the variables.
If I am right, I never change my database except for the quest states or the variable values.
Is there a good way to streamline the save game raw data? Can I simply get rid of the actors for example when writing the raw data, or will it be overwritten with no data if I remove it?
I have a question about the savegame system of the Dialogue System.
We are writing away the raw data and combining it with other savegame stuff. Here is what we are using:
Code: Select all
private byte[] GetRawData()
{
PersistentDataManager.Record();
using (var ms = new MemoryStream())
{
//Some methods of PersistentDataManager need to be public to test this
var writer = new BinaryWriter(ms);
var luaResult = new Result(LuaExtensions.RunRawExt(false, "return Conversation", false, Lua.Environment));
var conversationTable = luaResult.AsTable.luaTable;
prepSimStatusForRawDataMethod.Invoke(null, new object[] { conversationTable });
var luaValue = new Result(LuaExtensions.RunRawExt(false, "return Actor", false, Lua.Environment)).AsTable.luaTable;
if (luaValue != null)
{
writeValueMethod.Invoke(null, new object[] { writer, luaValue});
}
luaValue = new Result(LuaExtensions.RunRawExt(false, "return Item", false, Lua.Environment)).AsTable.luaTable;
if (luaValue != null)
{
writeValueMethod.Invoke(null, new object[] { writer, luaValue });
}
luaValue = new Result(LuaExtensions.RunRawExt(false, "return Location", false, Lua.Environment)).AsTable.luaTable;
if (luaValue != null)
{
writeValueMethod.Invoke(null, new object[] { writer, luaValue });
}
luaValue = new Result(LuaExtensions.RunRawExt(false, "return Variable", false, Lua.Environment)).AsTable.luaTable;
if (luaValue != null)
{
writeValueMethod.Invoke(null, new object[] { writer, luaValue });
}
if (conversationTable != null)
{
writeValueMethod.Invoke(null, new object[] { writer, conversationTable });
}
writeExtraDataMethod.Invoke(null, new object[] { writer });
writer.Flush();
return ms.GetBuffer();
}
}
The only thing that my game needs are Quests (Name/Id and State) this is needed to drive the conversation selection. And Variables (Name, maybe Type, and Value). There is no need to have my actors in the save game nor any information about my conversations since this is never altered in any way but just selected via values or states in the Quests or the variables.
If I am right, I never change my database except for the quest states or the variable values.
Is there a good way to streamline the save game raw data? Can I simply get rid of the actors for example when writing the raw data, or will it be overwritten with no data if I remove it?