MMO: Best way to destroy a world

edited February 2011 in Photon Server
I'm trying to destroy a world in the MmoDemo, when the creator of the world disconnects, but I'm not successful in doing so currently.

I have the ID of the creator of the world stored in the MmoWorld object, so I know when it is the creator that disconnects.
I've tried the following:
// called in OnDisconnect in MmoActor.cs
...
MmoWorld mmoWorld = (MmoWorld) this.World;
if(this.Avatar.Id == mmoWorld.CreatorID)
{
    mmoWorld.Dispose();
}
...

Is there some standard way to destroy a world, or do I need to implement additional functionality somewhere? I'm thinking this should be put into the MmoWorldCache class.

Comments

  • Never mind... now that I got my head screwed on straight, I added a function RemoveWorld(string name) to MmoWorldCache, that finds the world in the dictionary and disposes of it as well as removes it from the dict.
  • Glad to hear you got it.
    Still it's something we should probably add. Thanks for pointing us to it.
Sign In or Register to comment.