afrit
10-12-2005, 06:34
To my knowledge, there is no possible way right now to limit production of certain units to a certain time frame. But I thought of a solution while trying to figure out the save game file format.
Here's how it would work:
1. Make a new line of buildings (say steel_maker) with several levels
2. Provide the lower level to all settlements in descr_strat.txt
3. Make it impossible for any faction to upgrade
4. Make new-era units dependent on higher level of building .
5. This is the tricky part. When the new era year arrives, have the user save the game, then in the saved game file edit all the buildings to the higher steel_maker level. Reload the game and the new units will be available.
#5 will require the writing of a simple program with BASIC or C++. Let the program run in the background (i.e as a daemon) and let it check the autosave file in the saves folder every 10 seconds or so.
If the autosave file changes (which it does when when the player hits end turn), the daemon will read the file and check the year in the file. If the new era arrived, the daemon will alert the player (e.g play a sound) that an event has happened. The player is asked to save the current game (by now it's player's turn again and the AI has finished its part). And then the daemon will go through the saved game and upgrade all the steel_makers to the necessary level.
When the player resumes the game (by re-loading), the new units should become available.
The 2 key parts are figuring out how to edit the year and the level of buildings. I know the year is editable because romeSAGE does that. And I figured out how to edit the buildings. The building level is 5 bytes after the building name in the save game file. I tested this by saving a game soon after starting, and then updating all barracks level by one. And sure enough, when I reloaded, I could build higher units .
Now, before I try to write such an application, is there a reason that the above would not work?
feedback appreciated.
Here's how it would work:
1. Make a new line of buildings (say steel_maker) with several levels
2. Provide the lower level to all settlements in descr_strat.txt
3. Make it impossible for any faction to upgrade
4. Make new-era units dependent on higher level of building .
5. This is the tricky part. When the new era year arrives, have the user save the game, then in the saved game file edit all the buildings to the higher steel_maker level. Reload the game and the new units will be available.
#5 will require the writing of a simple program with BASIC or C++. Let the program run in the background (i.e as a daemon) and let it check the autosave file in the saves folder every 10 seconds or so.
If the autosave file changes (which it does when when the player hits end turn), the daemon will read the file and check the year in the file. If the new era arrived, the daemon will alert the player (e.g play a sound) that an event has happened. The player is asked to save the current game (by now it's player's turn again and the AI has finished its part). And then the daemon will go through the saved game and upgrade all the steel_makers to the necessary level.
When the player resumes the game (by re-loading), the new units should become available.
The 2 key parts are figuring out how to edit the year and the level of buildings. I know the year is editable because romeSAGE does that. And I figured out how to edit the buildings. The building level is 5 bytes after the building name in the save game file. I tested this by saving a game soon after starting, and then updating all barracks level by one. And sure enough, when I reloaded, I could build higher units .
Now, before I try to write such an application, is there a reason that the above would not work?
feedback appreciated.