StrangeLoopGames / EcoIssues

131 stars 21 forks source link

Laws: Import/export law via string #4090

Open MarjieAVolk opened 6 years ago

MarjieAVolk commented 6 years ago

So picture this, I create a law on my server and my friend wants to use it on their server. So I go into my law window and click like 'copy', which puts a string on my clipboard, which I can give to my friend. Then my friend goes to their server, clicks Propose Law, and on the web site there's like an Import Law button or something, that brings up a box I can paste this string into, which will update my law draft to match the other law draft.

I think it will make sense to have this be on both the web site and the game client, but the server can handle all the packing/unpacking of law proposal to string.

j3fffff commented 6 years ago

sounds cool, will get to it eventually

BlazeGuy2 commented 6 years ago

This issue was moved to StrangeLoopGames/EcoSuggestions#284

MarjieAVolk commented 6 years ago

Moved back

Deantwo commented 5 years ago

If the import/export file format is something simple like XML, then we can create third-party law creation programs. This would help the community a lot.

Reyalsorik commented 5 years ago

This is exactly what I've been hoping for. I'm glad to see that a request has already been opened.

Alteraner commented 5 years ago

I would support it as well and hope for it soon. Redefine would although be fantastic, so I need not to configure the whole law again, just to change one bit.

thomasfn commented 3 years ago

Would like to revitalise this suggestion. At the very least, you'd be helping out the White Tiger crew who have to preload that official server with a set of laws at the start of every iteration, which takes ages, as they could just import them instead.

The string could be in json or xml format. The serialisation of the law object itself shouldn't be too hard, since it's already being serialised for replication to the client, and persistence to the server database. The challenge is probably dealing with the references, since a law can reference titles, district maps, bank accounts and just about anything else - you can't rely on internal object IDs being the same between export/import, so you'd need to store the referenced object names as strings, and have some logic to resolve those when deserialising. Maybe you could offer a UI to manually resolve those if they can't be found, e.g. "failed to find district Main Road when importing law, please select from this list of districts which one to use instead".

Apart from copying laws between servers, this also opens the door for 3rd party tools generating laws, which could be very helpful for those big annoying laws (you know, the ones that require an entire section per animal species or whatever).