~ Forums of Enroth ~

An Enroth diehard fan community
 
HomeHome  ChatChat  FAQFAQ  SearchSearch  RegisterRegister  Log inLog in  
Latest topics
» [EN, RU][Offline] HoMM2 Tournament of the Landless 2017-2 (Турнир Безземельных)
by Orzie 2017-09-21, 03:42

» [EN, RU][Offline] HoMM2 Treasure Hunt Tourney 2017 (Турнир Кладоискателей)
by Orzie 2017-09-20, 16:55

» [EN, RU][Offline] HoMM2 Main Tourney 2017 (Общий Турнир)
by Orzie 2017-09-20, 16:50

» What are you listening to?
by Daleron 2017-09-18, 03:07

» Enrothian Fan Art
by Orzie 2017-09-16, 02:44

» Currently open HoMM1/HoMM2 Tournaments!
by Orzie 2017-09-16, 02:33

» [EN, RU][Offline] HoMM2 Trade Guild Tourney 2017-2 (Турнир Торговой Гильдии)
by Orzie 2017-09-16, 02:05

Poll
"Wait" in HoMM2?
Yes
80%
 80% [ 44 ]
No
20%
 20% [ 11 ]
Total Votes : 55
Most Viewed Topics
H3SW: General Graphics discussion
Ragoon's Graphics For HoMM3SW
H3SW General Discussion
H3SW: Dwelling Development
H3SW Map List: Work in progress
Dervish Faction General Concept
Enrothian Fan Art
H3SW Recruitment Point - Enroth Needs You!
Серия книг "Земли Меча и Магии"
Heroes of Might and Magic 3: The Succession Wars - General info

Share | 
 

 [Ironfist ver 1.3.0] Weight of save files and loading/saving time

View previous topic View next topic Go down 
AuthorMessage
Unknown_Hero
Minotaur
Minotaur
avatar

Messages : 344
Quality Points : 40
Registration Date : 2015-09-06

PostSubject: [Ironfist ver 1.3.0] Weight of save files and loading/saving time   2017-07-17, 04:21

Have you changed what is saved in the save files?
Before the last release, a save file was much less than 500 ko (typically around 300-400 ko for a huge map), now it's more than 1 Mo (1200 ko) for a small map.
Almost 10 Mo for a huge map (9860 ko)!!!

The loading and saving times are very long, several seconds to load or save a file and the game hangs during this time.
Outch...

It was so quick before, almost instant.
Back to top Go down
Darmani
Master Modder
Master Modder
avatar

Messages : 175
Quality Points : 32
Registration Date : 2014-12-27

PostSubject: Re: [Ironfist ver 1.3.0] Weight of save files and loading/saving time   2017-07-17, 08:05

Yes we have. We've moved more data from the original HoMM II binary format into XML. This gives us much more ability to change the savegame format in the future without breaking old saves.

The new format is a bit verbose, and this is causing problems, as you've noticed.
Back to top Go down
Unknown_Hero
Minotaur
Minotaur
avatar

Messages : 344
Quality Points : 40
Registration Date : 2015-09-06

PostSubject: Re: [Ironfist ver 1.3.0] Weight of save files and loading/saving time   2017-07-17, 22:59

Okay I see.

Just a quick idea:

Use a template and save only the values.

Currently:

Save01.sav
***** File Start *****
version="1.0"
blabla01="0" blabla02="0" blabla03="0"
blabla01="0" blabla02="0" blabla03="0"
blabla01="0" blabla02="0" blabla03="0"
blabla01="0" blabla02="1" blabla03="19"
blabla01="0" blabla02="0" blabla03="0"
***** File End *****

Save only the values:

Save01.sav
***** File Start *****
template version="1.0"
0 0 0
0 0 0
0 0 0
0 1 19
0 0 0
***** File End *****

Adding new values to the save file.

Currently:

Save01.sav
***** File Start *****
version="1.1"
blabla01="0" blabla02="0" blabla03="0"
blabla01="0" blabla02="0" blabla03="0"
blabla01="0" blabla02="0" blabla03="0"
blabla01="0" blabla02="1" blabla03="19"
blabla01="0" blabla02="0" blabla03="0"
addedblabla01="0" addedblabla02="0" addedblabla03="0"
addedblabla01="0" addedblabla02="0" addedblabla03="0"
addedblabla01="0" addedblabla02="5" addedblabla03="8"
***** File End *****

Save only the values with added values:

Save01.sav
***** File Start *****
template version="1.1"
0 0 0
0 0 0
0 0 0
0 1 19
0 0 0
0 0 0
0 0 0
0 5 8
***** File End *****

You can even go further and compress the save file, a kind of "zip" save file. Very Happy

If it is necessary to consult and change the values in a save file, this can be done by a small external tool that generates an xml file using the template and the save file and can save the changes to a file in the format of the save file.
If it is necessary to change the save file format to add new values, simply create and add a new template and it is thus possible to keep compatibility with save files of different versions of the program.
This tool can also allow you to update an old version of a save file to the latest version.

Currently, it takes between 12 seconds and 20 seconds of waiting each time the player presses the end of turn button, or when the player loads or saves a save file, this is insane. Twisted Evil
This really makes the game unpleasant to play. Razz

Original Heroes 2 launches and load/saves a save file in a fraction of a second, this makes the game transparent in its use and contributes to the pleasure of playing. <3  ... &lt;3 Smile
Back to top Go down
ComputerPhreak
Pikeman
Pikeman
avatar

Messages : 30
Quality Points : 23
Registration Date : 2016-03-02

PostSubject: Re: [Ironfist ver 1.3.0] Weight of save files and loading/saving time   2017-08-24, 21:05

I see some quick changes that can be made which could potentially speed up the save function.  In game/save.cpp, there are a ton of places that can benefit by using reserve():

Code:
for (int i = 0; i < MAP_WIDTH * MAP_HEIGHT; i++) {
    int x = i % MAP_HEIGHT;
    int y = i / MAP_HEIGHT;
    gs.mapRevealed().push_back(ironfist_save::gamestate_t::mapRevealed_type(x, y));
    gs.mapRevealed().back().revealed(mapRevealed[i]);
  }

In the above, this may cause dozens of memory allocations to the tree::sequence container.  Use its reserve() function at the start to allocate all the memory it will need, since you know the total size needed at the start (in this case, MAP_WIDTH * MAP_HEIGHT).
Back to top Go down
Darmani
Master Modder
Master Modder
avatar

Messages : 175
Quality Points : 32
Registration Date : 2014-12-27

PostSubject: Re: [Ironfist ver 1.3.0] Weight of save files and loading/saving time   2017-08-30, 04:51

Thanks. Good idea!
Back to top Go down
 
[Ironfist ver 1.3.0] Weight of save files and loading/saving time
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» The Save Button is not Saving the Checked Box for the Social Bookmarking Widget
» "Devo Max"-the formula that could save the U.K>
» Save Data JP
» For all the people interested in losing weight
» FFX HD Starter Save

Permissions in this forum:You cannot reply to topics in this forum
~ Forums of Enroth ~ :: Modding Guild :: Heroes of Might and Magic II: Project Ironfist-
Jump to: