Place Manager

by calbert 1/30/2008 5:19:00 PM

In my previous post Memory Management I was talking about storing character and room data in server memory.

For the Character memory management I basically just use a DateTime value that gets updated each time a request is made by the connected player. If the DateTime exceeds a certain limit such as 20 minutes then the character data is saved and removed from memory. If the player just has a long pause between requests their character data will be reloaded if they make another request after the cleanup.

For the Room or Place data I've though about doing the same thing, just store a DateTime value and update it whenever a player performs an action in the room. I am not sure this is the best approach since the only commands that reference the Place object are movement, looking, some inventory and buying commands. Other actions such as casting spells, viewing stats, private chat, etc. do not reference the Place object. Of course, I guess if you are not accessing the Place object no need to have it in memory but once a player attempts to move again I would need to reload the Place. I might just maintain a list in the Place object of all the players currently located there and only remove the object once those references have been removed. I'll try a few things and record what I find.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , ,

Game Development | Perenthia PBBG

Related posts

Comments

1/31/2008 1:01:32 PM

idiotcoder

I'd consider having a property on the character that exposes a reference to their current location.

Every x minutes, run through the list of active players (those you still have in memory) and any places that aren't in that list can safely be removed. It does make for spiky memory management, but with some tweaking, it can be a fairly reliable way to keep an eye on it.

idiotcoder us

1/31/2008 1:18:23 PM

calbert

That is a good idea, I already have a reference to the Place on the Player object. I am also building some tools so that I can monitor the objects in memory from the admin side of the aplication. I can already view players but am going to setup to monitor places and log the heartbeat iterations.

calbert us

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

12/4/2008 2:43:25 PM

Powered by BlogEngine.NET 1.3.1.0
Theme by Mads Kristensen

About the author

I am Senior Software Engineer specializing in the Microsoft .NET Framework and PBBG development.

E-mail me Send mail

Calendar

<<  December 2008  >>
MoTuWeThFrSaSu
24252627282930
1234567
891011121314
15161718192021
22232425262728
2930311234

View posts in large calendar

Recent posts

Recent comments