• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[Import] Saveload/ system suggestions

Status
Not open for further replies.

EdgeOfChaos

E

EdgeOfChaos

There are lots of systems out there, so I'm wondering what the best save systems right now are. I've been using TriggerHappy's codegen for all of my maps, but right now it's breaking when given large numbers and sometimes refusing to save items, so I need to migrate it to a new system. I used AceHart's before, but it breaks even sooner.

I just tried Nestharus, and it works with small numbers but fails when I have it saving even a few million (this isn't even large).

I need a code system that saves large numbers (up to MAX_INT) and consistently works. Any suggestions on what to use?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
I suspect a big problem may be the op limit. Between the base conversion and compression it is very easy for a save load system to reach the operation limit and crash before completion.

Out of interest, why are you saving values as large as MAX_INT (2,147,483,647)? Unless you are using it for flags, in which case the save system should offer a special API to do this more efficiently, then such numbers generally point towards poor map design.

Long ago I wrote a very simple save/load API that should in theory support any integer size. The problem with it was a lack of compression, meaning that if you want to save a 32bit value it has to always store 32bits of data with it.
 

Kazeon

Hosted Project: EC
Level 34
Joined
Oct 12, 2011
Messages
3,449
Just split the number. 2147483647=> 2 | 147 | 483| 647
On load => 2 * 1000000000 + 147 * 1000000 + 483 * 1000 + 647
The block size is up to you of course. (Note that the multiplier is not a saved value)

It doesn't exactly get rid of the op limit problem especially if you have a lot of other saved data. The only solution is for you to know how to handle the threading, and it's not a trivial stuff.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
A temporary work around would be to generate 2 save codes, something that should not annoy players too much thanks to file IO.

Each code is generated on its own thread. When loading both codes must first be entered, then both are parsed on separate threads with the results stored in intermediate variables. If both codes load successfully then it processes the intermediate variable state in another thread, otherwise loading fails.
 

EdgeOfChaos

E

EdgeOfChaos

I need to save very large numbers because stats can go that high. I'm not sure what type of compression those systems use, but it *is* possible to save those, just not completely consistently. Two codes is possible, as is number splitting. I may try those. Thanks for the suggestions.
 
Hero attributes are limited to the 32bit signed integer, same for visual armor and visual damage on a units interface though armor should be a real too however only a few abilities can display its true form. Health and mana as well somewhat damage bypasses this as they're reals. The best course of action is likely what Quilnez has suggested which is to split the number when it is greater then 999,999 and add in an extra identifier integer along with it to know what/when multiplication is needed. Until 1 or 2 billion this should use less characters on the string too so that is a bonus.
 
Status
Not open for further replies.
Top