Jump to content

  • Log In with Google      Sign In   
  • Create Account


Spawn & Control MOBs with a MMO server?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 bernatripoll   Members   -  Reputation: 122

Like
0Likes
Like

Posted 06 May 2014 - 12:46 PM

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!

 

:)

 

 

 



Sponsor:

#2 hplus0603   Moderators   -  Reputation: 5165

Like
3Likes
Like

Posted 06 May 2014 - 04:17 PM

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 };

#3 bernatripoll   Members   -  Reputation: 122

Like
0Likes
Like

Posted 06 May 2014 - 11:19 PM

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



#4 Valoo   Members   -  Reputation: 343

Like
0Likes
Like

Posted 07 May 2014 - 01:07 PM

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.


Edited by Valoo, 07 May 2014 - 01:08 PM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS