Author Archive
-
(Spoiler!) Play test my 4kb Game Competition entry
26th Feb 20098My 4kb Game Competition entry is very nearly finished. I’m in the final “tweaking” stages, trying to get the last few small bugs out, and iron the gameplay a little so it’s less “random” and even more progressive.
The game is a twitch shooter based (loosley!) on Geometry Wars and requires some pretty mad flying skillz to last more than 30 seconds. The idea is literally to see what kind of score you can get. Here’s a screenie:
There are 10 different baddies, “boss waves”, bullet power-ups and particle explosion effects galore! (I went a bit over the top in all honesty). I’d love to have added sound, but I’m pushed to the limit of my 4096 bytes shackles already.
I know the game isn’t quite as “playable” as it should be, and I’ll work on that in the final few days left before I need to submit to the contest. I also know I don’t have a chance of winning (having seen some of the other entries lined-up!), but it was bloody great fun to code anyway.
And so as a sneak peak to you here’s the latest beta to play. Comments welcome (but please do bear in mind this whole game had to fit into 4096 bytes, so don’t go requesting anything insane ok?!)
-
Photon Storming onto Twitter
25th Feb 2009Ok, so I’m following the pack by getting onto Twitter 2 years late π I know people call it a “micro blogging” service, but come on guys, face the facts – it’s just internet chat in another guise. Doesn’t make it any less fun though!
If you’re interested you can find me at http://twitter.com/photonstorm
I’ve also hooked it into my Beanstalk account, so you’ll get to read my insane commit messagess at 3 in the morning!
-
Flashtros & C64 SID music from AS3/Alchemy
23rd Feb 2009I came across a great site called Flashtro. It’s a collection of classic demo scene / warez scene intros and cracktros, recreated in Flash. There are 21 different intros on offer ranging from cracktros such as the Mandala Studio crack by Scoopex, to the “beauty” (*cough*) that is the Pang 100% Trainer by PROJ Inc (coder colours FTW!).
New intros seem to be released on a semi-regular basis, so I’ll definitely keep this one in my bookmarks and check it out now and again. Perhaps they may even accept someΒ “guest tro’s” from me? (although I’d rather redo Atari ST demos!) π
Here’s a shot from the Scoopex one:
C64 SID Music from AS3 / Alchemy
On a similar retro scene theme I found a brand new C64 SID Chip player written in AS3 by the always inspirational UnitZeroOne. It’s a port of the Linux TinySID library (which is where Alchemy came in) with a minimal front-end interface to show it off. Flash Player 10 is required. Replay quality is great and it weighs in at around 150KB. Sadly the source is not yet released, the usual “it’s a mess, I only threw it together in a few hours” excuse is given π but I can appreciate that, although I’d still probably sell my Mother for it.
Now if only I could find the time (and skill) to try and do something similar for an SNDH YM2149 replayer!
-
4k Game Contest – Some useful tips
18th Feb 2009Ok so after the embarrassment of my first post on this subject, I wanted to present some findings that may help you out on your quest for smaller SWF sizes. More importantly, I know for a fact these all worked for me!
For those who didn’t read the previous post: I’ve been working on my entry for the 4k Game Competition, and have found the following information during the course of my coding:
Keep Event Listeners out of the constructor
I have a whole bunch of init stuff in my constructor (creating game graphics, setting up variables, etc) and at the end I kicked off the game by starting up the main events (keyboard, mouse, etc). But by moving the event listeners to their own function, and calling that function from the constructor, it reduced the size of the SWF.
If you know the size of something, use it! Avoid references where possible
When creating a Rectangle I passed in the width and height of a bitmap by reference (bulletBitmap.width). By removing this and passing in the actual known width of the bitmap (6) it saved a massive 20 bytes from the ActionScript code.
Before: bulletRect = new Rectangle(0, 0, bulletBitmap.width, bulletBitmap.height);
After: bulletRect = new Rectangle(0, 0, 6, 6);
Here’s another example where being explicit saves bytes:
Before: fullRect = stage.getRect(stage);
After: fullRect = new Rectangle(0, 0, 550, 400);
This saved us 6 bytes.
Make Bitmaps Transparent
I create a bitmap the size of my Stage to hold the game background in. It looks like this:
gridBitmap = new Bitmap(new BitmapData(550, 400, true, 0x0));
Now I don’t need this bitmap to be transparent (the 3rd parameter) as it sits at the bottom of the display list. But by setting the transparent parameter to “false” it increased the size by 3 bytes.
Even default values take-up space
Object instantiation is expensive in AS3, so it’s best to pre-calc objects you need in your main loops at the start. However who would have thought that the following:
zeroPoint = new Point(0, 0);
takes up 1 extra byte than:
zeroPoint = new Point();
Even though 0,0 are the defaults for the Point object. Every byte counts!
Avoid Array references in for loops
I have a loop in the game that checks through a pool of baddies (standard Array containing a custom Object that extends a Sprite). I started out doing it like this:
for (var a:int = 0; a < baddiePool.length; a++)
and then …
baddiePool[a].value = newValue;
But by pulling out the array element first at the top of the loop, then referencing that, I saved a massive 33 bytes in total:
ba = baddiePool[a];
ba.value = newValue;Smaller than a ternary
Thanks to Kevin Luck for this one π If you need to run a standard if/else on a value where it could be equal to zero then it can be shortened to:
x = lx || Math.random() * 550;
In the code above, x = lx unless lx = 0, in which case set x to Math.random() * 550. This is 3 bytes smaller than using a ternary/if-else equivalent.
Hopefully the above will help out those also entering the competition. Feel free to comment and add more tips!
-
4k Game Contest – and a word about ternary operations in AS3
18th Feb 2009Edit: Thanks to Kevin Luck for pointing out a flaw with the code in my original post (there was an extra assignment taking place, which caused the byte count to increase). Remove that and ternary will match if/else on a bytes-used basis. I’ll keep this post up here regardless, just ignore everything from this point on π
Read More
Hire Us
All about Photon Storm and our
HTML5 game development services
Recent Posts
OurGames
Filter our Content
- ActionScript3
- Art
- Cool Links
- Demoscene
- Flash Game Dev Tips
- Game Development
- Gaming
- Geek Shopping
- HTML5
- In the Media
- Phaser
- Phaser 3
- Projects
Brain Food