Good morning, Arth citizens!
Yesterday, I did some more development on the ship configuration door. Part of this was to add some game data about the ship such as the buy / sell price of equipment, mass, and so on. Then it occurred to me that I should probably tell you all how I am setting up the game data for this Starflight remake.
It’s all quite simple, actually. First of all, I set up all of the game data using Google Sheets. I made this file public on Google and here is the link to view it:
Starflight Game Data on Google Sheets
You will also need a Google Sheets plug-in called “Export Sheet Data” which is free and you can get it by going to “Add-ons” > “Get add-ons…”.
The process of exporting the game data is as follows:
- Open up the Google Sheets file
- Going to “Add-ons” > “Export Sheet Data” > “Open Sidebar”
- Leave all of the configuration settings for “Export Sheet Data” at default settings, except for the following:
- Under “General”, enable “Replace existing file(s)”
- Under “General”, enable “Collapse single row sheets”
- Under “JSON” enable “Export sheet arrays”
- Click on the blue “Export” button
- It will export to a file named “Starflight Game Data.json” to your Google Drive.
- Click on the blue link to view the exported file
- Click on the Download button (down arrow at the upper right corner)
- The JSON file will download onto your computer
- Copy (or move) the downloaded JSON file, into the Assets/Scenes/Persistent/Resources/GameData folder
That’s it!
Now, when you look at this file within Google Sheets, you will notice that the names of each sheet match the names of the variables that the sheet data is to be loaded into. For example, the race data sheet is named “m_raceList”, because if you look inside the GameData.cs script, you will see that it has a variable called “m_raceList” of type Race[].
Also, within each sheet, the column headings (data in the first row) all also have variable names such as “m_name”, “m_scienceInitial”, etc. For the race data sheet, you will see that they all correspond to the variable names of the Race class. Doing it this way, my game code can magically load the game data directly from this JSON file with zero manual parsing.
The following are screenshots of this process. Note that the screenshots are of an older version of this export tool, and things have changed slightly since then. The instructions above are accurate.
Leave A Comment