Overview
This is a tower defense game demo implemented using the open-source framework GameFramework (GF). The demo prototype is based on the Unity Asset Store’s Demo Tower Defense Template. This project reimplements and extends the demo prototype using GF, primarily for personal learning and practice with GF, and to provide a reference for others learning GF.
Version Information
- Unity Version: 2019.4.1f1
- GameFramework Version: 2020.12.31
- Tower Defense Template Version: 1.4
Game Description
The game is a tower defense type with a total of five levels. Each level features different terrain, enemy types, and towers available for use. Players use the energy they gain to choose and build appropriate towers to prevent enemies from attacking the base.
Energy
- Players start with a small amount of initial energy at the beginning of each level. Energy can be obtained by killing enemies or building energy towers. It is used for building and upgrading towers.
Towers
- Cannon Tower: High rate of fire, low damage.
- Rocket Tower: High AOE damage (attacks only ground enemies).
- Laser Tower: Low rate of fire, high damage, long range.
- Energy Tower: Generates energy periodically.
- Electro Pulse Tower: Slows down nearby enemies.
- Missile Array: Deals high damage to a large area; self-destructs after 10 seconds on the field.
Towers can be upgraded to increase range, damage, slowing effect, and energy generation efficiency.
Enemies
- Bug: Low health, high speed.
- Helicopter: Avoids rocket tower attacks; can bypass blocked paths and go directly to the base.
- Tank: High health, low speed.
- Boss: Extremely high health, very low speed.
- Super Bug: High health version of the bug.
- Super Helicopter: High health version of the helicopter.
- Super Tank: High health version of the tank.
- Super Boss: High health version of the boss.
Enemies generally do not attack towers unless the towers completely block their path; in that case, they will attack the towers (helicopter enemies bypass towers). The strategy is to build towers to create detours, increasing the distance enemies must travel to reach the base, but without completely blocking the path to avoid tower attacks.
Base
- The base is the final target of enemy attacks and the objective players need to protect. The game fails if the base’s health reaches 0.
Level Completion
- The level is completed successfully if all enemies are defeated and the base’s health is not 0. If the base’s health reaches 0 before all enemies are defeated, the game fails. Success is scored based on the remaining health of the base.
Implementation Details
The project utilizes multiple modules from GF, including global configuration, data tables, entities, events, file system, finite state machines, localization, object pools, reference pools, workflows, resources, scenes, game configuration, sound, and UI.
- Localization: Achieved using the localization module and resource variants.
- Object Pooling: Repeatedly used objects are cached using reference pools to avoid frequent memory allocation.
- Resource Packaging: All resources are packaged, with correct subpackage information and file system setup. Redundancy and circular references are minimized using built-in analysis tools.
- Version Check and Updates: The game checks version information and updates basic resources (i.e., non-level resources) at startup.
- Level Resources: Each level’s resources are packaged separately; updates are downloaded before entering the level, and unplayed levels can be skipped temporarily.
Notes
- In the Editor, the game starts in Editor mode by default, reading resources from the project rather than AB packages and without updates. To test update mode, disable Editor Resource Mode in the Base component and ensure the Resource component is set to Updatable mode. After packaging resources and correct deployment, update mode should function properly (local deployment and testing can be done using tools like HFS).
No comment content available