Game Mechanics - DVSProductions/Cyber-Siege GitHub Wiki

This page contains the inner working of certain game aspects that are not relevant for a player but help understanding the games code and logic.

Towers

If you want detailed descriptions to every single tower, please refer to the How to play where the idea behind every tower is written down with an overview of their stats.

Targeting

To attack an enemy, it first must enter the towers range. To check if an enemy entered the towers range the following function is used: image The function returns true if the enemy is in range.

In case of the base tower and therefore the Pulse/Blast Tower this function is all that is needed to shoot but all the other towers also need to look at the enemy. They are only able to shoot if their barrel looks pretty much directly at the enemy it is targeting.
This rotation is affected by the rotation speed.

Stats

The stats can be accessed and edited under Assets/Prefabs/Tower.
For every tower a higher value for the stat means the tower is stronger and a smaller value means it is weaker. This makes it easier to adjust stats even if one does not know every single calculation done by the game behind the scenes.

Towers have the following stats:

  • Attack speed
  • Damage
  • Price
  • Range
  • Shot speed
  • Rotation speed

Attack speed

The attack speed value stands for the number of shots shot in a second.

The Laser Tower is completely unaffected by this value.

Damage

The damage stat is self-explanatory. Every Tower does his current damage value as damage with each shot.
This does not apply to the Laser Tower where the damage is the damage per second done by the laser.

Price

Similarly, to the damage stat the price value is easy to explain. It shows how much money is needed to buy the base tower.

Range

The range value starts at the center of the tower. Each full increment is equal to the size of a tile on the map.

Here you can see the range of the Laser Tower. The tower has a range of 2.5 --> 0.5 is the distance from the center of the tower to the border of the tower tile. The range then goes 2 full tiles towards either direction. image-1

Shot speed

Shot speed only affects the Gun Tower and the Rocket Tower.
It describes ow many tiles per second the shot can travel.

Rotation speed

The Rotation speed speeds up the rotation of the tower allowing it to more consistently target and shoot the enemy.
The value dictates by how many degrees per second tower rotates.

Tower Upgrades

Upgrades are the main way of powering up you defense. A single fully upgraded tower is stronger than multiple non or only slightly upgraded towers.
Upgrades can scale the power of the tower either by adding, multiplying or exponentially increasing the stat. This happens on a tower to tower and upgrade to upgrade base.
The price for Upgrades is explained later on under Spending Money. Tower Upgrades can be viewed and edited under Assets/Resources/TowerUpgrades/Towers.

Universal Upgrades

These are upgrades that most if not all towers have access to.

  • Attack speed
  • Damage
  • Range
  • Rotation speed
  • Shot speed

Unique Upgrades

These are upgrades that are unique to certain towers.

Explosion Range

This upgrade is unique to the Rocket Tower and increases the Range of the Explosion created when the Rocket reaches its destination.

Blast Duration

This upgrade is unique to the blast/pulse tower. It increases the amount of the blast lingers and continues to apply damage allowing the tower to potentially stack blasts.

Drone Speed

This upgrade is unique to the Drone Tower and is this towers Shot speed. The difference exists because the drones work differently than other shots.
For the player this is the same thing as the shot speed of some other towers.

Drone Ammo

This upgrade is unique to the Drone Tower. It increases the Ammo of the drones allowing them to deal more damage and live longer.

Tiles

The game has multiple maps for you to choose from. Each map consists of multiple tiles.

Path Tile

Every map has multiple path tiles which together create the path the enemies take to move towards the home tile. There are multiple paths that run in parallel to each other and the enemies run along of those paths allowing for more dynamic movement.

Spawn Tile

The spawn tile, as the name implies, spawns enemies which follow the path set by the path tiles to the home tile.

Home Tile

The home tile is the final tile the enemies try to reach. If the enemies enter your "home" [or system] you get damaged and lose health.

Tower Tile

This is the tile you interact with.

There are typically multiple tower tiles on each map. If you click on an empty tower tile a menu opens up where you can choose one of the available towers, if you can afford them.
Once a tower is placed you can't place another tower on this tile until the tower is sold or a new game is started.

If you click on a tile that already has a tower on it you open the upgrade menu for that tower instead of the tower menu.

Enemies

If you want detailed descriptions to every single enemy, please refer to the How to play where the idea behind every enemy is written down with an overview of their stats.

Stats

The stats can be accessed and edited under Assets/Prefabs/Resources/Enemies.

Every enemy has the following stats:

  • Health
  • Speed
  • Value

There are also hidden and unique stats:

  • Home Damage
  • Stages

Health

The health stat is set the moment the enemy spawns. Once this value is reduced to 0 the enemy dies.

Speed

This value show how many tiles per second the enemy can travel.

Value

This is the amount of money the player gets once they defeat an enemy.

Home Damage

This is the amount of damage done to the player if the enemy succeeds to enter the home tile.

Stages

This stat only exists for the splitting enemy. Currently there are 3 Stages that each have a unique sprite.

Scaling

The enemies get progressively stronger in the following ways:

  • Health Scaling
  • Speed Scaling
  • Wave Density Scaling

Health Scaling

Health Scaling is affected by the current wave.
It uses the following formula:
BaseHealth * (CurrentWave / HealthScaling)^2.5 + BaseHealth
creating the following Graph:

image

The HealthScaling Value is equal to the wave the BaseHealth stat doubles its value and is currently set as 30.
This can be best seen with the gray 500 line clearly doubling its value in wave 30.
Afterwards it exponentially increases rapidly.

Speed Scaling

Speed Scaling is affected by the current wave.
It uses the following formula:
BaseSpeed * (CurrentWave / SpeedScaling)^2.5 + BaseSpeed
creating the following Graph:

image-1

The SpeedScaling Value is equal to the wave the BaseSpeed stat doubles its value and is currently set as 120. This can be best seen with the light blue 1 line clearly doubling its value in wave 120.
Afterwards it exponentially increases rapidly.

Wave Density Scaling

One the base waves are defeated, and the endless waves take effect the Wave Density scaling starts.
Each time a loop of endless waves is concluded the amount of enemies in each wave increases by 25%.
This will continue increasing for every loop beaten and will only stop once the player is overpowered.

Unlike with health and speed the waves are not affected by the current wave but, as stated, by the amount of endless waves loops beaten.

Economy

The ability to defeat enemies is limited by the money you have available to build or upgrade turrets.

Earning Money

Killing enemies awards the player with money. Each enemy type has a unique value assigned to it which the player receives as "money". These values can be accessed and edit inside each enemy-class. Additionally the player receives money for beating a wave.

The money values of the enemies are as of writing this (12.02.2023):

Enemy Value
Fighter 10g
Fortress 15g
Scout 12g
Mothership 13g

The design philosophy behind it is that the player doesn't have to focus on making money and just gets it by playing but they should get a bit of help in case their strategy seems to struggle. Killing enemies awards the player with money but they need to defeat them and if they fail to do that they receive none. To avoid a "snowball" effect the player just gets money for surviving so they hopefully can afford the small push towards defeating the waves again.

Spending Money

  • When the player wants to build a turret, he first has to purchase it. Therefore the tower-selection menu will show the required amount of money to spend for picking a tower, next to the corresponding tower item.

  • Whenever the player wants to upgrade a turret, the upgrade menu will show the required amount of money, required for the upgrade next to the upgrade item.

  • In case of not having the required amount of money, the item for those items will be grayed out and won't be clickable.

  • If the player has enough money for the tower or the upgrade they price will be deducted from the current pool of money and the tower will be placed or the upgrade applied.

The price for each tower can be seen and edited in their individual prefabs in Unity under Assets/Prefabs/Towers:

Tower Price
Gun 50g
Laser 70g
Drone 150g
Pulse 80g
Rocket 250g

The upgrades for these Tower can be viewed under Assets/Resources/TowerUpgrades/Towers: Here each Tower has a individual List of upgrades assigned to it. Inside this List are all the upgrades we have assigned to the tower and there they can be edited. The Upgrades receive a startprice and a maxprice where each upgrade in between these values is calculated based on a scaling factor. For example the range Upgrade for the Gun Tower: The Tower can be upgraded 5 times. The price for each upgrade ranges from 300 and 10000 so the priced develop in this way and uses 2.081 as its scaling factor:

Level Price
1 300
2 640
3 1740
4 3650
5 10000

image

Score

Similar to the mechanics of earning money the player will be rewarded with an increasing score. Unlike with money the score never decreases and just continues to go up the longer the game lasts.

Scoreboard

At the end of the level, the player will see the score they just reached in the Game Over Screen. The acieved Score will be automatically submitted if the player is logged in. Every map has its own scoreboard. The scoreboard will show all entries sorted from most to least points.

World-Wide-Ranking-System (online)

The achieved score is submitted to an online server to compete with players all around the world.
This online server allows for the scoreboard to be updated in real time but requires a working internet connection.