-
Notifications
You must be signed in to change notification settings - Fork 0
Home
SimCoast is a research project that aims to develop a simulation video game teaching tool that focuses on teaching the public about coastal recession caused by the human activity-accelerated coastal erosion. The game draws upon data and published research to create game mechanics that mimic real-world events.
The main game loop takes place in start_map.tscn, more specifically the process() function within start_map.gd
.
The game makes use of numerous singletons to perform the desired actions required to make the game work correctly.
The list of implemented singletons can be found within Project/Project Settings/AutoLoad
. The singletons are instantiated in a top-down fashion, which is important when considering that some lower-level singletons depend on the instantiation of higher-level singletons.
One of the most important singletons is Global.gd
.
Almost all scripts make use of this singleton. It acts as the location of global variables that need to be accessed by multiple functions, such as TileMap.
The most basic object in SimCoast is the Tile. A tile has numerous member variables and associated functions that store and manipulate the state of the tile. Each tile can also have geometric objects that represent terrain or buildings, which is drawn using TileCube.gd
.
A collection of tile objects make up the game map (the city), which is represented as TileMap within Global.gd
.
Generally speaking, most functions outside of the main game loop either update the game state or update graphics. The process() function (which, again, is known as the main game loop) makes calls to functions that handle game state or graphics updates. These functions then call individual singletons to handle the desired work. In this way, everything becomes modular.
This E/R Diagram was created during Fall 2022. It visualizes many of the interactions between SimCoast's various systems.
The Godot engine is very lightweight and portable, so setup for this project is correspondingly simple:
- Download the Godot Engine, LTS version 3.5.3, without C# support.
- Extract the downloaded zip file to your desired install location. It should contain only two files: an exe and a command script.
- Clone the SimCoast repository to your desired repository location, not necessarily the same as your Godot install location.
- Run the Godot application. For example, on Windows with the most recent version as of now, run the file
Godot_v3.5.3-stable_mono_win64.exe
. - On the Godot splash screen, click the 'Import' button.
- Browse to the
project.godot
file found in your now-local SimCoast repository clone--this is what allows your SimCoast repository to be far away from your Godot installation. - Import the project using the
project.godot
file. - At this point, Godot should automatically open the project in 'Edit' mode. This will automatically import all of the required assets. If that does not happen, return to the splash screen and open SimCoast in 'Edit' mode manually so the import still happens. The game will not run unless this initial import is completed.
- Close the 'Edit' mode with
ctrl-shift-q
or by navigating toProject > Quit to Project List
. - Open SimCoast in 'Run' mode to verify that all assets have been properly imported.
- If you see a screen that looks something like the below, then you are done!
If you are encountering an issue, try uninstalling and reinstalling Godot--making sure to use the right version. When writing this setup documentation I encountered an issue with Godot 3.3 that was resolved upon upgrading to Godot 3.5.
As a reminder, we have now moved away from Mono, which is a build tool that would allow Godot to support C#. We used to use this version, but since SimCoast doesn't actually include any C# code we don't need Mono. This should eliminate a lot of build errors, since Godot without C# support can build on its own with no external tooling.
There will be times when it is desired to send SimCoast in a nicely packaged format that someone can just click to open and have the full game right there in front of them. That is the subject of this section. The steps below are for exporting to Windows only, and have only been verified to work with Windows 11. Instructions for other operating systems will come later.
Note: Before exporting, make sure to clean out any saved data from your game, as the export will also take any saves you have created and export those as well, which is not ideal. The user-created saves can be found here: %AppData%\Roaming\Godot\app_userdata\SimCoast\saves
. The game-created continue file can be found here: %AppData%\Roaming\Godot\app_userdata\SimCoast\data
. Please delete all files in both of these locations prior to export.
- To export in Godot, you need to have the proper export template. The editor can download these for you. Navigate to
Editor >> Manage Export Templates
to open the Export Template Manager. - Once you have that screen open, make sure the version at the top matches the expected version. In my case, it is 3.5.3.stable.
- There will be a default folder selected to install the templates, this can be left alone unless you wish to change it. Your mileage may vary, so only change it if you are willing to fix any resulting errors.
- The dropdown menu for "download from" gives three options: best available mirror, official GitHub releases mirror, and the TuxFamily mirror. I suggest keeping it selected to best available, but if the install fails for some reason feel free to try the specific mirrors individually.
- Once you have selected your mirror, click "Download and Install", and the export template should download automatically to your device. You may close the Export Template Manager.
- Navigate to
Project >> Export...
to open the Export Menu. - Click "add" on the top and select "Windows Desktop".
- Check the "runnable" option.
- Select your desired export path where the EXE will go when the export is done.
- Set the "options" tab to look like mine, shown below.
- Move to the "resources" tab and make sure "Export Mode" is set to "Export all resources in the project".
- Add a filter for non-resource files to export
*.json
files. - The "features" and "script" tabs should be left as the default, but just in case: make sure the "feature list" only says "64, Windows, pc, s3tc" and make sure the "GDScript Export Mode" is set to "Text". No other fields on these tabs should be populated.
- Click "Export Project" along the bottom of the Export Menu.
- Give your EXE file a name, e.g.,
simcoast.exe
. - Make sure the "Export with Debug" option is unchecked.
- Click the "Save" button, and you should now have an EXE that can run SimCoast all by itself! By checking "Embed PCK" earlier we specified that all of the files needed to make the game work are embedded within the EXE.
- Try to run the EXE! If all went well, the game should play exactly as it does when run through the editor. If not, make sure all of your settings match these steps exactly and try again.
Sometimes the mirrors for the export templates don't work for some reason. If that is the case, you may download the export templates manually and use the "Install from file" option in the Export Template Manager.
The TuxFamily mirror can be found here, and provides a variety of files for many versions of Godot. Navigate to your preferred version (in my case, 3.5.3), and download the file that has "export templates" in the name. It should have the extension TPZ.
The GitHub mirror can be found here. Find your desired release and, just as above, download the TPZ file that contains the export templates for that version.
Once you have the export templates downloaded, go to the Export Template Manager (Editor >> Manage Export Templates
) and click "Install from File". Navigate to your TPZ file in the succeeding window, then click "Open". Your export templates should now be installed!