Flash 4k Game Competition Announced

Discussion in 'Announcements' started by urbansquall, Feb 6, 2009.

  1. urbansquall

    Original Member

    Joined:
    Nov 10, 2005
    Messages:
    37
    Likes Received:
    0
    We're hosting a Flash 4k Game Competition that is officially kicking off today. There are some (albeit modest) prizes available to first and second place. If you're interested in participating you can get the full details on the gamepoetry site.

    Best of luck to all participants!
     
  2. oNyx

    Original Member

    Joined:
    Jul 26, 2004
    Messages:
    1,212
    Likes Received:
    0
    Are there any free byte code shrinkers/obfuscators? There are dozens for Java and we all used em excessively in the 4k compo.

    On a related note: I wrote some (alpha quality) SWF recompressor. It doesn't inflate embedded Deflate streams (such as images) yet, but if there is only code it already does recompress everything (well, that single Deflate stream).

    http://kaioa.com/node/87

    For this kind of stuff it saves about 2%, which gives you about 100 bytes extra.
     
  3. JGOware

    Indie Author

    Joined:
    Aug 22, 2007
    Messages:
    1,578
    Likes Received:
    0
    4k? My first flash game has 4k in just 1 bitmap! :) lol..
     
  4. oNyx

    Original Member

    Joined:
    Jul 26, 2004
    Messages:
    1,212
    Likes Received:
    0
    With 4k games you usually don't use any bitmaps. With procedural graphics there is more room for game logic. Well, the penalty seems to be a tad smaller with Flash, but it's probably still a good idea to avoid embedded resources.

    Hm. I really wonder which tags can be thrown away. E.g. the stats for a simple setup with some generator for glowy images (release build of course) looks like this (name[id] count uncompressed_bytes):
    Code:
                             DoABC [82]      1         2286
                          Metadata [77]      1          458
                                 ? [41]      1           26
                       SymbolClass [76]      1            9
                        FrameLabel [43]      1            5
                    FileAttributes [69]      1            4
                      ScriptLimits [65]      1            4
                SetBackgroundColor [ 9]      1            3
                         ShowFrame [ 1]      1            0
                               End [ 0]      1            0
    The metadata can be surely thrown away and the same probably also goes for all undefined tags.

    Edit:
    • Metadata can be stripped.
    • SymbolClass can be stripped if the HasMetadata field in the (required) FileAttributes tag is set to false (0).
    • ScriptLimits can be stripped. (Defines recursion depth [default: 256] and script timeout [default: 15-20 seconds]).
    • SetBackgroundColor can be eventually stripped.
    • All undefined tags can be most likely stripped since they aren't required and probably aren't good for anything.
     
    #4 oNyx, Feb 7, 2009
    Last edited: Feb 7, 2009
  5. oNyx

    Original Member

    Joined:
    Jul 26, 2004
    Messages:
    1,212
    Likes Received:
    0
    By the way I think it's silly to disallow haXe (or well, any other method than Flash CS3 or the Flex SDK). Also if someone likes the pain of using some kind of Flash ASM, you shouldn't stop him/her.

    The requirement to submit the code along with the game opens a whole can of worms, since you didn't say anything about the license (zlib would be probably a good choice). Some might go for GPL, etc.

    There is also the possibility to embed the game itself as octet stream, which would mean that the code itself (which you can compile to build the game) only contains a tiny useless loader.

    Additionally, I think it would be nice to allow participants to submit up to 2 different builds. One which is <= 4096 bytes and optionally one with embedded ads for putting it on the website. After all creating a good 4k game can easily take a week or even longer.
     
  6. urbansquall

    Original Member

    Joined:
    Nov 10, 2005
    Messages:
    37
    Likes Received:
    0
    This is why I need to be able to build the game, so I can verify the winner is not doing anything tricksy behind the scenes.

    There are more ways to build a Flash swf than I care to learn. If you really want to use haXe or something, it should be easy enough to port to Actionscript after the fact. I'm expecting a lot of participants, so I really don't want to have to deal with everyone's unique pipeline. Perhaps it'll be different for the next competition, but I want to keep this one manageable. :)

    That's only if you want a prize. You can submit an entry and opt out if you just want to pimp your work. It might not be official legaleze, but this is just a chill competition. If you're worried about people stealing your 1337 <4k engine, then I think you might be misunderstanding the spirit of the competition (which is to have fun while dealing with tight constraints).

    Maybe you've entered too many "competitions" with ulterior motives. Yes, you have to let me post the swf if you want to enter the competition (defeats the purpose otherwise). I don't care what else you do with the swf, you're free to monetize it however you like where ever you like. This isn't a "sponsorship" or some other facade. This is an opportunity to show off your badass coding skills. That's pretty much it.

    None that I know of but I've not looked into it. I'm obviously not entering the competition so I haven't exactly looked into optimization techniques.
     
  7. oNyx

    Original Member

    Joined:
    Jul 26, 2004
    Messages:
    1,212
    Likes Received:
    0
    >This is why I need to be able to build the game, so I can verify the winner is
    >not doing anything tricksy behind the scenes.

    Ahm. This octet stream stuff is alright accordingly to your rules.

    If you want to check if a game doesn't do anything fishy, simply run it offline. I.e. pull the plug or disable wifi.

    >If you're worried about people stealing your 1337 <4k engine[...]

    There are two issues:
    a) 4k code teaches bad style and awkward concepts. This is the main reason why I never shared any 4k code. I don't want that beginners mimic those things since that damage needs to be undone at some point.

    b) I'm worried that someone just takes the game as it is and puts it on his site. This even happened with some of the Java games. So, with Flash it surely will happen.

    Also with 4k there isn't anything you could call engine. It's usually not even OOP. Oh and performance is usually also pretty bad.

    Why did you ignore my two builds suggestion?

    Well, I won't participate either way. I don't want to share fugly unmaintainable code, which won't be good for anything except this one game. There just isn't any compelling reason to do that.
     
  8. urbansquall

    Original Member

    Joined:
    Nov 10, 2005
    Messages:
    37
    Likes Received:
    0
    Okay, oNyx, I appreciate you taking the time to share your thoughts on the subject, in any case.

    I'll consider your suggestions for the next round, though, especially if they are echoed by other participants.
     
  9. KNau

    Original Member

    Joined:
    Jul 29, 2004
    Messages:
    1,165
    Likes Received:
    2
    LOL - no good deed goes unpunished! The first thing that happens when anyone posts a competition is a flood of people trying to figure out how to weasel or game the rules and make exceptions for themselves. Then the complaints come in about monetizing, not sharing source, etc. Eventually a few people will want an extension because the timeline isn't fair.

    And then when the entries are collected it's a bunch of dreck you couldn't give away, so what was all the fuss about protecting code and assets?

    Chalk me up as one of the flood of people who claim they're going to enter but will probably end up forgetting the deadline and missing out :) Good luck to everyone who does enter, though.
     
  10. oNyx

    Original Member

    Joined:
    Jul 26, 2004
    Messages:
    1,212
    Likes Received:
    0
    KNau, I'm fully aware that I'm a pain in the rear, but that's not the point here.

    >weasel or game the rules

    "must work without internet connection"

    See? Easy stuff.

    >complaints [...] about monetizing

    Technically very easy to solve with Flash. So, why not? Since writing 4k stuff is very time consuming this would encourage more people to participate. It's easier to justify "wasting" a week if you get $100 in return... plus the chance for some prices - instead of only having that small chance.

    >so what was all the fuss about protecting code and assets?

    Sharing the code isn't an integral part of this type of competition. If it would be optional it would be pretty awesome. But if it's required it only scares some people away.

    Have you ever looked at 4k code? There really isn't anything to learn. It's cryptic non-reusable bullshit, which does basically everything the wrong way.

    Let's take a look at a few examples:

    Code:
    xVel=pwr?(xVel<-LR_MAX_VEL?-LR_MAX_VEL:xVel-LR_VEL):(xVel>LR_MAX_VEL?LR_MAX_VEL:xVel+LR_VEL);
    No one should ever write code like that. It's neither fast nor clever.

    Code:
    al[i].add(new Rectangle2D.Float(ex+(i==0?-80:(i==1?80:0)),ey,(float)Math.cos(Math.toRadians((float)ep[i][DEG]/100f))*(float)ep[i][VEL]/100f,(float)Math.sin(Math.toRadians((float)ep[i][DEG]/100f))*(float)ep[i][VEL]/100f));
    That line adds some Rectangle2D.Float to an ArrayList, but that's not what it actually is.

    Code:
    g.drawString("AWESOME!",(320-metrics.stringWidth("AWESOME!"))/2,340);
    Bad, but there is a reason.

    Sharing tips and tricks is great, but there are forums and wikis for that. The code won't tell you even half of the story.
     
  11. KNau

    Original Member

    Joined:
    Jul 29, 2004
    Messages:
    1,165
    Likes Received:
    2
    Your post confused me a little and maybe I'm missing something here...

    A banner ad project of mine (a mini word game thing) is currently about 100 lines of standard AS2 code and 2 vector art movie clips. The exported SWF is 896 bytes.

    I'm not using any funky coding style or shortened variable names. If you use minimal or dynamically generated vector art and a simple game loop is it not possible to stay within 4k?

    It won't be easy but the challenge of the contest, as I understand it, is how good (or how much) of a game can you come up with given those limitations?
     
  12. oNyx

    Original Member

    Joined:
    Jul 26, 2004
    Messages:
    1,212
    Likes Received:
    0
    Well, what can you do if you are 100 bytes over the limit? Or what should you do if you need a few more bytes for squishing in some feature?

    You do lots of silly things of course.

    E.g. that ternary op massacre saved about 12-16 bytes if I remember correctly. Doing the same kind of stuff in a few other places saved about 60 bytes.

    The pre-defined class abuse saved over 150 bytes. (Won't be like that with Flash.)

    Duplicated hardcoded strings means the same constant pool object is referenced, which saves a few bytes.

    The code by itself does not explain those awkward decisions. That's why I believe it does more harm than good. That was my point.

    Of course it's possible to fit a simple game into 4k - even more so if there isn't much logic involved. But everyone could do that. If you want to create something impressive you've to squish more stuff into it than the others.

    By the way I wrote a rather popular 4k Java game called fuzetsu. I really do know what this kind of competitions are all about.
     
  13. Maupin

    Original Member

    Joined:
    Jun 28, 2006
    Messages:
    1,183
    Likes Received:
    0
    I tend to agree with oNyx... the fun of these competitions is squeezing as much into the resulting executable (or in this case, .swf) as possible using little tricks like that. I don't know what overhead different .swf development methods impose, but if they do add any extra bits, naturally a competitor should be allowed to use whatever methods possible, even their own custom .swf compiler if they're that spectactularly clever/geeky.
     
  14. RinkuHero

    RinkuHero New Member

    Joined:
    Aug 11, 2006
    Messages:
    673
    Likes Received:
    1
    Is FlashDevelop (which uses the Flex SDK) allowed?
     
  15. urbansquall

    Original Member

    Joined:
    Nov 10, 2005
    Messages:
    37
    Likes Received:
    0
    Yup. You can use Flash Develop + Flex SDK, Flex Builder or Flash CS3. :)
     
  16. urbansquall

    Original Member

    Joined:
    Nov 10, 2005
    Messages:
    37
    Likes Received:
    0
  17. Bad Sector

    Original Member

    Joined:
    May 28, 2005
    Messages:
    2,742
    Likes Received:
    5
    Flex SDK might be free, but the language of choice here is haXe. Building a haXe program is as easy as placing the haXe compiler folder in your PATH and calling "haxe compile.hxml". Example:

    Code:
    set PATH=%PATH%;C:\Apps\Haxe
    haxe compile.hxml
    
    I *do* have Flex SDK because it is required (for now) to make a preloader in haXe (although a few days ago someone posted a method in the mailing list to make a preloader in pure haXe without the need of Flex SDK). I remember the installation process not being as nice and i had to look for a bunch of missing DLLs, install a new Java runtime and other things.


    However this isn't the issue. The issue is that you want the source code, which imposes additional restrictions (like the building tools), without a really valid reason. For a competition, all you need is the SWF. As oNyx mentioned, all you need to do to make sure that the SWF doesn't download data is to turn off your internet connection while testing the games.

    @oNyx:
    I have written a free/opensource SWF obfuscator called "SOB, the SWF Obfuscator". You can find it there:

    http://www.badsectoracula.com/projects/sob

    It replaces symbols with garbage and recompresses the SWF file to level 9 zlib compression. The included symbols.txt file mostly works for haXe SWFs, but for a Flash/Flex produced file you need to do more than that. At some point i plan to make a GUI front-end that makes the job easier, but currently you need to use the command line.

    Check this forum post for additional usage instructions
     
  18. urbansquall

    Original Member

    Joined:
    Nov 10, 2005
    Messages:
    37
    Likes Received:
    0
    Well, as a part of the competition I wanted the opportunity to publicly discuss some aspects of the winner's implementation, and also give readers an opportunity to pick up some tricks of their own.

    I really don't get the aversion to sharing source. It's a 4k engine with code that's going to be more about compression tricks and smart implementation than giving away something that has any street value.

    In any case, there is no need to release your source code, it is only if you want to win the top two prizes.
     
  19. KNau

    Original Member

    Joined:
    Jul 29, 2004
    Messages:
    1,165
    Likes Received:
    2
    Compressing your SWF is the same level of "cheating" as streaming external media into your game. You either can directly export from IDE to <4k or you can't. The extra tricks are weaseling to compensate for not doing what's actually requested.
     
  20. oNyx

    Original Member

    Joined:
    Jul 26, 2004
    Messages:
    1,212
    Likes Received:
    0
    >It replaces symbols with garbage[...]

    Ye, almost useful except for this part. Add a switch for names like: a,b,c...A,B,C... aa,ab,ac... you get the idea.

    For extra awesomeness use 'a' as much as possible, then the same with 'b' and so on.

    That's what most Java obfuscators (the minifying kind) do.
     

Share This Page

  • About Indie Gamer

    When the original Dexterity Forums closed in 2004, Indie Gamer was born and a diverse community has grown out of a passion for creating great games. Here you will find over 10 years of in-depth discussion on game design, the business of game development, and marketing/sales. Indie Gamer also provides a friendly place to meet up with other Developers, Artists, Composers and Writers.
  • Buy us a beer!

    Indie Gamer is delicately held together by a single poor bastard who thankfully gets help from various community volunteers. If you frequent this site or have found value in something you've learned here, help keep the site running by donating a few dollars (for beer of course)!

    Sure, I'll Buy You a Beer