Advertisement

Spawn & Control MOBs with a MMO server?

Started by May 06, 2014 06:46 PM
2 comments, last by Valoo 10 years, 6 months ago

Hi!

I've been thinking about how to implement a "good" mob's system in a MMO, here's my very first idea:

- Using an Admin Player, create all the fixed spawn points for each mob (just walking around and using a command to create spawn points)

- When the server starts, it loads all the mob's spawning points available.

- Once the server has loaded all the spawning points, it creates one MOB per each spawning point with a % of spawn.


//It's not code! 
function spawnMob(MOB m){
   r = randomNumber 1-100
   if (r < m.chance%){
      //SPAWN
   }
}

- Then, the mobs would be loaded in the world and players would be able to see / attack them

- Once one mob dies:

  1. the server simply spawns another mob (with a 100% chance of spawning) to another position
    • The bad thing here is that there will always be mobs, so the player never has to wait for mobs to spawn.
  2. Every mob has a "timeToReSpawn" var, so the server waits X time till spawning another mob.

But, using this implementation, everything about npc's is decided when the world is loaded, so if a mob is just spawned twice because of a bad luck in the % when loading the server, it will only appear twice in the world (till the server restarts).

Any better implementation / idea / suggestion?

Thanks!

:)

The very basic "spawner" mechanism looks like this:

There's a difference between "spawners" and "monsters."

A "spawner" object sits in the world, and knows how to create "monsters."

Once a "spawner" has created a "monster," it tracks that monster until it is killed.

When the monster is killed, the spawner sets a timer for some time in the future, where the monster will be re-spawned.

The timeout of that timer is typically determined as some minimum amount of time from time of death, plus some minimum amount of time since previous spawn.

Group spawners can spawn (and track) multiple monsters.

Special spawners only spawn werewolves during full moons and whatever.

So, you create NO monster during server start-up, but instead just create all the spawners, and tell them "world loaded" (or, perhaps simpler, "all your monsters are dead.")
enum Bool { True, False, FileNotFound };
Advertisement

I'll try that, thanks! I'll share how it goes :)

In my game, i spawn creatures from a database and when one dies it notifies the 'zone' about itself the zone then forwards that to a script which handles special circumstances ( if the zone is an instance and/or only certain creatures should respawn for example). If the script doesnt handle the respawn the default routine schedules the respawn with a timer based on the creature template.

This topic is closed to new replies.

Advertisement