Intelligent Spawn Area Entities

You and a bunch of friends have just finished a month-long project of deciding on a city location, collecting all the resources and cash to build your city hall, planing the city layout and zoning, and then recruiting more people to build their homes in your young town. The central park has just been completed by the two aspiring terrain architects and everyone has agreed on the interior designer for the city hall. And then the orcs came. More specifically, an orc military outpost popped up nearly overnight just outside your city’s limits, and now you find orcs spawning ever closer to your city hall building.

You know that if you don’t get this thing nipped in the bud those orcs are going to destroy the fruition of all the work and time poured into your city. So you call on all your city’s residents to come out and kill orcs every time they spawn. You call on them to destoy the orc structures at every opportunity. You know that if you can sustain high enough destruction the orcs will give up and go away. However, if you don’t they will continue to spawn faster and faster and closer and closer to your city hall, every day causing ever higher maintenance costs for everyone in the town- especially those unfortunate enough to have their houses build on that side of the city.

Three days of what seems like concentrated destruction later, you realize the orcs do not seem to be getting discouraged. In fact, they haven’t even moved! So, the mayor calls an emergency city council. The topic is how much can the city afford to sink into hiring out for orc killing. After the number-crunchers do some calculating, it becomes apparent you can pay 13,500 credits per mission of 20 orc kills for 900 missions before the city treasury get too low to pay all the maintenance. Other cities have had success with hiring out 900 missions to get rid of a nasty orc infestation, and you have seen other cities offering 12,000 credits per 20-orc-kill missions, so you are confident word will spread and the missions will be completed. Hopefully, it will be enough additional sustained destruction to drive them off. If not, this could be bad news for your burgeoning city.

The mayor sets up the missions in the city’s new missions terminal and everyone stars spreading the word that money can be made killing orcs in your town. A strange thing happens though. Nobody shows up. Well, a sporadic smattering of would-be bounty hunters drop by, but they don’t do more than one mission. Some don’t even finish it. At the same time, you begin to notice the orcs are becoming harder and harder to kill, each one seeming to hit for more damage than before. With concern creasing your brow you start a large patrol around the orce encampment, which you note has sprouted spiked walls sometime in the last two days. As you race past, you notice with worry a smudge pop into view over the next ridge, a thick trail of smoke rising into the air above it. As the distance closes, your worry turns to alarm as you realize that smokey blob is a veritable orc boom town, complete with seige engine construction tents and an advanced barracks. The orcs at your town’s edge are being supplied and upgraded from this until-now unknown and un-addressed regional threat. The last time one of these was discovered, more than 2 player cities ended up razed to the ground, and it took the concerted effort of three major cities a full month to drive them off. Prior to that, those three player cities had been engaged in bitter war over resources. The campaign to rid their region of the orcs nearly broke them all, and once they succeeded they were the closest of allies; they discovered there were bigger, more dangerous things in the world than the feud with their neighbors.

Your thoughts are cut cruelly short when your air bike is blown out from under you and you see your health bar virtually disappear. And then you’re dead.

In shock, you see an orc stand up from behind a rock, outfitted in gear like you have never seen on orcs before. I his hands he carries an enormous, shimmering rocket launcher. Your worst fears have been realized. The orcs have learned something new. They have somehow discovered or been given some super-weapon. You look to the left to see what else is around, and just before your screen blips to the respawn building back in town you see three more. “And they can mass produce them…”

How do you make intelligent NPC factions that can develop, spread, migrate, and even play politics? It’s possible.

Deal with all creatures at the spawn spot level. The spawn spot is the true, persistent entity in an MMO. It’s not the creature. It’s not the dev-created-and-planted buildings or villages. It’s the spawn spot. It’s the spawn spots that really interact. It’s the spawn spots you are truly influencing when you, as a player, kill creatures.

Each spawn spot has a set of attributes that define it. They define the creatures it will spawn, they define how big it is, they define the threshold under which it can possibly die, they define what terrain types on which it will best perform, and they define the rate at which they spawn creature instances in the live game world. These attributes change based on its environment. When a player kills a creature it spawned, it is recorded and included in the periodic calculations that do the actual attribute adjustments. When a spawn spot comes in contact with another spawn spot, the two spawn spots engage in what amounts to an arena battle, virtually of course and without actually animating the whole thing- you can just use the combat scripts you use whenver two opposing creature instances meet and fight in front of a player in the live game world. The outcome of that combat round results in the attributes of both spawn spots being altered. If multiple spawn spots’ areas all overlap, then you do “combat” matches amongst them all, with each round altering their attributes.

Whenever two spawn spots of the same faction interact, their loot tables interact. The loot tables contribute to the overall spawn spot attributes, so what’s in a spawn spot’s loot table really matters. An epic item can do a lot to make an otherwise squishy NPC become a formidible foe. Two mutually-isolated pockets of spawn spots of the same species can over time develop very different loot tables which result in very different levels of difficulty. If the two meet and interact, there will be a significant sharing of loot table items from the more advanced one to the less advanced one. In effect, the less advanced one “learns” from the more advanced one. By manually injecting a few epic items into just one spawn spot of orcs in the far northern reaches, over time the orc faction very well could expand their reach, both through creating new child spawn spots as they thrive due to the additional strength they have through their stronger loot tables (and thus attributes), as well as through the process of “teaching” their unlearned brethren spawn spots the glories of their epic loot table.

A spawn spot’s attributes will also determine how much it attempts research and development on its own loot table. In addition, not all spawn spots will be as amenable to “learning” as others may be, that is, the “coefficient of loot transfer” makes it less likely that the roll to choose which of two loot table items is better will fall in favor of the truly better one. A spawn spot’s attributes will define how much it will attempt to build upgrade structures. Granted, these structures will have to be dev-defined, but the actual chances of building them will be up to the available resources in its current location, the viability of the terrain type, and the “coefficient of construction”. Buildings can simply be an additional item to the spawn spot’s loot table for as long as they exist, that is, for as long as players don’t kill them at a significantly greater rate than they are defined to spawn. If players specifically target the seige engine building in their raids, wherever it may spawn in the spawn area, and over time destroying its instances at a rate that matches or exceeds that building’s spawn rate, then eventually the building will “die” and its benefit will be removed from the spawn spot’s loot table benefits. Also, there will cease to be seige engine instances that spawn from that spawn spot.

It’s doable. It really is. Just break down the complexities into discreet components that can each be calculated and added into one long addition problem 😉