0

Note: This is a theoretical question weighing up the pros and cons of server object instancing, the tier architecture is not the topic of the question.

My question is simply whether my thoughts are correct, or if i have missed anything. If i have missed anything what have i missed?

Given the context of an MMORPG, 2 tier architecture in .NET C# where the client is the Presentation/Business logic tier and the server is the data tier that maintains the data and state of all characters in the game.

Which server object instance would be most appropriate, why and why would the other two not be appropriate.

My thoughts are as followed:

My Definitions: Singleton

  • There is a single Server object that services all clients
  • Each client will typically execute calls on a different thread in server object
  • The server object is created on initialization or first access by client.
  • The server object is destroyed on termination (ie manual termination of server program)
  • The server object stores all data and states of client Data and state is stored until server object is terminated

Per Client

  • There is a server object for each client.
  • Each server object is created when its client connects to the server
  • Each server object is destroyed when its client disconnects from the server
  • Each server object stores all data and state for its client
  • Data and state is only stored while a client is connected, after a client disconnects data and state is lost

Per Call

  • There is a server object for each call to the server from a client
  • A server object is created when a client calls the server method
  • The server object is destroyed when the call finishes
  • Data is only stored for that call, while the call is being executed, after a call finishes data and state is lost

With that in mind my justifications for the question:

Singleton would be the most appropriate, as the server object would store all data and states of all characters regardless of whether a client (for that character) is connected.

Per call would not be appropriate at all, because data would only be retained while a particular call is in process, thus losing data and state when no call is in process

per client would be more appropriate than per call, but less than singleton because when clients disconnect their characters data and state is lost

Apologies if the layout of my question is not the best this is my first post.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.