Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Flavioli

Member Since 10 Jun 2010
Offline Last Active Apr 30 2013 11:56 AM

Topics I've Started

C#: Suggested data structure for storing data for statistics?

05 April 2013 - 03:29 PM

So in my game I have a class that logs certain datapoints so that I can analyze them statistically (both in-game, for the player to see his stats, and out-of-game, for testing and balancing). For example, I log each time specific units perform a specific task (such as "went to gather wood") to contrast it with others (like "went to gather stone"), so that I can later graph out the data and see what the big picture looks like for units' nondeterministic behavior. I also log statistics that are not counters, such as "average money spent" and I also store temporal data such as "average money spent over time"... each of these per game entity (such as "money spent by Unit#5"... keeping them as different series in a single graph). So basically I have 3 types of data: counters, statistics (so far only average... I use a struct called "Statistics" to accumulate data for this for each datapoint), and statistics over time.

My question is, what is the best data structure in C# to store and represent this type of data? Keep in mind that the data is not just discrete datapoints... as in, I have to fetch existing data points to update them as I log more data.

Originally my thought was to have a List of datapoints for each of the three value types (int for counter, Statistics for stats, Queue for temporal stats) but this is not a good idea because of what I described above. Instead, I currently have three Dictionaries of Dictionaries... but those dictionaries are hard to work with... for example, the one for temporal stats looks like this:

Dictionary< MetricType, Dictionary < string, Queue < Statistic > >

Where MetricType is an Enum corresponding to the specific type of event/statistic I'm logging (such as "MoneyOwnedByUnit")... it corresponds to selecting different charts to look at. The inner Dictionary is the set of "series" where each string is a series (such as "Unit #5") and the Queue stores, say, up to 500 points for the line graph (such as 0,11,55,33,20).

The nice thing about this is that I can store and fetch data in constant time but working with this large dictionary is a bit of a pain, and as I add more types of logging, or want to log more information for each data point, it quickly gets out of hand... when something this ugly shows up in my code, I typically imagine there is a better way. Does anyone know of a more elegant/correct way to store and fetch my statistics data, or is this pretty much the correct approach? Thanks! =)

Too long; didn't read:

Basically looking for a good data structure to store statistics like counters for an event or statistics about game data. I'm using nested dictionaries... doesn't seem like the best approach though, and would welcome better/cleaner alternatives.

Recommended frameworks, libraries etc. for a client-server style game?

16 October 2012 - 07:39 PM

Hi all. I have a reasonable amount of client-server networking experience, mostly in C# .NET (non-game related) and in C++ (some of it game-related), and I also have a pretty decent amount of game development experience with multiple engines including pygame (for python) and with simple, mostly hand-crafted engines using DirectX in C++. However, I'm interested in finding a framework, engine or set of libraries that can lift some of the burden of doing much of the low-level work, especially in the networking front...

I want to make a game with a persistent server in which at most a handful of clients can connect simultaneously (similar to Minecraft's multiplayer model). The game will be mostly text-based (kind of like a MUD). I'm looking for the tools and frameworks that the community recommends the most for this type of thing... however, I put more priority on a set of tools that work well and have been tried-and-tested than on tools that are less well-known but are more built to accomplish exact kind of task I mention. I have very little familiarity with what's available to game developers, even when it comes to the more well-known tools. With that said, the recommendations I'm hoping for would be for a multi-purpose framework that can handle this task and has lots of flexibility and documentation and/or online support, as opposed to, say, a little-known tool that specifically makes MUDs. What does the community recommend? I'd prefer to work in C#, if that's what's recommended, and would prefer to steer away from C++ as much as possible.

I'd like to be able to do most of the computations server-side and pass messages to the clients to display status information... the client should mostly pass commands to the server such as "move north" or "buy this", and the server should process the commands. If possible, it would be nice if I could store world data in a sql database (I have a good amount of experience with this) but if there's better methods of doing this out there that could work too... all the games I've made before this stored save data in text files so I think I can do better than that. I can give more details about what I hope to accomplish if that would help to bring out better suggestions.

Thanks in advance! =)

Suggested frameworks for a minimalist, bare-bones browser game

19 June 2012 - 11:33 PM

Hi there gamedev, first time posting here. I could appreciate some feedback on where to start for the project I'd like to embark on. Hear me out on this one, as I'm not requesting "omg I have uberz MMORPG idea for make of billions $, how do learn to programz!?" (disclaimer seems necessary based on previous lurking experience).

What I'd like to do is build a fairly minimalist game with a small set of features (including no graphics whatsoever) that runs on a server, using both a browser and a windows application as a client (as in, the user can choose between either). That is, the user sends a set of commands thru the client (which to start I would like to be browser-based) and the server processes the commands based on the data present in the server. The client can query info from the server to learn about the game state, such as to see the result of the player's actions. The main goal of this project is for me to learn the basics of creating a bare-bones (note that I'm avoiding the use of the word "simple") game that can run on a browser with some form of client-server architecture. One reason for this is because I want to vastly improve my knowledge of web application design, and from experience, the best way to do this is to have a challenging project which is very interesting to me.

I have a pretty good amount of programming experience (Masters in Computer Science; 2 years of industry experience in Software Development; lots of game design experience in C++, including a game with networked 2 player mode; also made games with Python, Android SDK, etc.), but I don't have much experience with Web App development (been dabbling with ASP.NET, including MVC 3 framework). What I'd like to know is what the community thinks would be the recommended tools, frameworks, engines, methods of data storage (hopefully handled by the frameworks), languages, and all that, which would be best suited for this project. As a brief overview, here are some of the things I would like to be able to do:

1) User should have a minimalist client with no interactive graphics (except maybe icons and still images) that mostly gives forms for inputting various commands which will be processed by the server, and then the client can display info queried from the server.

2) Client needs to be operational from a browser, and hopefully also from a windows application. Heck, if possible, it would be great if this was all abstracted in a way that I could have the client run from anything, like a mobile device, as well (but not really important).

3) I'd prefer if I could use a framework that easily lets me render stuff like tables and lists on the client. ASP.NET is an example of such framework, but not sure how useful this framework can be overall for games (doesn't seem like a popular choice, but I don't want graphics, so maybe it could apply here).

4) To start, different players will have NO interaction with eachother; only with the server. Like a single-player game that does all the calculations server-side (we all know of a recent one). I'd like to be able to eventually be able to expand into having these player-to-player interactions, in the far future, when I understand more about this stuff... but I'd like to learn the proper tools that will one day be well-suited for this type of flexibility.

5) A framework with some flexibility (so that I can customize it to do something very specific if wanted to) would be great, but I prefer ease of use. Having both would be ideal though.

Here is an example of how some sample "gameplay" would work, without divulging any info about the game ideas, although if it's helpful I could go into details about more of the actual themes:

1) Player logs into client, sees the index form linking to many options.

2) Player chooses the a tab which takes him to a different form where he sees the money available to that player and a list of units the player controls.

3) The player clicks on a link or button to buy a new unit. Server processes the request, updates the data for that player, and the player now sees an additional unit on the list (or table) of units. The player sees less money than before. Hopefully the units and money can have icons associated with them.

4) This type of interaction ad infinitum.


I would also happily accept any other types of advice, references, links, or the like. Looking forward to any kind of response, and thanks in advance =).


edit: Where relevant, I should mention that my preferred language would probably be C#, but I could just as well work with Java or Python, and would prefer to avoid C++ unless it's the best choice for some good reason.

PARTNERS