-
Notifications
You must be signed in to change notification settings - Fork 0
Game Configuration
This page gives an overview over configurable aspects of the game.
In this project, a YAML configuration file is used to manage settings and parameters that control various aspects of the game, such as behavior, resources, and environmental constants. The human-readable YAML format allows easy modification of game elements, without the need for recompilation. This approach enhances the development workflow by supporting rapid iterations and testing. The configuration includes:
-
Run Mode and Game Settings:
The configuration begins with a global setting for development mode (run-dev-mode
). When enabled, it provides additional functionality for developers, helping to debug specific components. -
Assets:
Specifies all audio and visual assets for the game. -
Items:
Configures game items with their attributes. -
Landmarks:
Defines landmarks, such as the Statue of Liberty or Mount Everest, which act as height references during gameplay. -
Game Constants:
Includes parameters for in-game mechanics like player movement, health, and environmental interactions. Constants for terrain, item spawning, and physics can be adjusted here, allowing developers to fine-tune gameplay by modifying values such as jump velocity or rock spawn frequency.
A dedicated DevMode
is provided, allowing developers to test the game in a controlled environment. This mode bypasses the standard game flow to aid in debugging and fine-tuning specific mechanics.
Items are loaded from the configuration. Each item has the following configurable parameters:
itemName:
type-id: 0
autoCollect: true
useOnPickUp: false
dropOnUse: true
spawn-weight: 2
-
itemType
determines the type of the item. -
autoCollect
determines if the item should be automatically collect once the hiker comes in range of the item and can pick it up. -
useOnPickUp
determines if the item is used automatically once it has been picked up. -
dropOnUse
determines if the item should be removed from the inventory once the item has been used. -
spawn-weight
determines the weight that will be considered when items are being spawned. See Spawning Items for more information.
- Add the item information to the configuration (see how the others are done for examples).
- Add the new item type to the ItemType enum with the correct item id (located in
Item.hpp
). - Make sure the item can be constructed if the new type is given to the Item constructor (see
Item.cpp
). - Add the desired functionality and effects to the world in
World.cpp
In order to add a new sound/texture you will need to do the following.
- Add the new sound as a .wav ot .mp3 file to the
assets/audio
directory. - Add the sound to the configuration under
sound-effects
assound-name: "../assets/audio/yourNewSound.wav"
After these steps you can use the new sound by calling the playSound method with the sound-name
as parameter.
If you want to add a new constant to use in the code base you will need to do the following steps.
- Add the constant to the configuration in the correct place.
- Add the new constant to the correct struct in
GameProperties.hpp
. - Add the new constant to the correct struct converter in
YamlConversion.hpp
.