Note that populations don't have to be creatures, they can be herbs, rocks, or even gnomes.
Of course I've been out of the loop for years, and don't remember much NWN anyways. I need some help and input. For all I know we already have a system like this?
My proposal:
What builders would have to do:
Place spawn points as normal. Make these spawns as if they were designing how the population would spawn when at its peak. Then put this local variable on the spawn waypoints:
Code: Select all
string ACR_POP_NAME: The name of the population the spawn point belongs to.
string ACR_SPAWN_CATEGORY: The name of an optional spawn category
In a script, say "acf_population":
Code: Select all
#include "acr_spawn_i"
SetSpawnCategoryInt("teh drows", WP_SPAWN_HOUR, 20)
SetSpawnCategoryInt("teh drows", WP_DESPAWN_HOUR, 5)
SetSpawnCategoryInt("teh drows", WP_SPAWN_IN_STEALTH, 1)
SetSpawnCategoryString("teh drows", WP_ADD_ITEM, "abr_drow_ear")
SetSpawnCategoryString("Bad Moon Boyz", WP_SPAWN_FACTION_RESREF, "051_badmoonboss" // This would be a resref of a creature belonging to the faction you want. No other way to switch factions on the fly that I know of.
Code: Select all
ACR_POP_NAME: "teh drows"
ACR_SPAWN_CATEGORY = "teh drows"
Then of course the population's limits need to be defined: min, max and growth in terms of hit dice. Since these values should be persistent, we'll go ahead and set them with a DM GUI and not in script. If they aren't set, we'll assume the spawn is at 100% all the time. That just makes it a convenient way to batch-edit spawn options.
The chances of that spawn point spawning would be equal to its regular chance (the ACR_SPAWN_CHANCE local int on the spawn waypoint) times the percentage of population available ((currently_alive - currently_spawned) / max_pop). The problem with any more involved calcs is guestimaing the hd of the spawn (very do-able, I just want to get it up and running first).
Initial limitations:
- Nothing for overland map travel because I don't know anything about that yet. This would probably be the first thing to add to it, though.
- If there were 1 out of 100 hd worth of Bad Moons remaining, you could still trigger a 20 hd spawn point. This is fixable by monitoring what we spawn in real-time but something that could be implemented later.
- Its more difficult to change some spawn behavior at run-time, because of all the caching that is done. This caching is part of the reason that our system is something like 10x more performant than NESS was. I don't think we'll want to do this anyways.
- I didn't list any alternative growth functions, although we could easily add others. I'm thinking with start with just a linear function where growth is constant until the population caps.
- No way to add spawns to an area without manually placing spawn points (i.e. no way to say "there are deer in this area"). I'm not sure if this is a big deal, since spawn points can be made to spawn creatures anywhere in the area. In any case its something we could add.
- Doesn't keep track of individual ResRefs. If you kill all the goblin war1s, the chief may be gone, and vise-versa. But given the nature of these populations (they should be able to run away) this is probably a good thing.
- Doesn't change the distribution of a population at all. So if you kill all the Bad Moons in area A1, they're just as likely to re-spawn there as anywhere else.
- Setting off a spawn in A1 reduces the chances of that pop spawning anywhere else until they despawn. The more hd A1's spawn has relative to the rest of the population, the bigger this effect. So if you have a low population max relative to your spawns, a player could set one off in one location and not run into any again. However, quick despawn times would mitigate this.
* I whittled down a lot of features while writing this. Looking back, I may have been able to implement the thing in the time it took to type this up.
** Aside from all the other awesome stuff he's done, thanks to AL for perfecting it. I was really proud of it, especially its performance, and I'm glad to see it be used. Looking at the SVN repo on Sourceforge, its amazing the amount of work he's done.
*** Ok, I'm sure there will be bugs at first. This is fine because bugs usually result in more player deaths.
Alternative approaches include generating encounters from pre-defined ResRefs, or having builders state a spawn's CR or HD in a variable. I'm thinking we'd eventually do the later, along with caching of a spawn's HD (so the variable would be a way to override the automatic behavior). Once you know how many orcs come out of a spawn point and how tough they are, you can do a lot more logic regarding where all the unspawned creatures "are".
Thoughts?