stars-4x / starsapi

Java-based API for manipulation of stars! related game files
5 stars 2 forks source link

Share partial data #10

Open vanatteveldt opened 5 years ago

vanatteveldt commented 5 years ago

The file merger tool is a fantastic tool for sharing complete information between allies. However, I sometimes wish to share some information with another player, e.g. if we are waging a war together but I don't have a permanent alliance. So, I would like to be able to share e.g. all planet hab values and ownership, pop and defense% only for enemy planets, all ship locations, and ship designs only of enemy ships.

I had a look at the merger file source code and it looks fairly understandable. So, I would like to make two new tools: Exporter - exports selected information from the .h file into a json (or similar) file Importer - imports the exported json file into an .h file

Does that make sense? Does something like that exist? Does it indeed sound feasible to do something like that?

raptor commented 5 years ago

Hi,

Please feel free to create anything you want, and run a pull request. We'll pretty much accept any and all utilities. If you want to contribute larger amounts of code, I'll even let you be a member of the github group.

vanatteveldt commented 5 years ago

Hey Raptor,

Had a small look this afternoon. Exporting blocks to json is pretty easy. I'll probably just modify the existing h-merger tool to also accept .json files, so it's just one more source of information -- but I haven't programmed java for about 10 years so it'll probably take me some time :D (mostly python these days...)

I noticed that the current tool rolls its own argument parsing code rather than e.g. using apache common-cli. Is there a policy against pulling in dependencies, or is it fine to just use that (and the google gson library for the json de/serialization)?

vanatteveldt commented 5 years ago

I made a first version of the exporter tool: https://github.com/vanatteveldt/starsapi/commit/59c7daa5e31cb2f73b9815a6816ca8321a908251. I'll happily make a PR but I would like to first get a version of the importer running since at the moment it's less useful than the built-in plant stats exporter.

@raptor if you have some time, could you take a look at whether you agree with the code style, and especially the dependency handling? I'm new to maven (I don't think it existed last time I used java :D) so I might easily have messed things up.

Next up: I'll try to add a parser from this json format to blocks so it can be addded to the m file merger.

raptor commented 5 years ago

Hi,

No real policy, I like things to be easy to build so others can pick up with minimal effort. I don't mind 3rd party libs but I do usually favor being lean, because it's easier for new people to not have to to wrestle with dependencies. @tupelo-schneck wrote the original merger code, I think. Maybe he has an opinion.

It's been a while since I've done java development and I don't even know if maven is the relevant tech anymore.

Is there some reason you want an interim format (JSON) instead of just sharing the game files?

ricks03 commented 5 years ago

Well, if you're sharing the game files, then limiting the output doesn't actually accomplish much, because someone could just run against the shared file, right?

Rick

On 2/17/2019 8:42 PM, raptor wrote:

Hi,

No real policy, I like things to be easy to build so others can pick up with minimal effort. I don't mind 3rd party libs but I do usually favor being lean, because it's easier for new people to not have to to wrestle with dependencies. @tupelo-schneck https://github.com/tupelo-schneck wrote the original merger code, I think. Maybe he has an opinion.

It's been a while since I've done java development and I don't even know if maven is the relevant tech anymore.

Is there some reason you want an interim format (JSON) instead of just sharing the game files?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/stars-4x/starsapi/issues/10#issuecomment-464548653, or mute the thread https://github.com/notifications/unsubscribe-auth/An5_RUhMCg7MWBBnzF3KOHMM4EOPKiLNks5vOgUSgaJpZM4a_jXw.

-- Rick Steeves http://www.irelandbybicycle.com

It's all fun and games until someone ends up wearing a cone.

raptor commented 5 years ago

Oh yeah, that makes sense. I forget that people actually play against each other :) I usually play cooperative with a relative against AI.

Edit: maybe I should read the issue title for once...

tupelo-schneck commented 5 years ago

I'm not spending any time these days on Stars! or this project, but I will say my dream was that there would be tools to convert game files to JSON and JSON to game files. I can see all sorts of possibilities there... perhaps as a first little step in writing a new client, even.

For parsing command-line args, I would say jopt-simple is the right library these days, rather than Apache Commons CLI. But I wouldn't complain either way.

vanatteveldt commented 5 years ago

I'm not spending any time these days on Stars! or this project, but I will say my dream was that there would be tools to convert game files to JSON and JSON to game files. I can see all sorts of possibilities there... perhaps as a first little step in writing a new client, even.

Yeah... although at some point just writing a new server would just be easier I think... but not something I'll likely have time for before I retire :)

For parsing command-line args, I would say jopt-simple is the right library these days, rather than Apache Commons CLI. But I wouldn't complain either way.

OK, I'll have a look. I have absolutely no clue who is who in java land these days, so pointers like this are quire welcome!