I’m currently making an RTS game for mobile where mini battles would take place on tiny battlegrounds.
The problem is that currently the player is spawning its units based on a currency system, whereas the enemy is spawning based on a timed system. The timed system would make sense in a tower defense game, but not here.
Here is a short clip of it in action: https://twitter.com/LewanayG/status/1378009426808950794
This is my current spawn script:
void Start()
{
//start spawning waves
StartCoroutine(SpawnWaves());
}
IEnumerator SpawnWaves()
{
//before spawning the first enemies, wait a moment
yield return new WaitForSeconds(startWait);
while (true)
{
//if not all characters of this wave are spawned, spawn new enemy and that wait some time before spawning next enemy in this wave
for (int i = 0; i < startEnemyCount; i++)
{
int random = Random.Range(0, enemies.Length);
GameObject newEnemy = Instantiate(enemies(random), transform.position, transform.rotation) as GameObject;
newEnemy.transform.parent = enemyParent.transform;
yield return new WaitForSeconds(spawnWait); // to add some randomness between spawns
}
//make sure the next wave contains more enemies than this one
startEnemyCount += extraEnemiesPerWave;
//wait before starting the next wave
yield return new WaitForSeconds(waveWait);
}
}
Under the current system, as long as the player has more units on the battleground than the current spawn rate of the enemy it will win, and its really difficult to balance this game based on the two spawn systems.
How do you suggest I handle this problem and the spawn system of enemy units?