Save file/string size part deux
Posted: Sat Jun 16, 2018 10:58 pm
Hey Joel,
I had previously asked about save file size, but I need a little help understanding the size of the string exported by ES3.LoadRawBytes (and presumably the stored save file size). For some background, in my RPG, I was previously saving the name of each item the character was holding (horribly inefficient of course). After I changed my code to only store a couple Item IDs as ushorts instead of the (up to) 10 character item names, the LoadRawBytes string actually got larger! I even changed several int's into ushort's, but still the save string is bigger.
So, as an exercise, I went through and counted up the bytes I expected to be generated with each new item added to the character. When I add an item to my character, it added 349 new characters to the RawBytes string. However, I'm expecting much less characters based on the code below. I'm counting 2 bytes for each ushort, 4 bytes for each int, and 1 byte for each boolean, and finally not sure how many for the empty custom List or "itemAffixes" objects (assuming <=2?).
Ultimately, I'm trying to understand 1) Why are so many bytes added, when the data sizes are dramatically less? and 2) Is there any recommendations for crunching down the string generated by LoadRawBytes()?
I had previously asked about save file size, but I need a little help understanding the size of the string exported by ES3.LoadRawBytes (and presumably the stored save file size). For some background, in my RPG, I was previously saving the name of each item the character was holding (horribly inefficient of course). After I changed my code to only store a couple Item IDs as ushorts instead of the (up to) 10 character item names, the LoadRawBytes string actually got larger! I even changed several int's into ushort's, but still the save string is bigger.
So, as an exercise, I went through and counted up the bytes I expected to be generated with each new item added to the character. When I add an item to my character, it added 349 new characters to the RawBytes string. However, I'm expecting much less characters based on the code below. I'm counting 2 bytes for each ushort, 4 bytes for each int, and 1 byte for each boolean, and finally not sure how many for the empty custom List or "itemAffixes" objects (assuming <=2?).
Code: Select all
writer.WriteProperty("namePart1", instance.namePart1, ES3Type_ushort.Instance);
writer.WriteProperty("namePart2", instance.namePart2, ES3Type_ushort.Instance);
writer.WriteProperty("itemID", instance.itemID, ES3Type_int.Instance);
writer.WriteProperty("equipped", instance.equipped, ES3Type_bool.Instance);
writer.WriteProperty("level", instance.level, ES3Type_int.Instance);
writer.WriteProperty("characterLevels", instance.characterLevels, ES3Type_int.Instance);
writer.WriteProperty("slot", instance.slot, ES3Type_ushort.Instance);
writer.WriteProperty("iconID", instance.iconID, ES3Type_int.Instance);
writer.WriteProperty("rarity", instance.rarity, ES3Type_ushort.Instance);
writer.WriteProperty("gearScore", instance.gearScore, ES3Type_int.Instance);
writer.WriteProperty("category", instance.category, ES3Type_ushort.Instance);
writer.WriteProperty("uncommonPrefixID", instance.uncommonPrefixID, ES3Type_ushort.Instance);
writer.WriteProperty("rarePrefixID", instance.rarePrefixID, ES3Type_ushort.Instance);
writer.WriteProperty("inventorySlot", instance.inventorySlot, ES3Type_ushort.Instance);
writer.WriteProperty("qty", instance.qty, ES3Type_int.Instance);
writer.WriteProperty("tier", instance.tier, ES3Type_ushort.Instance);
writer.WriteProperty("slotArea", instance.slotArea, ES3Type_ushort.Instance);
writer.WriteProperty("itemAffixes", instance.itemAffixes);