May312012

Delayed

The original plan was to be done with the game (at least the iOS version) by August of this year because August is when I start grad school (Master’s in Statistical Practice). The reasoning was that once I start that program, I would have no time left to work on the game.

This was a bad plan.

So instead I’ll just go low for a while. Maybe you’ll see news about this game in a year or two. A lot of indie development teams do this and I finally realize their motivation. What I have is something beautiful and to rush it would be a disservice to myself, the game, and all of you.

In the meantime, there are certain things I want to remove, change, and add, both in terms of game mechanics and features. For example, the single-player puzzle mode (which is conceptually really cool) cannot be implemented into the current multiplayer-only build without rewriting a bunch of core things. I’d also like to get rid of the random aspect of the game and thus allow players to develop grandiose strategies.

And last, but not least, I’d like to develop multi-platform, cross-platform versions of the game. In a year or two, I would like to not only launch on iOS, but on Windows, OSX, Facebook, and potentially Android (although anyone who knows me knows how negatively I feel about Android development, despite owning Android phones for the past 4 years).

I’m taking what I’ve got right now, throwing it through a magical deconstruction box which transforms it into a metaphorical caterpillar, then enveloping it in a cocoon.

Expect a metamorphosis.

Expect a metaphorical butterfly.

Expect something big, fun, amazing, polished, and fantastic.

Don’t expect it soon.

May112012

Getting ready to start releasing the prototype for playtesting. Adding things to the interface to make the game easier to understand if I’m not there to explain what the game is about, how to play it, and what to do.

April252012

After several weeks of hard work, I’m proud to finally show you guys the prototype.

April192012
The past couple of days have been full of interesting challenges, problem solving, and moments of fantastic triumph. I’m making a ton of progress on this game and in my sessions of indoor rock climbing, to which the three things I listed apply equally as well.

I’m happy to announce that after a lot of work, this game is going to feature peer-to-peer multiplayer via Bluetooth! What this means is that two friends will be able to connect their iDevices (iPod Touch, iPad, iPhone) together and play Greed: Make History in real-time! No internet connection required!

This is, of course, in addition to the asynchronous online multiplayer that I also have up and running right now. What does that mean? It means you’ll receive notifications when it’s your turn in a match, open the game, open the match, make your move, and then close the game. If you’ve played Words with Friends, Ascension, or Carcassonne then you’ve already played an asynchronous mobile game! You’ll be able to invite friends and/or ask Game Center to auto-match one or more players for you.

Few things to note, however: while the online game supports up to 4 players (or more, potentially), the peer-to-peer feature is for 1v1 matches only. I’m using Game Center’s Turn-Based API which is something Apple added in iOS 5, so if you’re still running iOS 4 then I’m afraid you won’t be able to play online with other people.

The past couple of days have been full of interesting challenges, problem solving, and moments of fantastic triumph. I’m making a ton of progress on this game and in my sessions of indoor rock climbing, to which the three things I listed apply equally as well.

I’m happy to announce that after a lot of work, this game is going to feature peer-to-peer multiplayer via Bluetooth! What this means is that two friends will be able to connect their iDevices (iPod Touch, iPad, iPhone) together and play Greed: Make History in real-time! No internet connection required!

This is, of course, in addition to the asynchronous online multiplayer that I also have up and running right now. What does that mean? It means you’ll receive notifications when it’s your turn in a match, open the game, open the match, make your move, and then close the game. If you’ve played Words with Friends, Ascension, or Carcassonne then you’ve already played an asynchronous mobile game! You’ll be able to invite friends and/or ask Game Center to auto-match one or more players for you.

Few things to note, however: while the online game supports up to 4 players (or more, potentially), the peer-to-peer feature is for 1v1 matches only. I’m using Game Center’s Turn-Based API which is something Apple added in iOS 5, so if you’re still running iOS 4 then I’m afraid you won’t be able to play online with other people.

April112012

Saving & Loading Match Data (OR) Why I’m gonna have to use my own server for storing information. /sadface

I can now save & load the match data (that is, who played what and when). I try to condense information as much as possible when saving because when you send match data to Apple’s Game Center servers, that data cannot exceed 4K bytes.

What this means, in turn, is that when the data is received from the server the program then has to reconstruct the entire timeline out of that very, very minimalist dataset. It goes through and creates all the layers (see earlier posts) and other stuff.

Before I do anything with Game Center (I haven’t even [re]built the interface yet after throwing away what I had before), I, being a statistician, decided to collect some data. I made the program save & load different combinations (how many players, how many events each player plays every turn, etc.) to get a clear picture of how the number of events played impacts

  • the file size and
  • the execution time of the “timeline reconstruction” procedure.

There is a strongly linear, positive relationship between # of events and size. Simple linear regression indicates that there is an increase of ~33 bytes for every extra event. Using the model, we can predict that a timeline with 111 events results in almost 4K bytes (predicted: ~3981 bytes). We can’t go higher than 111 events because the file size ends up being over 4K bytes when we have 112 events.

In fact, when I create 111 events and save the match data, I end up with a file that weighs drumroll 3999 bytes! Isn’t math great?

This is troublesome. Why? Because in the first & third trimesters of the match (turns 1-8 & turns 17-24, respectively) each player can play at most 2 events into every turn. In the second trimester (turns 9-16) there can be at most 3 events played into every turn by each player. Suppose we have a 4 player match:

( (8 + 8) * 2 + 8 * 3 ) * 4 = 224 events total

What happens when 224 events are played? Well, I ran the code that saves the match data and we end up with a file size of 7586 bytes :(

When an iOS game uses Game Center’s Turn-Based API, it sends some information to Apple’s servers when a turn is submitted by a player. When other players open up that match to play, they receive that information from Apple and then the game processes it. ONE of the pieces of that information is the actual match data. That match data can be anything. If you can condense the entire state of the match into less than 4K bytes, then you can just do that.

However, if you can’t get below that limit, then you can send the state of the game to your own server and then your match data would just be the address of where the actual match data is on the internet. You would then download the match data separately when you open the match to make your turn.

The amount of time it takes to actually reconstruct the timeline from the match data is exponential and gets pretty intense as the number of events increases. How long did it take to reconstruct a timeline from 224 events? 57.395168 seconds. Almost a minute to load up the match and start playing (although technically that game is over at that point).

Actually, it’s probably gonna take longer than that because all these calculations are performed on the latest generation of Mac mini. Is it fair to ask people to wait (I’m estimating here) 2 minutes just to make a turn? Well, I’ve waited longer whenever I launched Infinity Blade and Infinity Blade 2. I think I’m gonna have to make it so that there is an internal cache of matches so that there is least wait between opening match and being able to play.

Also keep in mind that I played only 1 specific event which I created just for this data-gathering experiment. Most events wouldn’t be as complex and intense as that specific one, but it’s better to be safe than sorry.

Hopefully this was somewhat insightful to you guys.

April102012
Hopefully tumblr lets you see the full sized version with the clear text. The comments are [for the most part] comprehendible and should explain what’s going on.

I’m happy to announce that I’m done with the time manipulation mechanics. Everything works as intended and events properly ripple forward through time, affecting other events which affect other events which…you get the idea.

As I mentioned on twitter, I basically had to completely rewrite the “Layerable Matrix” data structure. I kept getting weird bugs that were mostly due to using two-dimensional int/float matrices within objects (thus having to use pointers like int** and float**) and EVERYTHING BEHAVED LIKE SHIT. Hence rewrite. Now everything works flawlessly!

It is finally time to actually turn these systems I’ve built into an actual game. How exciting!

Hopefully tumblr lets you see the full sized version with the clear text. The comments are [for the most part] comprehendible and should explain what’s going on.

I’m happy to announce that I’m done with the time manipulation mechanics. Everything works as intended and events properly ripple forward through time, affecting other events which affect other events which…you get the idea.

As I mentioned on twitter, I basically had to completely rewrite the “Layerable Matrix” data structure. I kept getting weird bugs that were mostly due to using two-dimensional int/float matrices within objects (thus having to use pointers like int** and float**) and EVERYTHING BEHAVED LIKE SHIT. Hence rewrite. Now everything works flawlessly!

It is finally time to actually turn these systems I’ve built into an actual game. How exciting!

April52012
The Grammar of Effects

The challenge was to devise a grammar for describing the effects (that an event may have) in such a way as to have an easy method of translation to something within the computer’s memory.

After that was done, the next challenge was to actually write the code. It wasn’t very hard, to be honest. The actually hard part is going to be connecting the ideas of the previous post about “the layerable matrix” with the parsed event descriptions. If you haven’t read it yet, I recommend giving it a read: http://greed-make-history.tumblr.com/post/20276638805/problem-model-the-effects-of-time-manipulation-on (not sure if I mention it in that post, but the “Layerable Matrix” data structure has already been successfully implemented)

In other words, now that I have a system for obtaining the effects of events (currently 2 events for testing, definitely more to come in the future :D ) I need to write a system that creates appropriate layers based on those effects.

A simple effect (i.e. Add $-500 for 1 turns with a delay of 0 turns.) results in a pretty basic new layer on the money matrix. On the other hand, a complex effect (i.e. Add $100 for 10 turns with a delay of 1 turns.) results in either (I haven’t yet decided):

multiple new layers (i.e. 10 layers, each one adding $100)
a single new layer (i.e. +100 +200 +300 +400 …. +1000)
Then I need to have a separate manager object that’s keeping track of which layers go with which played events. So if an event suddenly becomes invalid for whatever reason (actually the only reason is that its prerequisites aren’t being satisfied) then the manager can “turn off” the associated layers and do the subsequent calculations.

The Grammar of Effects

The challenge was to devise a grammar for describing the effects (that an event may have) in such a way as to have an easy method of translation to something within the computer’s memory.

After that was done, the next challenge was to actually write the code. It wasn’t very hard, to be honest. The actually hard part is going to be connecting the ideas of the previous post about “the layerable matrix” with the parsed event descriptions. If you haven’t read it yet, I recommend giving it a read: http://greed-make-history.tumblr.com/post/20276638805/problem-model-the-effects-of-time-manipulation-on (not sure if I mention it in that post, but the “Layerable Matrix” data structure has already been successfully implemented)

In other words, now that I have a system for obtaining the effects of events (currently 2 events for testing, definitely more to come in the future :D ) I need to write a system that creates appropriate layers based on those effects.

A simple effect (i.e. Add $-500 for 1 turns with a delay of 0 turns.) results in a pretty basic new layer on the money matrix. On the other hand, a complex effect (i.e. Add $100 for 10 turns with a delay of 1 turns.) results in either (I haven’t yet decided):

  • multiple new layers (i.e. 10 layers, each one adding $100)
  • a single new layer (i.e. +100 +200 +300 +400 …. +1000)

Then I need to have a separate manager object that’s keeping track of which layers go with which played events. So if an event suddenly becomes invalid for whatever reason (actually the only reason is that its prerequisites aren’t being satisfied) then the manager can “turn off” the associated layers and do the subsequent calculations.

April12012
Problem: Model the effects of time manipulation on player resources in a turn-based game.

Solution: Data Layering:

Imagine there are 24 turns in this game and you, as well as every other player, has a different amount of money, dominance, other resource?, etc. at every single turn. I mean, you start with 0 money, for example, at every turn. BUT as you begin playing events (which affect your resources), those changes have to be reflected not just at the turn during which any given event was played but also every subsequent one since changes ripple forward in time.

Furthermore, as you continue playing, certain events previously played may become invalid and may no longer have any effects! So, for example, an event may have a requirement of 25% dominance which you most certainly had when you first played the event but something happened which caused you to lose dominance. Well, that event’s prerequisites are no longer satisfied so it’s invalid! Therefore whatever changes it used to have must be nullified and this nullification must be reflected across the rest of the timeline and all subsequent events must be checked for validity. It’s a very recursive problem.

Initially, one might be inclined to have a single matrix of data (where the rows are, for example, the players in a match and the columns are the turns) which holds resource statistics. As events are played, this matrix is modified accordingly. Should an event become invalid, an opposite operation is applied. So if event A gave player 1 $500 at turn 3, then you would take away $500 at turn 3 and every subsequent turn. In this simple scenario, such a solution is efficient and very easily implemented.

HOWEVER, as you continue to add events and dynamic relationships between events start to emerge, this solution breaks more and more. That’s when I was inspired by Photoshop.

Allow me to explain, when you work on a file in Photoshop (or Illustrator or a similar professional art application), you can (& should) use layers. You can turn layers on and off so if you want to see what your design looks like without a brown gradient overlaid on top of it, you can do that with a single click.

Then I thought, Why not  do the same with data?

So I decided to define a “Layerable Matrix” class (and a “Matrix Layer” class too, for that matter) which would allow the program to turn layers on and off (layers are tied to events, so if an event is invalid then its related layer is off) and then query the object for a final matrix which is the base (default) matrix + all the “ON” layers. I am incredibly satisfied with this result and my implementation of the idea.

Although coding the low-level operations was a major hassle, it enabled me to construct some high-level commands which are almost indistinguishable from magic:

Me: add 9% dominance to player 3 at turn 4.
Program: OK, I’ll subtract 3% from the other 3 players and do as you asked. Then I’ll create a data layer which represents this change. Upon request, I can provide the final matrix in which all the changes have been accounted for.
Me: now increase anarchy by 5% at turn 19.
Program: OK, I’ll do that. Then I’ll…

You get the idea :)

Problem: Model the effects of time manipulation on player resources in a turn-based game.

Solution: Data Layering:

Imagine there are 24 turns in this game and you, as well as every other player, has a different amount of money, dominance, other resource?, etc. at every single turn. I mean, you start with 0 money, for example, at every turn. BUT as you begin playing events (which affect your resources), those changes have to be reflected not just at the turn during which any given event was played but also every subsequent one since changes ripple forward in time.

Furthermore, as you continue playing, certain events previously played may become invalid and may no longer have any effects! So, for example, an event may have a requirement of 25% dominance which you most certainly had when you first played the event but something happened which caused you to lose dominance. Well, that event’s prerequisites are no longer satisfied so it’s invalid! Therefore whatever changes it used to have must be nullified and this nullification must be reflected across the rest of the timeline and all subsequent events must be checked for validity. It’s a very recursive problem.

Initially, one might be inclined to have a single matrix of data (where the rows are, for example, the players in a match and the columns are the turns) which holds resource statistics. As events are played, this matrix is modified accordingly. Should an event become invalid, an opposite operation is applied. So if event A gave player 1 $500 at turn 3, then you would take away $500 at turn 3 and every subsequent turn. In this simple scenario, such a solution is efficient and very easily implemented.

HOWEVER, as you continue to add events and dynamic relationships between events start to emerge, this solution breaks more and more. That’s when I was inspired by Photoshop.

Allow me to explain, when you work on a file in Photoshop (or Illustrator or a similar professional art application), you can (& should) use layers. You can turn layers on and off so if you want to see what your design looks like without a brown gradient overlaid on top of it, you can do that with a single click.

Then I thought, Why not do the same with data?

So I decided to define a “Layerable Matrix” class (and a “Matrix Layer” class too, for that matter) which would allow the program to turn layers on and off (layers are tied to events, so if an event is invalid then its related layer is off) and then query the object for a final matrix which is the base (default) matrix + all the “ON” layers. I am incredibly satisfied with this result and my implementation of the idea.

Although coding the low-level operations was a major hassle, it enabled me to construct some high-level commands which are almost indistinguishable from magic:

Me: add 9% dominance to player 3 at turn 4. Program: OK, I’ll subtract 3% from the other 3 players and do as you asked. Then I’ll create a data layer which represents this change. Upon request, I can provide the final matrix in which all the changes have been accounted for. Me: now increase anarchy by 5% at turn 19. Program: OK, I’ll do that. Then I’ll…

You get the idea :)

February122012
I’ve been developing my own spreadsheet app for the past few days. I’m using it to prototype the game logic (read as: effects of events being played at various points in time in a non-linear fashion).
I can adjust the various resources now at any turn for any player now so the next step is to implement a few example events. Once that is done, I will need to:
Create the grammar for describing the events’ effects.
Program an interpreter which will use the said grammar to parse descriptions into code.
Have a field for typing out the description (using the grammar rules) and testing the events out on the timeline.
Save events into a library which allows me to reuse them.
Basically I’m taking a detour from the development of the Greed app by developing a tool for content generation and codes which will be used in Greed.

I’ve been developing my own spreadsheet app for the past few days. I’m using it to prototype the game logic (read as: effects of events being played at various points in time in a non-linear fashion).

I can adjust the various resources now at any turn for any player now so the next step is to implement a few example events. Once that is done, I will need to:

  1. Create the grammar for describing the events’ effects.
  2. Program an interpreter which will use the said grammar to parse descriptions into code.
  3. Have a field for typing out the description (using the grammar rules) and testing the events out on the timeline.
  4. Save events into a library which allows me to reuse them.

Basically I’m taking a detour from the development of the Greed app by developing a tool for content generation and codes which will be used in Greed.

February82012
← Older entries Page 1 of 3