Modeling Turn-based Games

View previous topic View next topic Go down

Modeling Turn-based Games

Post  arowshan on Thu Feb 28, 2013 2:28 pm

I am trying to model a game in which 2 players take turn to play. Each turn generates turn specific facts. As part of the requirements we need the game duration as well. I know I would need a fact table at the grain of each turn with facts corresponding to each turn. Now, what is a good way to model for game duration. I was thinking of having another fact table at the grain of the game with start and end date/time which I could use to get the duration. If I do that, should I have 2 rows per game (one for each player). If I do that duration would be doubled unless I divide it by 2 :). Or I can have one row per game which I would then lose user data.

arowshan

Posts : 23
Join date : 2011-10-18
Location : Vancouver, Canada

View user profile

Back to top Go down

Re: Modeling Turn-based Games

Post  TheNJDevil on Thu Feb 28, 2013 3:53 pm

Game is a dimension. Each turn record would reference the gameID for that specific game. Game duration would be max(turnDate) - min(turnDate) grouping by the gameid.

TheNJDevil

Posts : 68
Join date : 2011-03-01

View user profile

Back to top Go down

Re: Modeling Turn-based Games

Post  arowshan on Thu Feb 28, 2013 4:18 pm

I understand that I can do that in SQL. I am trying to come up with a model that is easy to work with in OLAP engine like SSAS. I actually realized that I need turn duration as well. Here is the sequence of events that happen:

Game Starts
Player 1 starts his turn by spinning the wheel with 4 reels and ends up with 4 cards (like a slot machine)
Each card then gets applied and could have affects on each player such as health and gold
Player 2 spins the wheel
...
When one of player's health goes down to zero game ends

So, in terms of lowest level of granularity, it would be the event when each card is applied for each user, card, turn#, Game# and date/time. The question is, is it best to incorporate turn duration and ultimately game duration in this fact table. If so, I think I would have to maybe write MDX calculations in SSAS to come up with durations which I can't really think of off top of my head.

arowshan

Posts : 23
Join date : 2011-10-18
Location : Vancouver, Canada

View user profile

Back to top Go down

Re: Modeling Turn-based Games

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum