Player Ship Implementation - UQcsse3200/2023-studio-1 GitHub Wiki
The Player Ship aims to bring together most of the systems implemented in our game in a way that gives the player purpose. It extends on already implemented systems such as tiles, items, rewards & entitites, and will work closely with the quest framework in the hopes of creating a meaningful player experience.
This page details the higher level design of how the components extend on existing functionality, how they will interact with each other, and how they will interact with the quest framework & storyline.
Ship
Entity
The Ship
Entity is a physical structure placed on the map. The player is able to interact with it, and will visually update to match its current 'repair' state. Along with the already implemented PhysicsComponent
and ColliderComponent
, the Ship
Entity contains the following new components:
ShipProgressComponent
This component handles the Ship
's internal state of repair. It listens for addPart
events on the Ship
Entity, which will pass the number of ShipPart
Items the player is using on the ship, and increment its internal state of repair by that amount. It also triggers a progressUpdated
event on the Ship
Entity along with the current state of repair for other components to use. Certain features will be unlocked once the repair progress reaches the required threshold.
ShipTimeSkipComponent
After a certain number of repairs is reached, the player will be able to 'sleep' through the night by interacting with the ship. This component handles listening for the progressUpdated
events triggered by the ShipProgressComponent
, and will 'unlock' the sleeping functionality after the threshold has been reached. It also listens for timeSkip
events which are triggered by the player interacting with the ship. Once the sleeping functionality is unlocked and a timeSkip
event is triggered, this component will handle calling the time service to skip to the next morning.
ShipAnimationController
This component functions as a way of visually showing the Ship
Entity's repair state. It listens for progressUpdated
events, and changes the current animation depending on thresholds that are reached. For sprint 3, these will be simply showing more parts of a single sprite, but in the future this could control actual animations.
ShipLightComponent
[sprint 3 bonus]
Similar to the sleeping functionality, once a certain number of repairs is reached the ship will be able to emit a light. This will extend on the AuraLightComponent
with the additional functionality of handling when the light is unlocked.
ShipUIComponent
[sprint 3 bonus]
This component will help the player understand the ship functionality and minimise the need for multiple hotkeys for sleep, light & repair functionality.
ShipPart
Item
This is an item added to the ItemFactory
, and can be obtained either as a quest reward, or by digging up a tile with a ShipPartTileComponent
. If the player is carrying one or more of these, they can interact with the ship to increase its repair state.
ShipDebris
Entity
Upon starting the game, a fixed amount of ShipDebris
spawns around the Ship
. Each debris takes up the size of a block similar to a plant. ShipDebris
can be removed ('cleared') from the map by the player using a shovel, but it does not drop any items and therefore cannot be placed by the player. It triggers a debrisCleared
event on the MissionManager
as clearing it will be a requirement for certain quests.
When a quest reward is a ShipPartClue
Item that generates a tile with a ShipPartTileComponent
on the map, a ShipDebris
Entity will also spawn on top of the tile containing a ShipPartTileComponent
to make its position obvious to the player.
ShipPartTileComponent
These tiles will generate once a player receives a ShipPartClue
Item as a quest reward. Similar to the Crop Tiles, these will take up the space of one Terrain Tile, and are able to be interacted with through a shovel
event. Upon a player successfully using a shovel on the tile, a ShipPart
Item will be dropped, and the tile destroyed. The corresponding ShipPartClue
Item in the player's inventory will also be removed.
ShipPartClue
Item
This is an item added to the ItemFactory
, and can be obtained either as a quest reward. It has an internal state that contains a random, valid tile location for spawning an part. Upon collection by the player, the item will trigger a tile to spawn with a ShipPartTileComponent
at its stored location. A ShipDebris
Entity will also spawn in this same location.
Currently the player will be able to find this location by seeing the ShipDebris
Entity, however ideally there would be some sort of HUD that shows a user friendly location (e.g. north-west) while the player has a ShipPartClue
Item in their inventory.
ShipEater
Entity [sprint 3 bonus]
The ShipEater
is an entity that has a chance of spawning when a player destroys a ShipDebris
Entity. Upon spawning, they move towards the Ship
Entity. Once close enough, they will periodically decrease the repair state of the ship. ShipEater
Entities will only have a chance to spawn once the player unlocks weapons (part of the Home Sick Quest) so that they can have a chance to defeat them.
Full Ship Eater documentation can be found here.
Note: any existing unlocks on the ship (e.g. time skip or light) will not be removed as the repair state decreases, but further progress will be hindered.
Ship Quests
The main focus of Act II relies on repairing the ship. As such, draft plans were made to help set out and plan the required quest progression of ship parts.
Ship Design
The most important considerations when designing the ship were to make it clear the connection with both the player and Earth. As such, the ship is the same colour and has the same symbol as the player's helmet. Purple accent colours were also used to make a connection with the player. The colours yellow, blue and green (as well as symbols of the sun, rain and grass) were used to imply the ship is from Earth.
Ship Parts followed the same metal colour scheme of the parent ship sprite, as does Ship Debris and the Part Tile. The Clue item's design was inspired by a treasure map.
This Creative Commons Zero resource https://foozlecc.itch.io/void-fleet-pack-1 by Baldur was used in the creation of ship assets.
Testing Plan
The majority of individual components have unit tests created to test their full functionality. These have achieved full coverage of the implemented functionality. The following require more unit tests to be created and will be done during sprint 4:
ClueReward
CoordinateDisplay
Save & load integration testing was done by manually modifying the saveFile.json
file, then loading the game and checking the expected state was present.
Further integration testing has been conducted manually by spawning items or tiles in using the debug terminal, then checking the expected functionality works. Written integeration tests will be made in sprint 4.
Ship UML
Detailed below is the complete ship UML diagram