Savegame versions

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Savegame versions

Post by TrueBrain »

Currently, we are to naggy about new savegame version. Some things I want like to see different.

First, MINOR version is NEVER used. It is saved, but never loaded. My suggestion is to get ride of it.

Second, the savegames are ready for 65536 MAJOR versions. Why don't we change the savegame more often. Now we are waiting and putting it all together, having some known bugs in the nightly builds, because we don't want to update the savegame version yet. Who cares if we hit 200 versions. So my suggestion is, that every time someone wants to change something in the savegame, let him do it, bump the version, make sure it keeps backwards compatible, and we are all happy :)

So.. let me know what you devs think of it :)
User avatar
Celestar
Director
Director
Posts: 574
Joined: 02 Jul 2004 10:56
Contact:

Post by Celestar »

100% agree.

Celestar
User avatar
Bernhard
Transport Coordinator
Transport Coordinator
Posts: 293
Joined: 11 Mar 2004 11:26
Location: 52º31'20"N 13º17'51"O

Post by Bernhard »

100 % agree
User avatar
dominik81
OpenTTD Developer
OpenTTD Developer
Posts: 768
Joined: 16 Aug 2003 12:55
Location: Bonn, Germany

Post by dominik81 »

version is a uint. 256 values for major version, 256 values for minor version. And the minor version is being used a few times, e.g. for correct town owner handling and for compatibility with new airports. The minor version can be increased whenever something is added to a savegame without breaking the old savegames. The major version is used to ensure downward compatibility.
"There's a readme that comes with the source. I suggest you read it."
- Korenn
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Post by TrueBrain »

dominik81 wrote:version is a uint. 256 values for major version, 256 values for minor version. And the minor version is being used a few times, e.g. for correct town owner handling and for compatibility with new airports. The minor version can be increased whenever something is added to a savegame without breaking the old savegames. The major version is used to ensure downward compatibility.
Excuse me? Version is an uint indeed.. this is 32-bit... this means that there are 65536 major and 65536 minor versions.. check stdafx.h for the define of uint.. you will see it is an unsigned int, and an int is 32-bit.. even more: it is saved as a raw 32-bit integer.. so we have a _lot_ of versions to go ;)

And as you point out yourself, minors are used very little. They are set back to 0 after a major, so they don't really have a purpose... but we can keep it, it does not really matter :)
User avatar
dominik81
OpenTTD Developer
OpenTTD Developer
Posts: 768
Joined: 16 Aug 2003 12:55
Location: Bonn, Germany

Post by dominik81 »

Sorry, I was wrong there of course. But in SaverLoader struct the variable version is a byte. I didn't examine the save/load code close enough yet to say which way it is stored in the game. But internally bytes are used in most places for the version number (e.g. struct SaveLoadGlobVarList as well).
Anyway, I think that minor versions are underused. And in many cases you do not have to store extra variables to implement a new feature. So even though the savegame version of course shouldn't hinder the implementation of a new feature, it shouldn't necessarily be raised for every new patch.
"There's a readme that comes with the source. I suggest you read it."
- Korenn
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Post by TrueBrain »

dominik81 wrote:Sorry, I was wrong there of course. But in SaverLoader struct the variable version is a byte. I didn't examine the save/load code close enough yet to say which way it is stored in the game. But internally bytes are used in most places for the version number (e.g. struct SaveLoadGlobVarList as well).
Anyway, I think that minor versions are underused. And in many cases you do not have to store extra variables to implement a new feature. So even though the savegame version of course shouldn't hinder the implementation of a new feature, it shouldn't necessarily be raised for every new patch.
A byte is easly changed in an uint16, even more because it is not saved ;)
User avatar
Celestar
Director
Director
Posts: 574
Joined: 02 Jul 2004 10:56
Contact:

Post by Celestar »

Truelight:

change it to uint16 please :)

Celestar
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 3 guests