Steffon Scott

Steffon Scott

  • NA
  • 20
  • 12.5k

Storing multi-player game characters locally.

Sep 18 2012 10:03 PM
OK, so here goes. I am in the process of learning the language and am reading everything I can get my hands on, then putting some of my ideas down in code. I have started with a simple console application which is the foundation(albeit bare) for the server portion multi-player client/server strategy game I had in mind. I am not going to try to delve into the multiplayer aspects, nor the networking components until I get a grasp on local storage of data and the best means to the end I desire.

As I started my code I attempted a few different things. I successfully made a list variable which stored player names, via the console menu I wrote up I can add a character, remove a character, list characters, etc. The problem with lists is, well, you can only have an in-line storage capacity of one field, great for storing a list of names, not so much for a listing of characters with their associated stats. So, I have looked into my options and read about <Dictionary>'s in C# and this looks like it might be what I am looking for storing players as keys and their stats as the key values. My problem is that I am not sure if the Dictionary would be best to use OR if a multi-dimensional array would better serve my purpose. 

Ideally, when it is all said and done. This local storage will on start-up be initialized with data from either an embedded database OR stand-alone database(as I have since read about file-locking issues with client/server setups and embedded DBs). And, on the defined call within my program to something such as SaveChars(); would sync my local data back up with the DB table. I realize I may be far off on my conceptualization, hopefully not to far but I am just looking for some input on what type of solution you guys would use in this instance in terms of the storage issue and why. Thanks in advance.

Answers (2)