ES & Complexity

Previously, I’ve posted a meta-formula on complexity in video games designed to determine how long a game takes to make.  The idea was nice, but the premise was flawed.

Why, you say?

Because each element in a game has to communicate with other elements.  Using standard Object Oriented Programming (OOP), the reigning paradigm of computer science, that means each element has to be wired to many other elements in ways that are increasingly arcane and convoluted.

The result?  Well, suppose that e = the number of elements in a game, and c = the average complexity of those elements.  One would predict, given my former formula, that the total (t) amount of complexity of a project (and thus the time spent in it) could be expressed as:

t = ec

But Starfighter X has taught me that because of the way elements have to be wired together, the actual formula is closer to:

t = ec^(1+(w/e))

Where w is the average number of elements to which a given element must be wired.

Enter Entity Systems

There is an alternative paradim to OOP that is potentially, in many ways, superior for game development, called Entity Systems (ES).  The advantage of ES is that it removes the wiring.  The result (in theory) is that the total complexity is now closer to:

t = ec + c

And thus linear instead of exponential.

I go more into how this works on Seed of Awesome, for the code-minded.

Why You Care

Starfighter X has proven a bitch to finalize.  I thought two or three lines of code would do it.  Instead, each new element I have needed to add has taken a day.  Which means, as the only day I have open is Monday, Mondays have become ‘Finish Starfighter X Day’.

In addition, the game needs an extra level of polish before I can release it without embarrassment.

Since mi padre has given me an App-Hub subscription for my birthday, I would like to have Starfighter X up for peer-review by his birthday.  And it is possible that, because ES is linear and OOP is exponential, it would actually be faster to build an ES and copy-paste the functions from OOP Starfighter X into it, then add in the missing elements, than to simply add in the missing elements.

Today’s project is simply that:  in the couple of hours I have before bed, transfer as much Starfighter X into an ES as possible.  If this process indicates that my theory is right, then on Monday I shall continue.  If not, I shall go back to grinding away at it.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s