-
Notifications
You must be signed in to change notification settings - Fork 0
Importing and Exporting
The user can import the level from a folder stored locally on their computer, they can also export a level to this folder to enable easy sharing of all assets and data.
Connecting Systems:
Subsystems:
N/A
None
New Level Creation:
- Create a file structure for the new level at specified location in user's Roaming folder
- Copy over all default assets into the files so the user can easily see what they should change.
- Create a default JSON file with no enemies and a player object with default stats.
- Create a default CSV file with empty cells spanning the given level size.
Exporting:
- Copy over all player data into a JSON file and save it.
- Copy over all tile data into a CSV file, including rotation if applicable, then save it.
- Copy over all files in
user://Assets, which contains all the level's custom assets. - Takes a screenshot of the level using an alternative camera.
Importing:
- Read a JSON file and set up the player's properties to match the data.
- Read a CSV file and copy all of it's data into the current tileSet, including rotations
- Copy the assets directory in the level's folder into
user://Assets - If the player is present, make sure the EditorManager knows it
CSV Structure:
- Exact copy of the tileSet, with the tiles being represented by their ID integer (-1 for no tile, 0 solid, etc.)
- All sceneCollections additionally have a vertical bar separating their entity's ID and what scene they are.
- All slopes additionally have a vertical bar separating their ID from their rotation when applicable
JSON Structure:
- Enemy data (Array)
- Stores the location of the enemy in grid coordinates.
- Stores all associated enemy properties in object literals.
- Player data (Object literal)
- Stores all player properties.
- Settings (Object literal)
- Stores the values for all play mode settings.
- Animations (Object literal)
- Stores the saved fps for all animations.
Name the most important variables, their type, and what their purpose is
-
levelPath: String= The path of the exporting level. -
levelAssetPath: String= The path of the exporting level's assets subfolder. -
defaultPath: String= The default path of assets for cloning. -
importedLevelSize: Vector2= The size of the imported level's grid. -
levelImported: signal= Emitted when a level is imported, allowing other managers to set necessary information.
Name of the most important functions, their parameters, and what they do.
-
func make_new_level(name: String) -> void: Create a new level with the given name in the levelPath folder. -
func export_level(tileSet: TileMapLayer, playerData: Panel, worldSize: Vector2) -> void: Exports the current level using the tileSet, with any specific player changes using playerData, and the world size using worldSize. Tile data is stored in a CSV file, while player data is stored in JSON. -
func import_level(tileSet: TileMapLayer, playerData: Panel, directory: String) -> int: Imports a level from the given directory to the tile map using tileSet, along with the player data from playerData. Tile data is grabbed from a CSV file, while more in-depth data, such as the player information, is taken from a JSON. -
func clone_data(directory: String) -> void: Clones all data from the default folders so that there are basic assets when creating a new level. -
func match_enemy_type(enemy: Dictionary, locatedEnemy: Node2D) -> void: Matches enemy type to the correct one, and imports their data correctly. -
func repair_corrupted_enemies(tileMap: TileMapLayer) -> void: Repairs any broken/corrupted enemies with the default data.
Future Work: N/A
Risks:
- Adding more information requires adding more to save.
A place for miscellaneous notes pertaining to this system.
- The
levelPathNamevariable has no current use and is better off being deleted.
Resources
Known Issues
Future Work
Globals
Managers
- Main Menu Manager
- Master Manager
- Camera Manager
- Hotkey Manager
- Import Export Manager
- Audio Manager
- Animation Manager
- PopUp Manager
UI
Managers
- Editor Manager
- Tile Manager
- Entity Manager
- Icon Manager
- Preview Manager
- Tool Manager
- Asset Manager
- Custom Cursor Manager
Tiles & Entities
- Grid Lines
- Preview Line
- Tiles & Entities
- Enemies
- Patrolling Enemy
- Flying Enemy
- Shooting Enemy
- Stationary Enemy
- Moving Platform
- Property Editing
Asset Swapping
UI
Managers
Player