How do Monster Generators work?
Posted: Mon Oct 29, 2007 4:23 pm
I've got a query. From what I remember, monster generators are supposed to continuously spawn new monsters once they're activated. I might be wrong on that, but I thought that was what was supposed to happen.
But, as far as I can tell, monster_generator in DSB doesn't do that - it spawns once, then deactivates itself until ('regen') number of ticks - which is cool because it'll ignore any new M_ACTIVATEs or M_TOGGLEs during that time- then reactivates itself, but doesn't spawn again, unless it recieves a new M_ACTIVATE or M_TOGGLE message after that.
Again, I could be wrong, but I thought they were supposed to just keep spawning. I understand why, of course - this sort of thing can quickly fill an area with monsters if not handled carefully - in fact, because DSB doesn't care about the number of monsters on a tile, it could keep spawning monsters onto the same square, resulting in a "super group" of ugly baddies.
Also, if it did reactivate and spawn when it recieves an M_NEXTTICK, then it could never be shut off (M_DEACTIVATE would simply be reversed by the M_NEXTTICK still waiting in the Message Queue).
But as it's currently set up, a M_DEACTIVATE will kill it (assuming there's not an M_NEXTTICK waiting - but there likely isn't, since it only sends one). It will set the INACTIVE flag to true. A M_ACTIVATE after that first checks that flag - if it's true, it just bails out. The only way to bring it back is with a M_NEXTTICK (which sets INACTIVE to false), then a M_ACTIVATE to get it going again (well, to spawn one more time).
Again, I could be wrong about how it's supposed to behave.
But, as far as I can tell, monster_generator in DSB doesn't do that - it spawns once, then deactivates itself until ('regen') number of ticks - which is cool because it'll ignore any new M_ACTIVATEs or M_TOGGLEs during that time- then reactivates itself, but doesn't spawn again, unless it recieves a new M_ACTIVATE or M_TOGGLE message after that.
Again, I could be wrong, but I thought they were supposed to just keep spawning. I understand why, of course - this sort of thing can quickly fill an area with monsters if not handled carefully - in fact, because DSB doesn't care about the number of monsters on a tile, it could keep spawning monsters onto the same square, resulting in a "super group" of ugly baddies.
Also, if it did reactivate and spawn when it recieves an M_NEXTTICK, then it could never be shut off (M_DEACTIVATE would simply be reversed by the M_NEXTTICK still waiting in the Message Queue).
But as it's currently set up, a M_DEACTIVATE will kill it (assuming there's not an M_NEXTTICK waiting - but there likely isn't, since it only sends one). It will set the INACTIVE flag to true. A M_ACTIVATE after that first checks that flag - if it's true, it just bails out. The only way to bring it back is with a M_NEXTTICK (which sets INACTIVE to false), then a M_ACTIVATE to get it going again (well, to spawn one more time).
Again, I could be wrong about how it's supposed to behave.