In my previous entry, I talked about how we were planning on caching data to avoid network latency in accessing items in the data store. But a cache of data is only going to work if we can somehow make sure that a particular chunk of data is only being accessed from a single game server. If we can't do this, we actually make the problem worse, since accessing the data will require that the game server wanting the access will need to get in touch with the central store, which in turn will have to flush the cache from whatever other game server might be accessing that data. So Project Darkstar miracle number two is finding a way to increase our chances that all of the tasks that are accessing a given chunk of game state are located on the same game server.

This might seem to be a simple matter of programming. After all, we know what data is being cached on what server, so we ought to be able to simply move any task that isn't on that server that wants to touch that data to the right server. There are a couple of problems with this approach, however. The first is that moving a task is more expensive than moving the data, since tasks are associated with network connections that would also have to be moved (among other things). The second is that tasks tend to access more than one data item at a time, and so we need to make sure that all of the data items (and all the tasks that are accessing those data items) are co-located. Doing this by keeping track of each task and each data item quickly becomes, as they say in the trade, computationally infeasible.

So the first thing we need is some way of collecting groups of tasks that can be moved as a unit. The obvious grouping is by player. Those tasks that are being performed in response to a particular player are grouped together so that if it makes sense to move any of them, they will all be moved. We think this will also help in localizing the data access, since if a player is interacting with some data, the chances are that he or she will continue to interact with that data. Organizing tasks by identity works not just for players, but also for non-player characters (PNCs), who also have identities. Finally, organizing by players allows us to have a notion of history if needed. Tasks just happen and then cease to exist, but identities last over time, and give us something that we can instrument and observe, allowing us to measure the effectiveness of what we are doing.

While organizing tasks into groups by identity helps, we now think that we can do even better. And here is where the miracle could occur.

The idea first came when the engineer working on the problem of clustering task, Jane Loizeaux, started looking at tools that might let her visualize what players were doing in a game. She started looking into social networking tools, that do a lot of this sort of visual representation, and then realized that players in games form just these kinds of social networks. Whether the network is long-lasting like a guild or short-term like a particular encounter, the connections revealed by communication patterns and data access split the set of identities into clusters. Our current thought is that if we can determine what those clusters are, we can try to insure that all the members of a particular cluster are co-located on a particular server. When we add the assumption that those who are in a particular cluster are more likely to be interacting with the same game data, we get a way of insuring that the data and the tasks that are using that data are co-located on the same server.

So the Darkstar engineering group is now looking at a lot of the literature concerning discovering social networking, and trying to figure out how to apply the algorithms to the players in a game to let us determine the clusters of players in the game. We can then use these units to place groups of players on game servers, and (when necessary) move entire groups from one server to another. Such a move might be to deal with the fact that the group is now interacting with a different set of data (as happens over the course of a game) or because the set of groups on a particular server is getting too large and is causing the server to slow down.

We don't actually know if this scheme is going to work. It is only speculation on our part at the moment that the partitioning of players (and other identities) that is the result of the social networking algorithms will give us the set of players that are interacting with a particular data set. But it seems like a reasonable possibility, and the only way to really find out is experimentally. So we are implementing the pieces now, and will see if we actually get the results that we think we will get. This is one of those places where it is clear that we are a research group (where the definition of research is that we don't know what we are doing). The only way to find out is to try. The good thing about being a research group is that our goal is to learn things, so even if this turns out to be the wrong approach, we will have learned something.

Comments:

I have tremendous respect for the work you guys (and gals!) are doing on Darkstar. It's fascinating to read about. Thanks for sharing!

Posted by jason on July 10, 2009 at 08:05 PM PDT #

But most games take place in some virtual world which has a certain spatial geometry. Almost all interaction takes place in a localized spatial area. Then why not introduce a distributed spatial data structure, according to which tasks and data can be partitioned according to their spatial location?

Posted by pron on July 15, 2009 at 01:38 AM PDT #

@pron

That is not a bad idea. The thing is, though, that many but not all games have this property so it is a difficult concept to implement in an abstract way. We've also thought about using Darkstar "Channel" membership to help partition data as well as provide a mechanism for developers to give guidance themselves (i.e. through annotations or something like that).

None of these ideas have been abandoned, but if Jane's work pans out the way we think it will, then players will naturally be partitioned to reduce communication between game servers. In a virtual world with spatial geometry, it seems likely that this would naturally organize players according to virtual proximity.

Posted by Owen on July 15, 2009 at 08:13 AM PDT #

Dunno if this is a problem, but what happens if you've got a 5000 strong group of players, and they don't all fit on one server? Would it be possible to partition nearby servers and open a local connection to these from the original server to allow state to be updated in accordance with what is going on on the original server? After all the whole point is that these players are sharing tasks isn't it? Ie if you are pooling players, could a seperate master/slave system be formed?

Also, I agree with the previous post, the developer should have and should be capable of implementing a grouping structure or at least hints on his own. Channels would be a great tool for this, and if you're grouping by channel it should be easy to get this going. I think you're maybe trying to fool-proof this thing a bit much to be honest. But I think a zoning option it what's missing, almost every game has zones, be it a MUD in a particular room, or a 3d MMO with spatial grouping by geographic location, or a FPS with a particular level. Even a chess game has a zone, albeit a zone of only two players, or two groups of teams. Remember, zoning is fact. Zoning has been used in all kinds of games to divide computation. As my programming lecturer says, "why re-invent the wheel?". A few development options that the developer COULD but doesn't necessarily HAVE TO implement could speed things up development-wise no end. I think the one size fits all strategy may be a bit too optimistic, and may actually limit the game developer who only wants to develop a specific game.

Also AI comes into it all too, imagine an army of 10000 monsters, all sharing the same tasks. This is where I shoot myself down a bit, but they could be in 100 different zones. In your "Slouching Towards Multinode" post you mention that this is a prime area for segregation. Well why not allow a "Type" option, where the character is either linked to a "User", or has type "AI". Then the servers could automatically split load between these two types, no matter the game. A user is automatically given type user by the server anyway, so all we would need to do is highlight the AI tasks. In an MMO the AI could just have world translation per instance, and could be placed in any zone you like, but the tasks wouldn't even be specific to that zone, because the instance of the AI monster has no need for zone grouping. This would equally benefit a chess game, AI sits on one set of servers, and does it's computation sharing tasks there, and the users are distributed over the remaining server. Most games have some form of AI..

I said a bit about this on the forums, and got shot down a bit because my suggestion was "too complex" and could be hard to track in game design, but I was being too complex with that particular example. But hell, it's easy to get Managed Objects all wrong and wreck the game, destroy scalability etc, so I don't see that what I'm suggesting now would be too much more difficult to track and implement.

Put it this way, with these options, it should be possible to develop a game that can scale on multinode with the technology as it is, it could be an easily implementable stop-gap until the "Holy Grail" is realised. Remember, big game companies aren't gonna be too happy taking on a technology that they're not 100% certain will ever work as intended, it's too much of a risk. If you give them some options that allow them to get it all going NOW, they're gonna be happy enough. After all, there are some genuine and quite tremendous benefits of the technology as it stands, specifically for MMO development where a seamless, un-sharded world containing all users currently logged in is a bit of a "Holy Grail" in itself. That's the reason I'm designing my game with Darkstar, and that's why I'm investing my time in a technology I'm not sure will ever work properly, because if there is a chance it will work, my game will attain the ultimate in game design (for my type of game). Now if I need to type a few extra lines of code and think about organization of tasks a bit myself to get this, I would still be quite happy :)

I think a little bit more attention to the neuances of game design and a little less emphasis on Enterprise systems and we should have something we can deploy..

Posted by Will on July 19, 2009 at 07:06 AM PDT #

Will, I think your mistaken as to how stuff would be grouped. Or to put it differently: I think your mistaken about task identity: A task it not the same if it has the same abstract goals same steps etc.

10000 monsters might have the same task of attacking any entity on sight but that doesn't make them participate in the same task unless that entity just happens to be the same among those tasks. If they all attack entity x for example then entity x becomes the binding factor that actually groups them together.

Same with buying something in a shop: several people might be shopping at the same time but they need not to be grouped unless they shop at the same vendor. (or should that be inventory - a shop might have more then one shop keeper?)

Mind you they don't look at the instructions themselves, rather they look at the flow of data. Patterns in this flow of data can be mapped to tasks being performed

With regard to large clusters: One can also differentiate between the level of strength's of a connection or 'rate them'(weight). based on this one should be able to partition the cluster. Making partitions that are of manageable sizes should as far as can be overseen now always work because of natural limit's: entities take up space coupled with attack range for example.

So say if given the interaction of a fight one might rate participants connection by distance they are to their target.

With regard to applying pragmatism to building darkstar that's a double edged blade: on one side you might speed up adoption rate - on the other side you might smother progress since that grows the codebase. Regardless there is also the pragmatic way to being pragmatic: I think there is a branch / are branches around that try to achieve just that - hurray for open source.

Posted by Michael b on August 26, 2009 at 08:40 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed

This blog copyright 2009 by Jim Waldo