Dev Diary 12 - Saving & Loading
When I started this project I set out to make sure that my saving and loading process was implemented as one of the first things. Honestly, if you are a beginner solo dev, work on saving and loading first. You will thank yourself later. My first project I went back after many features were in place, and it was a real pain to get going. In my second project, I didn't get far enough in development to even think about it.
I also wanted to make sure that there were save slots that you could name, and have a little image that would show you the last thing you were looking at.
If you don't name the save, it will just save the name as the time and date.
There is another file that is saved called the save_manager, which keeps track of all the saves that are compatible with the current game version, and keeps track of the directory of thumbnails used in the little image on the save/load screens.
Any time a new version of the game is released it will create another save_manager.
This is because if you try to load a save that is incompatible, the game will instantly crash.
I will show you what a current save_game consists of so you can get an idea of what I'm doing.
Just a brief explanation of what all that is:
"GAME_OPTIONS"
This is all of the options that the player picks when they first make their game. This is all the difficulty options as well as their character appearance, and names.
"MANAGEMENT"
This is a dictionary of all the countries, each country has a dictionary of every item, and every item has a dictionary with some management information in it.
"INVENTORIES"
This is the inventory of every country. Just the quantities of every item.
"WORLD_INVENTORIES"
This is inventory that isn't bound to a specific country. Money, Influence, Research Points, etc.
"MAX_STORAGE"
This is a listing of the max storage of every country. This was done separately because I have to reference max_storage a lot, and having to calculate it several times a frame seems silly.
"TILE_MAPS"
This is a dictionary of countries, and within that is a dictionary of placed tiles with their coordinates. This has all the information, what item is being generated, level, number of workers, production bonuses, etc.
"GENERATION"
This is the dictionary that keeps track of everything being generated. This way, when you build a new building, it gets calculated into the generation dictionary, and it just gets hit every day instead of having to calculate what the generation is every day.
"NEGATIVE_GENERATION"
This is the same as the generation, but what the recipes are using instead of what they are generating.
"RESEARCH"
This keeps track of what researches have been unlocked by the player.
"GAME_TIME"
Game time is super important in the game, I use the date as a way of keeping track of a lot of things, particularly the finance menu and later the graphs when you take your company public. I keep track of the year, month, and day as separate variables. I also keep track of when the next leap year is, and move it forward by 4 years when it is reached.
"MARKET"
This is a dictionary of every country, then within that is the value of every item in their local markets.
"EXPORTS"
This is the world's manifest of every export route that exists, and all the information it needs to keep going.
"EXPORTS_EN_ROUTE"
Some exports will be traveling when the player saves, I just have to make sure they are right where they were when they saved. (This is only the items and money, the model of the transport will not appear when loading.)
"PRIVATE_SHARES"
This keeps track of the private shares. Who owns them, and what their value is.
"LOANS"
This keeps track of what loans are taken out by the player.
"PUBLIC_SHARES_STATUS"
This is just a bool. It says whether or not the player has taken their company public or not.
"PUBLIC_SHARES"
This keeps track of where all the public shares are, and what they are worth.
"PUBLIC_SHARES_HISTORY"
This keeps track of the price history of the company's stock. (Irrelevant data is purged monthly.)
"FINANCIAL_HISTORY"
This keeps track of all the money that comes in and out. All the numbers that can be seen on the finances page. Entries older than 6 months are purged.
"OBJECTIVES"
This keeps track of the objectives, whether they have been completed.
"OBJECTIVE_REWARDS"
This keeps track of whether rewards for objectives have been collected.
"STORY_PROGRESS"
This keeps track of the story progress. Very limited at the moment, but more to come!
Upcoming:
DD13: Finances
DD14: Objectives
DD15: New Game Options
DD16: Character Creation
DD17: ???
Files
Get Factory Default: Build, Trade, Repeat
Factory Default: Build, Trade, Repeat
Develop a worldwide conglomerate where you control the entire production chain.
Status | In development |
Author | SirChett |
Genre | Simulation, Puzzle |
Tags | Economy, factory, Farming, Idle, mining, Singleplayer, supply-chain, Trading, workforce |
Languages | English |
More posts
- Dev Diary 24 - Wrap Up6 days ago
- Dev Diary 23 - Public Shares7 days ago
- Dev Diary 22 - Loans8 days ago
- Dev Diary 21 - Private Shares9 days ago
- Dev Diary 20 - User Settings10 days ago
- Dev Diary 19 - Exports and Trade Vehicles11 days ago
- Dev Diary 18 - Power Generation12 days ago
- Dev Diary 17 - Uncle Ian13 days ago
- Dev Diary 16 - Character Creation14 days ago
- Dev Diary 15 - New Game Options15 days ago
Leave a comment
Log in with itch.io to leave a comment.