- Joined
- Aug 7, 2013
- Messages
- 1,338
Hi,
So I implemented a functional creep spawning system not unlike that found in Pokemon. It basically has two parts:
a) a CreepRegion: a rect/region where if the player is inside, creeps will occasionally spawn from the region's table
b) a CreepTable: an array of possible creeps that can spawn (each CreepRegion gets its own CreepTable that it uses to look up which baddies to spawn).
I used a timer for each player that checks periodically to see if they are in a creep region (used an integer flag, -1 means they aren't so don't spawn anything).
My question is, what should I do to clean up the creeps say if
1. The player leaves the area
2. There are too many creeps
For 1) I am a bit concerned, since it could be possible other players might want to fight the baddies that spawned, so it would be awkward if player 1 was attacked by creeps, but player 2 engaged them. Then p1 leaves the region and suddenly those creeps magically disappear..awkward. Or do I make the creeps follow the player indefinitely (a bit hardcore though)?
For 2) I want there to be a challenging element, so players who refuse to kill units or take too long can get overwhelmed. But how do I know when enough is enough. And in the same line as 1), what if someone else wants to step in?
So do I keep track of the creeps each player ran into in their own private arrays, and when they reach their maximum creeps, I begin to remove some anyway, starting from the creeps that have been out the longest (and most likely the ones they have ran past and are not fighting). This doesn't solve the problem in 1).
Also, what happens if I call CreateUnitAtLoc, but the random loc I picked happens to be in a spot where a unit can't be made (e.g. water). Will that cause a leak, or will it be covered because I eventually clean up all the creeps anyway (the player will hit the max amount, and this "unspawned" creep will be cleaned up).
So I implemented a functional creep spawning system not unlike that found in Pokemon. It basically has two parts:
a) a CreepRegion: a rect/region where if the player is inside, creeps will occasionally spawn from the region's table
b) a CreepTable: an array of possible creeps that can spawn (each CreepRegion gets its own CreepTable that it uses to look up which baddies to spawn).
I used a timer for each player that checks periodically to see if they are in a creep region (used an integer flag, -1 means they aren't so don't spawn anything).
My question is, what should I do to clean up the creeps say if
1. The player leaves the area
2. There are too many creeps
For 1) I am a bit concerned, since it could be possible other players might want to fight the baddies that spawned, so it would be awkward if player 1 was attacked by creeps, but player 2 engaged them. Then p1 leaves the region and suddenly those creeps magically disappear..awkward. Or do I make the creeps follow the player indefinitely (a bit hardcore though)?
For 2) I want there to be a challenging element, so players who refuse to kill units or take too long can get overwhelmed. But how do I know when enough is enough. And in the same line as 1), what if someone else wants to step in?
So do I keep track of the creeps each player ran into in their own private arrays, and when they reach their maximum creeps, I begin to remove some anyway, starting from the creeps that have been out the longest (and most likely the ones they have ran past and are not fighting). This doesn't solve the problem in 1).
Also, what happens if I call CreateUnitAtLoc, but the random loc I picked happens to be in a spot where a unit can't be made (e.g. water). Will that cause a leak, or will it be covered because I eventually clean up all the creeps anyway (the player will hit the max amount, and this "unspawned" creep will be cleaned up).