Let's say I have something in my game (room) that does this:
- Code: Select all
public void ChangeStuff(Thing thing)
{
BigDB.Load("MyTable", "Stuff",
delegate(DatabaseObject result)
{
result.Set(thing.Name, GetSomeValue());
result.Save(true, delegate(){},
delegate(PlayerIOError error)
{
if (error.ErrorCode == ErrorCode.StaleVersion)
ChangeStuff(thing);
}
);
}
);
}
Let's assume that this method gets called once when the room is created and continues to cycle during the life of the room. With one room active, it feels pretty benign. When there's 2 or 3, you get the sense that there's going to be some conflict but the "Stuff" should stay pretty much up to date. But what happens if you have 5? Or 10? How about 30 rooms? The "Stuff" object looks like it's going to get into some trouble.
I recall having a conversation with Chris a while ago regarding an issue like this but can't recall the details.
My gut tells me it may be flawed by design. "Stuff" should actually be a table full of "Things". That way the core game code can change the specific "Thing" it's targetting without too much contention going on.
Finally, I'm being lazy. I was originally going to write a test to see how it would react under these conditions but felt posting was a quicker route.
I'd love to hear any feedback.Thanks.