Skip to content

Convert save data files from json to csv#60

Merged
thompson318 merged 16 commits intomainfrom
km/export-to-csv
Mar 31, 2026
Merged

Convert save data files from json to csv#60
thompson318 merged 16 commits intomainfrom
km/export-to-csv

Conversation

@K-Meech
Copy link
Copy Markdown
Collaborator

@K-Meech K-Meech commented Feb 13, 2026

For #20

This PR converts save data files from .json to .csv format, as discussed in the last meeting. @mmcleod89 and I looked for an existing csv reader integrated into unity, but none appeared to exist - as such, this PR uses built-in functionality like StreamWriter to read / write csv manually.

I wanted to avoid adding lots of boiler plate code to the various GameData classes, so currently all the conversion code is inside SaveData and uses reflection to read / populate the relevant fields. Not sure if this is the best way to do this - so do feel free to change this however you'd like!

Still todo:

  • save data is only created for complete games so far. We need to add saving when a game is stopped early via the exit button / quitting.
  • This keeps the data saved as-is, but David has made a rough outline outline of extra data he'd need: see issue 20. This needs to be discussed / game data classes updated.

Copy link
Copy Markdown
Member

@thompson318 thompson318 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works for me and achieves the aim of writing the data in csv. Couple of minor suggestions.

@thompson318 thompson318 merged commit e381056 into main Mar 31, 2026
1 check passed
@thompson318 thompson318 deleted the km/export-to-csv branch March 31, 2026 10:21
@thompson318 thompson318 mentioned this pull request Apr 1, 2026
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

Successfully merging this pull request may close these issues.

2 participants