As the title says, this weeks update will be a little different than the others. This week I'm going to explain how I did the Scrins ultimate power, the Echo effect.
The Scrin have 3 super powers now (depending on your way of interpreting super power), the Black Hole, the Blanket Storm, and the Echo Effect. Everyone knows about the other 2 powers already, but I want to explain about the Echo Effect and how I designed it in game.
The Scrin player gets to choose 1 level 4 power in the upgrade tree, but each power ties in to the Echo Effect. The First choice is Echo Infantry, the second is Echo Vehicles, and finally the last is Echo Aircraft. The Echo is tied in to the Scrin Phase Out power, when you phase your army out every Scrin Unit and Structure phases out and becomes pretty much invincible. However whatever Echo power you choose will also go into effect during this time. This means that if you choose Infantry Echo all infantry squads after phasing out will spawn 2 or 3 squads of their type onto the field at their location for use. These units do not have access to any of the upgrades that the Scrin Upgrade system uses so they are vanilla units but hey, they are free. They will last until killed or for up to 1 minute so these are not just "free" units. However this is quite useful as you can say "phase out" your entire force and use these new units to help counterattack on an offense or to begin your own attack drawing the enemy away from where your main force's are heading.
How I did this in game is simple. Each unit now has the code to allow it to "spawn" additional units like the Refineries do with the Harvesters when they are built. There is a requirement on the spawn ability though, for example infantry units would have the "TriggeredByUpgrade:SpawnEchoInfantryNow" upgrade.
So this is how it works. You pick whatever echo you want, for this example we're going to go with the Echo Infantry. This Upgrade grants 2 upgrades in the coding, "Power-PhaseOut" and "InfantryEcho". The Phase Out power when used spawns a special effect wherever you use it that fires off a weapon that only effects ally units and structures that phase those things out. After that the effect has the ability to spawn 1 of 3 invisible units that are based on which echo upgrade is given, in this case it's the InfantryEcho. This spawn power creates a new unit that we'll call "TempInfantryEchoOn". When this unit is created we set it up to on creation grant the upgrade "SpawnEchoInfantryNow" and we give it a life span of say 30 seconds. Now for the next 30 seconds infantry units will trigger their spawn power creating new "cloned" versions of themselves.
Finally, at the end of the 30 seconds the unit TempInfantryEchoOn will die and on death we will have it remove the upgrade "SpawnEchoInfantryNow" turning off the echo ability. In this way the infantry units that spawn themselves will only spawn for a short amount of time. A minute afterwords any spawned units that were not killed in battle will self destruct. This gives the Scrin the unique ability to double or triple their fighting force of a specific type while also protecting the main force at the same time, a very powerful and unique power that will defiantly make the Scrin a threat on the battlefield.
So the overall effect works like this.
Activate Phaseout -> Phaseout entire force -> Spawn in temp reinforcements -> End phaseout -> Kill extra reinforcements that are still around.
If you guys like this kind of explanation on how we do some of the powers/effects that we do in the game let me know and I will do more updates like this. Have a happy new years!