Thread: Hive AI
View Single Post
Old 05-09-2002, 06:22 PM   #9
KaVir
Legend
 
KaVir's Avatar
 
Join Date: Apr 2002
Name: Richard
Home MUD: God Wars II
Posts: 2,052
KaVir will become famous soon enoughKaVir will become famous soon enough
Wik is correct - there's no reason why you can't just keep a rough idea of which mobs are doing what (eg 10 lumberjacks are out chopping down trees) and then provide a random chance of encountering one of them in your travels. Killing that mob would then decrement the number of lumberjacks, while if you ignored it and walked on it would eventually just vanish.

The other alternative, if you wanted to really be accurate in your simulation, would be to have a list of very basic "mob group" structures which could (for example) contain the vnum of the mob, the number of instances of that mob, and it's coordinate location. If a player moved to the specified location, the mud would quickly create the mob (or group of mobs) and place them in the room. If you wanted the mobs to be more persistant (perhaps with each having their own name and description) you could drop the "number of" and just use that mobs unique ID along with its coordinate location - load it into memory if there is a player in the room, save and destroy it when the last player leaves the room.

When two NPC settlements fight and there are no PC witnesses, you wouldn't need to really spawn any mobs at all - you could just perform a quick calculation to decide which side wins the fight. Once again if you wanted to add more detail you could have each fight take a certain period of time - so that players might have a chance of walking in on the middle of a fight.
KaVir is offline   Reply With Quote