~ Forums of Enroth ~

An Enroth diehard fan community
 
HomeHome  FAQFAQ  SearchSearch  RegisterRegister  Log inLog in  
Latest topics
» [H3SW 0.8.1] The Ultimate Mug of Ale
[Ironfist ver 1.3.0] Weight of save files and loading/saving time Icon_minitimeby Ctesiphon Today at 06:27

» Lands of Enroth 2018 & 2019
[Ironfist ver 1.3.0] Weight of save files and loading/saving time Icon_minitimeby GodRage Today at 06:14

» Heroes of Might & Magic 2 Civilization 2 Mod!
[Ironfist ver 1.3.0] Weight of save files and loading/saving time Icon_minitimeby GodRage Today at 05:15

» [H3SW 0.8.1] A Crossroad Tavern
[Ironfist ver 1.3.0] Weight of save files and loading/saving time Icon_minitimeby GodRage Yesterday at 21:23

» [H3SW 0.8.1] Migration
[Ironfist ver 1.3.0] Weight of save files and loading/saving time Icon_minitimeby Ctesiphon Yesterday at 20:46

» play online
[Ironfist ver 1.3.0] Weight of save files and loading/saving time Icon_minitimeby YhyJasne Yesterday at 09:30

» Lands of Enroth - Maps system
[Ironfist ver 1.3.0] Weight of save files and loading/saving time Icon_minitimeby Orzie Yesterday at 00:45

Poll
"Wait" in HoMM2?
Yes
[Ironfist ver 1.3.0] Weight of save files and loading/saving time Redbar1180%[Ironfist ver 1.3.0] Weight of save files and loading/saving time Redbar12
 80% [ 55 ]
No
[Ironfist ver 1.3.0] Weight of save files and loading/saving time Redbar1120%[Ironfist ver 1.3.0] Weight of save files and loading/saving time Redbar12
 20% [ 14 ]
Total Votes : 69
Most Viewed Topics
H3SW: General Graphics discussion
Ragoon's Graphics For HoMM3SW
H3SW General Discussion
H3SW: Dwelling Development
Heroes of Might and Magic 3: The Succession Wars - General info & Announcements
H3SW Map List: Work in progress
Welcome fellow Enrothians!
Heroes III: The Succession Wars v0.8.1 Beta
Enrothian Fan Art
Commanders?

Share
 

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

Go down 
AuthorMessage
Unknown_Hero
Vampire
Vampire
Unknown_Hero

Messages : 471
Quality Points : 63
Registration Date : 2015-09-06

[Ironfist ver 1.3.0] Weight of save files and loading/saving time Empty
PostSubject: [Ironfist ver 1.3.0] Weight of save files and loading/saving time   [Ironfist ver 1.3.0] Weight of save files and loading/saving time Icon_minitime2017-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... [Ironfist ver 1.3.0] Weight of save files and loading/saving time 1872340274

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

Messages : 244
Quality Points : 40
Registration Date : 2014-12-27

[Ironfist ver 1.3.0] Weight of save files and loading/saving time Empty
PostSubject: Re: [Ironfist ver 1.3.0] Weight of save files and loading/saving time   [Ironfist ver 1.3.0] Weight of save files and loading/saving time Icon_minitime2017-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
Vampire
Vampire
Unknown_Hero

Messages : 471
Quality Points : 63
Registration Date : 2015-09-06

[Ironfist ver 1.3.0] Weight of save files and loading/saving time Empty
PostSubject: Re: [Ironfist ver 1.3.0] Weight of save files and loading/saving time   [Ironfist ver 1.3.0] Weight of save files and loading/saving time Icon_minitime2017-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
ComputerPhreak

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

[Ironfist ver 1.3.0] Weight of save files and loading/saving time Empty
PostSubject: Re: [Ironfist ver 1.3.0] Weight of save files and loading/saving time   [Ironfist ver 1.3.0] Weight of save files and loading/saving time Icon_minitime2017-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
Darmani

Messages : 244
Quality Points : 40
Registration Date : 2014-12-27

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

Thanks. Good idea!
Back to top Go down
Unknown_Hero
Vampire
Vampire
Unknown_Hero

Messages : 471
Quality Points : 63
Registration Date : 2015-09-06

[Ironfist ver 1.3.0] Weight of save files and loading/saving time Empty
PostSubject: Re: [Ironfist ver 1.3.0] Weight of save files and loading/saving time   [Ironfist ver 1.3.0] Weight of save files and loading/saving time Icon_minitime2018-09-05, 04:53

Has there been progress for loading and saving time? Currently, the game is impractical because of this, it's really too long.
Every turn is a real martyr. [Ironfist ver 1.3.0] Weight of save files and loading/saving time 4033187047
Back to top Go down
Sponsored content




[Ironfist ver 1.3.0] Weight of save files and loading/saving time Empty
PostSubject: Re: [Ironfist ver 1.3.0] Weight of save files and loading/saving time   [Ironfist ver 1.3.0] Weight of save files and loading/saving time Icon_minitime

Back to top Go down
 
[Ironfist ver 1.3.0] Weight of save files and loading/saving time
Back to top 
Page 1 of 1
 Similar topics
-
» Is there a way to save all the forum?
» When a user enters skype details into their profile and hit save, it doesn't save.
» Automatically save posts in progress
» [CODE] Save Energy
» Some Ironfist changes I am working on

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: