Flash 4k competition

63 posts

Flag Post

So, there’s a new competition up, you have to try to create a flash game under 4kb (4096 bytes). Check it out here: http://www.gamepoetry.com/blog/2009/02/06/flash-4k-game-competition-prizes-and-rules/

Now, I know this is a bit late and it has started 2 weeks ago, but there is still more than enough time to finish up a game for it (heck, 4kb isn’t a big game at all). My fully programmed game currently stands at 1601 bytes, and I just started 2 days ago.

So, that said, even if you’re not very good or confident in your abilities, I suggest you try this out, and you might find that soon you’ll be absorbed in optimizing your code, feeling very ecstatic after every byte you eliminate (ok maybe not to that extent).

So what are you waiting for?! Get to it.

Oh, btw, as2 is at least half the size of the same code in as3.

 
Flag Post

thanks, this is really helpful. I’m almost sure I’ll enter.
One little question though, it says in the rules you must make the game using CS3; is CS4 also acceptable? I use AS2, but I wouldnt want to be disqualified for the version i use.

 
Flag Post

According to Urbansquall’s posts in random places, as long as he can open it with CS3, it is fine. In CS4 (which is what I’m using) go to File—>Save As and choose a CS3 file to save and you’re good.

Only annoyance is when you use Ctrl+S it automatically saves as a CS4 file, so only on your FINAL product you have to remember to save as CS3 before you send it.

 
Flag Post

Thanks! Mah only issue is figuring out a game idea.

 
Flag Post

wow it must have to be one SMALL game. im lookin at all my different projects and my smallest one is 12k. And thats the only game ive submitted on Kongregate.

 
Flag Post
Originally posted by cmech:

wow it must have to be one SMALL game. im lookin at all my different projects and my smallest one is 12k. And thats the only game ive submitted on Kongregate.

haha yeah. As much as you can draw basic shapes using actionscript instead of flash, use 1-letter variable names, don’t waste functions or declare variable types, reuse functions and variables as much as possible, use numbers instead of constants, and cut back on all unneeded code. It’s still gonna be a hard battle so good luck.

edit: cmech about your game: If you got rid of the menu thing, used Times new roman font, used actionscript to draw all your graphics, your 12k file will instantly become less than 4k.

 
Flag Post

how do you draw using actionscript?
Its probably a little much to put all here, so can you give me any good links or tutorials?

 
Flag Post

Here is an example:

		lineStyle(1, 0, 40);
		beginFill(0x77575B);
		moveTo(0,30);
		lineTo(0,0);
		lineTo(139,0);
		lineStyle(1, 0xffffff, 40);
		lineTo(139,30);
		lineTo(0,30);
		endFill();

You have moveTo, lineTo and curveTo (only quadratic curves though which is not very good) which are fairly self-explanatory, beginFill which sets the fill color (and optionally an opacity, 0-100 in AS2) and endFill which causes a fill to happen, and lineStyle (which takes thickness, colour and opacity) which causes all moveTo and curveTo calls to be drawn.

 
Flag Post
http://www.gamepoetry.com/blog/4k_flash_march_09/

The top 2 certainly are amazing:
http://www.gamepoetry.com/blog/4k-flash-a-steroids4k/
http://www.gamepoetry.com/blog/4k-flash-dungeon-romp/

I agree with their judging 100%.

Notable mentions (what I thought personally)
http://www.gamepoetry.com/blog/4k-flash-4kpillars/
http://www.gamepoetry.com/blog/4k-flash-attack-of-the-rage-beast/
http://www.gamepoetry.com/blog/4k-flash-go-and-turn/
http://www.gamepoetry.com/blog/4k-flash-pie/
http://www.gamepoetry.com/blog/4k-flash-switch/


But really, none of the other games really can compare up to the top two.


My entry:
http://www.gamepoetry.com/blog/4k-flash-hammy-wars/

IMO it is mediocre within the entries, but if only there was enough space to design an AI...
 
Flag Post

wow $50 prize and you have to expose your source code. Not very generous but a good way to get your hands on a lot of other peoples work.

 
Flag Post
Originally posted by arseiam:

wow $50 prize and you have to expose your source code. Not very generous but a good way to get your hands on a lot of other peoples work.

lol wtf’s that supposed to mean. Nobody cares about the prize, it’s about the challenge of making the game… and exposing source, well pick any source and try to make something out of it. Most of it is so cryptic that it’s pointless, and trying to fix it up to make a normal game would be more work than making it from scratch. Also, many of the sources have licenses to prevent people stealing it and making a blatant copy.

Imo this is one of the better competitions.

 
Flag Post

do they do this competition annualy?

 
Flag Post

This was the first one, but it seems like he has plans for more in the future.

 
Flag Post

this comp looks good and everything but i dont really think it competes with the 1k project

 
Flag Post

1k!! wow thats really small. what’s the site for that competition?

 
Flag Post

Wow that Dungeon Romp game was epic. Graphics suck ass but hey, for 4k that’s amazing.

 
Flag Post

Quite true, especially if you realize that EACH CHARACTER THAT YOU SHOW ON THE SCREEN IS 1 BYTE!

So, just having the words in the textbox probably took up almost 1kb of space, leaving him 3kb to make FULL 3D GRAPHICS + randomly generated map + different colors etc.etc.etc.

really amazing.

 
Flag Post
Originally posted by jonathanasdf:
Originally posted by arseiam:

wow $50 prize and you have to expose your source code. Not very generous but a good way to get your hands on a lot of other peoples work.

lol wtf’s that supposed to mean. Nobody cares about the prize, it’s about the challenge of making the game… and exposing source, well pick any source and try to make something out of it. Most of it is so cryptic that it’s pointless, and trying to fix it up to make a normal game would be more work than making it from scratch. Also, many of the sources have licenses to prevent people stealing it and making a blatant copy.

Imo this is one of the better competitions.

There are a lot of ‘competitions’ out that that purport to being legitimate competitions when in fact they are just harvesting IP. The competition does seem legit (and I’ve be a huge fan of similar ones in the past) but the prizes seem somewhat token. I just find it odd that it is compulsory to expose your code.

 
Flag Post

im pretty sure thats impossible. mt smallest one is 52.0 KB (53,344 bytes)
my fav is this http://www.gamepoetry.com/blog/4k-flash-4kpillars/

 
Flag Post
Originally posted by piratemonkey:

im pretty sure thats impossible. mt smallest one is 52.0 KB (53,344 bytes)

my fav is this http://www.gamepoetry.com/blog/4k-flash-4kpillars/

hehe yeah 4kb was really hard to squeeze down to. I still don’t know how those people managed to get a fully functional 3D engine (or at least the appearance of one) in 4k…

And arseiam… you don’t “have to” expose your code. Most people choose to though.

 
Flag Post

Yah, fair enough.

Please excuse my cynicism… been a bit busy/grumpy lately.

I’ve started to rework this:

http://www.snepo.com/experiments/Growth.html

But am unsure if I can get it <4k with game elements in. The intention is to make the plants move towards the mouse and ‘catch’ good insects while avoiding the bad ones (bad ones will kill the plant stem).

Up for suggestions.

 
Flag Post
Originally posted by arseiam:

Yah, fair enough.

Please excuse my cynicism… been a bit busy/grumpy lately.

I’ve started to rework this:

http://www.snepo.com/experiments/Growth.html

But am unsure if I can get it <4k with game elements in. The intention is to make the plants move towards the mouse and ‘catch’ good insects while avoiding the bad ones (bad ones will kill the plant stem).

Up for suggestions.

Holy crap. This is amazing quality! I can never do any decent graphics at all… Anyways, I see you grow your stems using circles, and pseudo-randomly generate leaves and flowers. And I see you did this during fp9, so converting this to fp10 code will definitely reduce the size (drawpath, more bitmap fill options, 3d positioning, translation, rotation, etc.)

You also have to realize that if you try to make a game out of this there will need to be a lot of other code added, not only for player interaction but also for bug AI, differentiating good from bad bugs, score counting and/or timers, and increases in difficulty. After everything, if you want to keep the same graphical quality, 4k is near impossible. You can however aim for a personal goal of 8k, which will still be an amazing achievement.

That said, if possible and you can conserve/reuse classes, doing so would reduce the size a bit. Also, in your case, perhaps creating a custom blur or even an alpha gradient mask for the stage might reduce the size a bit, but since it affects the visual effects I would say that’s up to you. Other than that, without seeing your code I can’t help any more. However, I’m quite sure that since you’ve probably practised good coding style for forever your code is probably quite neat and standard. It means that after I go through it it probably will be anywhere from 200-400bytes smaller (if I don’t change any of the important functions)…

Not sure how you’re building this, but if it’s flash try going into File—>Publish Settings—>Flash and UNCHECK the include XMP Metadata and Include hidden layers, if you haven’t already. If you’re using flashdevelop try to compile with the arguments -raw-metadata.

lmao your actual name is Arse? Pretty original name :O
And I top you (probably) in both bowling and ping-pong!

Anyways, do you have MSN? I would like to ask about a few effects and how you achieve them (remember… I suck at graphics… I can’t even draw 2D correctly, nevermind trying to make 3D… even worse trying to code it when I can’t even draw it normally. In fact, looking at your distortion tutorial, I don’t understand a thing you did hehe. My mind just can’t grasp this concept of having smaller and smaller circles makes the image look distorted… I mean, how did you even come up with that idea?!)

The specific effect I’m interested in right now is http://www.snepo.com/experiments/3dmenu.html. It’d fit PERFECTLY for the type of space-distortion I had in mind for one part of my new game (nothing like any of the crappy ones I’ve uploaded. those aren’t GAMES, this is an actual game made with a team), and if you could teach me how to make it it’d help a LOT!

And this isn’t very well made is it… http://www.arseiam.com/fx/02.php

Anyways, why don’t you try finding some free time and make a full-scale game? I understand you are probably extremely busy with whatever it is you’re busy with, but I’m sure everyone has some free time, and with your expertise even if you work at it only an hour or so per day I’m sure in a month or so you’d have an extremely interesting and functional game. Even if it’s just for the experience, I encourage you try it. Especially with your efficiency with making 3D in flash.

Wow I’ve gone so far off-topic…

 
Flag Post

Thanx.

I’m still working on it in CS3 but will look to do a rebuild using CS4/FP10 (minus the metadata). I’ve managed to get the rendered down to <8k but for the most part it is the bitmap classes that are hosing me (taking a whopping 3k) which is required for the blitting. The assets are all optimized primitives though I could shave off about 1/2k by optimising their structure and using more graphics/shading over having multiple shapes. hmmmm… not sure if this will be possible.

Yup, ArseIam. Odd but true.

3dMenu:


import flash.display.;
import flash.events.
;
import flash.filters.;
import flash.geom.

var sw:int;
var sh:int;
var z:int = 250;
var f1:int = 30000;
var f2:int = 20;
var c:Number = 0.75;
var inc:int = 0;
var mouseIsDown:Boolean = false;

var node:*;
var nodes:Array;
var nodeNum:int = 20;

var blur:BlurFilter;
var main_bd:BitmapData;
var offscreen:BitmapData;
var main_b:Bitmap;

Menu3D = function() {
stage.quality = “medium”;
sw = stage.stageWidth;
sh = stage.stageHeight;
nodes = [];

addEventListener(“enterFrame”,enterFrame_handler);
addEventListener(“mouseDown”,mouseDown_handler);
addEventListener(“mouseUp”,mouseUp_handler);
var tempNodes = [];
var len = stage.getChildAt(0).numChildren;
for(var i=0;i<len;i++) {
tempNodes.push(stage.getChildAt(0).getChildAt(i));
}


main_bd = new BitmapData ( sw, sh, false, 0×000000);
offscreen = main_bd.clone();
main_b = new Bitmap(main_bd);
blur = new BlurFilter ( 12, 12, 1 );

for(var j=0;j<tempNodes.length;j++) {
node = tempNodes[j];
node.n = addChild(node);
node.xx = node.x;
node.yy = node.y;
node.s = 100;
node.blur = new flash.filters.BlurFilter();
node.blur.quality = 1;
nodes.push(node)
}

}

function addNode(xx, yy){
var node = new Node();
node.n = addChild(node);
node.x = node.xx = xx;
node.y = node.yy = yy;
node.s = 100;
node.blur = new flash.filters.BlurFilter();
node.blur.quality = 1;
nodes.push(node)
}

function enterFrame_handler(e:Event){
//trace(_level0.instance2);
if(mouseIsDown == true) {
inc+=5;
} else {
if(inc>0) inc-=5;
}

for(var i=0;i<nodes.length;i++) {
var n = nodes[i];
var xm = mouseX;
var ym = mouseY;

n.dist = Math.sqrt((n.xx – xm) * (n.xx – xm) + (n.yy – ym) * (n.yy – ym));
var fact = ((z+inc) – n.dist) / f1 * n.s;
n.fx = n.xx + (n.xx – xm) * fact;
n.fy = n.yy + (n.yy – ym) * fact;
n.fs = n.s + (50 – n.dist / 5) * (n.s / f2);
n.x = n.fx – (n.fx – n.x) * c;
n.y = n.fy – (n.fy – n.y) * c;
n.sdif = n.fs – n.scaleX;
n.scaleX = n.scaleY = (n.fs – n.sdif * c)/30;
n.alpha = n.scaleX;
n.bx = (f2 + n.dist) / f2;
n.blur.blurX = n.blur.blurY = n.bx;
n.filters = [n.blur];
}

}
function mouseDown_handler(e:Event){
mouseIsDown = true;
}
function mouseUp_handler(e:Event){
mouseIsDown = false;
}

Menu3D();


Just place clips on your stage and it will suck them up. I’ve got a better packaged version but you can get the gist from the code above.

The steering behavior link you referenced is AS1/FP5 and about 8 years old. I have a new AS3 version that is 100x better.

Make games? a lot of my job involves game development…. I’ve also run some game dev workshops too. :)

*edit. Sorry about the AS formatting but I don’t know how to fix it… or could be bothered ;)

 
Flag Post

Alright thanks. I’ll need to modify it hugely though because it won’t be mouse based and it’s not a menu. But still, thanks.

And lol I don’t get the math at all hehe…

 
Flag Post

LOL just realised:

All entries are due by 8:00 AM PST, March 9th, 2009.

:meh: