Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate away from XML to JSON or SKON #1675

Open
hcorion opened this issue Dec 9, 2016 · 4 comments
Open

Migrate away from XML to JSON or SKON #1675

hcorion opened this issue Dec 9, 2016 · 4 comments

Comments

@hcorion
Copy link
Contributor

hcorion commented Dec 9, 2016

So it's been talked about that we need to migrate away from XML. The obvious alternative is JSON, however SKON, which was created specifically for ProjectPorcupine is also a valid, although less stable alternative.

I would like to start woking on this, however I don't want to port everything to JSON, then SKON would be ready, then have to re-port everything to SKON. IMO it would be better to wait for SKON to be ready than to port it to JSON now.

If SKON or SKON.NET is not yet ready, is there some issues we can track before this can be implemented?

@NogginBops already started work on porting some of the XML sprites to SKON, you can see his commit here: NogginBops/ProjectPorcupine@79f909a and the branch: NogginBops/ProjectPorcupine/skon-sprites

I would be willing to start porting the localization to SKON, as I'm already quite familiar with that section of the codebase.

Pings @NogginBops @longtomjr

Links:
https://github.com/SpaceKrakens/SKON SKON
https://github.com/SpaceKrakens/SKON.NET SKON .NET Parser

@koosemose
Copy link
Collaborator

As it stands, the official goal is completing the port to JSON. If SKON is to be implemented (which is not definite as it was a far outlier in the original discussion), it needs to have enough documentation that it can be seen how to use it, and make an informed decision on its use without everyone needing to dig through the code to figure out how to use it. It needs to be shown to be reasonably fast (the last benchmarks I saw it was drastically slower than JSON or XML). It also has to have suitable ways to access it, so far, from the example with sprites, I've seen it has what the JSON.net implementation calls Linq-like (basically creating Dictionaries and arrays nested inside eachother), basically what is used in save file loading, it would also need attribute based automatic deserialization (and preferably serialization) like what the component system has.

That being said, it has a general structure very similar to JSON, and as it has the linq-like access method, and if it has or can have added the attribute based de/serialization, that means, if we switch to JSON, and then later SKON is found to be suitable, the changeover from JSON to SKON will be fairly trivial, as the methods to de/serialize, are similar enough that it should simply require changing a few method names and object types. Whereas the changeover from XML to JSON (or SKON) is much more complex (where it uses the very awkward XMLreader). It would be less overall work changing to JSON as soon as possible, even if we eventually change over to SKON, as any new things implemented that need to read data will most likely be implemented in XML as that's what the bulk of the system is still on, meaning the changeover will be the more difficult XML -> (JSON or SKON) instead of the much easier JSON to SKON.

@hcorion
Copy link
Contributor Author

hcorion commented Dec 11, 2016

For reference as of the day this was posted here is a list of the .xml files in PP:

/Assets/StreamingAssets/Data/ConsoleCommands.xml
/Assets/StreamingAssets/Data/Currency.xml
/Assets/StreamingAssets/Data/Furniture.xml
/Assets/StreamingAssets/Data/GameEvents.xml
/Assets/StreamingAssets/Data/Headlines.xml
/Assets/StreamingAssets/Data/Inventory.xml
/Assets/StreamingAssets/Data/Need.xml
/Assets/StreamingAssets/Data/Overlay.xml
/Assets/StreamingAssets/Data/Quest.xml
/Assets/StreamingAssets/Data/RoomBehavior.xml
/Assets/StreamingAssets/Data/SheduledEvents.xml
/Assets/StreamingAssets/Data/Ships.xml
/Assets/StreamingAssets/Data/Stats.xml
/Assets/StreamingAssets/Data/Tiles.xml
/Assets/StreamingAssets/Data/Trader.xml
/Assets/StreamingAssets/Data/Utility.xml
/Assets/StreamingAssets/Data/WorldGenerator.xml
/Assets/StreamingAssets/Images/Character/char1_spacesuit.xml
/Assets/StreamingAssets/Images/Furniture/accumulator.xml
/Assets/StreamingAssets/Images/Furniture/air_pump.xml
/Assets/StreamingAssets/Images/Furniture/airlock_door_horizontal.xml
/Assets/StreamingAssets/Images/Furniture/airlock_door_vertical.xml
/Assets/StreamingAssets/Images/Furniture/Astro_Wall.xml
/Assets/StreamingAssets/Images/Furniture/berth.xml
/Assets/StreamingAssets/Images/Furniture/cloning_pod.xml
/Assets/StreamingAssets/Images/Furniture/copper_ore.xml
/Assets/StreamingAssets/Images/Furniture/door_horizontal.xml
/Assets/StreamingAssets/Images/Furniture/door_vertical.xml
/Assets/StreamingAssets/Images/Furniture/fission_reactor.xml
/Assets/StreamingAssets/Images/Furniture/ice_source.xml
/Assets/StreamingAssets/Images/Furniture/iron_ore.xml
/Assets/StreamingAssets/Images/Furniture/metal_smelter.xml
/Assets/StreamingAssets/Images/Furniture/mine_iron.xml
/Assets/StreamingAssets/Images/Furniture/mine_uranium.xml
/Assets/StreamingAssets/Images/Furniture/mining_drone_station.xml
/Assets/StreamingAssets/Images/Furniture/oxygen_compressor.xml
/Assets/StreamingAssets/Images/Furniture/oxygen_generator.xml
/Assets/StreamingAssets/Images/Furniture/power_cell_press.xml
/Assets/StreamingAssets/Images/Furniture/RTG.xml
/Assets/StreamingAssets/Images/Furniture/small_landing_pad.xml
/Assets/StreamingAssets/Images/Furniture/steel_wall.xml
/Assets/StreamingAssets/Images/Furniture/Stockpile.xml
/Assets/StreamingAssets/Images/Furniture/uranium_ore.xml
/Assets/StreamingAssets/Images/Furniture/Vent.xml
/Assets/StreamingAssets/Images/Inventory/Copper Plate.xml
/Assets/StreamingAssets/Images/Inventory/Copper Wire.xml
/Assets/StreamingAssets/Images/Inventory/Ice.xml
/Assets/StreamingAssets/Images/Inventory/Power Cell.xml
/Assets/StreamingAssets/Images/Inventory/Raw Copper.xml
/Assets/StreamingAssets/Images/Inventory/Raw Iron.xml
/Assets/StreamingAssets/Images/Inventory/Steel Plate.xml
/Assets/StreamingAssets/Images/Inventory/Uranium.xml
/Assets/StreamingAssets/Images/RoomBehavior/Airlock.xml
/Assets/StreamingAssets/Images/Ship/essentia.xml
/Assets/StreamingAssets/Images/Trader/BasicHaulShip.xml
/Assets/StreamingAssets/Images/UI/CursorCircle.xml
/Assets/StreamingAssets/Images/UI/CursorPointer.xml
/Assets/StreamingAssets/Images/UI/CursorSelect.xml
/Assets/StreamingAssets/Images/UI/CursorShip.xml
/Assets/StreamingAssets/Images/UI/CursorText.xml
/Assets/StreamingAssets/Images/UI/Deconstruct.xml
/Assets/StreamingAssets/Images/UI/MiningIcon.xml
/Assets/StreamingAssets/Images/Utility/Power_Cables.xml
/Assets/StreamingAssets/Images/Utility/Water_Pipes.xml
/Assets/StreamingAssets/Localization/config.xml
/Assets/StreamingAssets/MainMenu/Images/Background/red-planet-background.xml
/Assets/StreamingAssets/Settings/Settings.xml
/Assets/StreamingAssets/UI/DialogBoxes/TestDB.xml

@BraedonWooding
Copy link
Collaborator

BraedonWooding commented Dec 11, 2016

And /Assets/SteramingAssets/Data/SettingsTemplate.xml. (For the settingsMenu, which isn't on master yet)

@bjubes
Copy link
Collaborator

bjubes commented Dec 11, 2016

as well as the localization config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants