Reuse your Flash games code – exclusive code Vs recyclable code

Emanuele Feronato Actionscript 3, Flash, Game design

This is ideally the sequel of reuse your Flash games code (as much as you can!) post.

If the post I wrote about two months ago is almost pure theory, here I am with some numbers which can show you the importance of reusing your code.

I made two games using a set of libraries which I can reuse with no hassle. The first is Stringy, and it will be released this week, at the moment it’s in last call on Flash Game License. The second is Slingy, and it was submitted today for bidding, always on Flash Game License of course.

The first is some kind of mouse avoider with a twist, while the second is a fire and collect physics game. Two completely different gameplays. You can check the video teaser here. So what kind of code can I reuse? Obviously, all menu management, API connections, low level achievement routines, and everything which is not strictly part of the game itself.

But I think it’s time to show you some numbers.

Stringy has been coded with 929 lines, but if we exclude everything which is not strictly related to gameplay, we remain with only 424 lines. This means only 45.6% of the code cannot be reused, unless I plan a sequel. The remaining 54.4% has been used to create Slingy, 1179 lines of pure awesomeness, but only 720 have been written from scratch.

In other words, my second game just needed 61.1% of the effort I needed to put if I decided to code it from scratch. And less effort means less time, which obviously means more games and more money.

Now, while I am waiting for billionaire bids on FGL, I am making my first StencylWorks game, but I am also creating some kind of framework into framework to minimize the effort needed to make a game.

Comments 4

  1. Chris

    The guys over at 8bit rocket have a book out, but it also goes through building a game framework. (The Essential Guide to Flash Games)

    I started awhile ago, and really need to set it up so I can copy most of the code from AS3 into Java, or the other ways around.

    But game frameworks do help a lot- from basic sprite structures to replace movieclips (using blitting instead), sprite managers, and just handling the repetitive stuff, that you always need to have, to have a basic game.

  2. Alice

    Thoughts: I don’t think you can equate the number of lines to the amount of work done. The code that implements the gameplay is usually more complex and thus requires more time to write than that of menus and other trivial coding.

    Good overall message, though.

  3. Yuri

    I don’t want to sound condescending but as a professional programmer 1000 lines of codes is totally insignificant. I have 20000+ lines of codes in my flash game and it’s far from finished.

Leave a Reply

Your email address will not be published. Required fields are marked *