lassefolkersen / highfrontier

The goal of High Frontier is a civilization-like game, which uses more realistic modelling of economy, climate, research and migration. Uniquely this game starts today - the initiation date of a game is todays date and the existing world is the world as we know it today, complete with cities and countries and people. The aim from there - that is whatever the player thinks the aim is for the world. Developing of the underdeveloping world, action against climate changes, expansion into the rest of the solar system, or just racking in a lot of money.
13 stars 3 forks source link

Going away from pickle #27

Open lionel42 opened 4 months ago

lionel42 commented 4 months ago

Pickle is not a good tool to save files, it has many security issues.

With the recent developpements, we have moslty removed all the pickle dependence.

The last one that we need to change would the the game saving/loading in the solarsystem.py file. functions save/load_solar_system .

I would suggest to save all the necessary data to a .json format, as it is very easy to interact with.

What do you think about this suggestion ?

lassefolkersen commented 4 months ago

Sounds good. Yes I like json too. Now.

JonathanLochridge commented 4 months ago

JSON is cool, would make saves a little larger. But in theory that opens things up to allow savegame editing and creating mods/scenarios easier?

lassefolkersen commented 4 months ago

They're currently 40MB, which was a lot in 2009, less today. I think we could probably scrape out some further non-essential things to slim to counter-act, right now the logic is just "save the entire solar system. but remove images because they don't pickle". Maybe better to start listing the stuff that we know to be needed for a save?

Also - I'm a big fan of the json, because I - today - know much more about working with that, and it could be a real enabler for tuning the whole company/firm logic computer player intelligence ("2009 AI"). In most play-throughs I do, the markets find reasonable equilibrium after a while, but having a (more) workable data format we could do some really really cool things about pre-training everything ("2024 AI")

JonathanLochridge commented 4 months ago

I love JSON too, In a lot of my favorite open source games, they have content encoded in JSON, which makes it much easier for non-programmers to make content additions/mods, and contributions. It worked particularly well for CDDA.

And JSON and textfiles specifying elements of the program are how I first got started modding games before I even knew a thing about coding.

Although, with this genre of game it might not help as much. (although, maybe we start get custom scenarios and such?)