<?xml version="1.0" encoding="utf-8"?>
<feed xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xml:lang="en-us" xmlns="http://www.w3.org/2005/Atom">
  <title>gaming your way - blog</title>
  <link rel="alternate" type="text/html" href="http://blog.gamingyourway.com/" />
  <link rel="self" href="http://blog.gamingyourway.com/SyndicationService.asmx/GetAtom" />
  <icon>favicon.ico</icon>
  <updated>2008-11-19T12:33:25.9745201+01:00</updated>
  <author>
    <name>gaming your way</name>
  </author>
  <subtitle>May contain nuts.</subtitle>
  <id>http://blog.gamingyourway.com/</id>
  <generator uri="http://www.dasblog.net" version="1.9.6264.0">DasBlog</generator>
  <entry>
    <title>Enough about you, lets talk about me</title>
    <link rel="alternate" type="text/html" href="http://blog.gamingyourway.com/PermaLink,guid,5d8c3377-ba21-4e47-ae9d-44ab0b92b580.aspx" />
    <id>http://blog.gamingyourway.com/PermaLink,guid,5d8c3377-ba21-4e47-ae9d-44ab0b92b580.aspx</id>
    <published>2008-11-19T12:33:25.9745201+01:00</published>
    <updated>2008-11-19T12:33:25.9745201+01:00</updated>
    <category term="news" label="news" scheme="http://blog.gamingyourway.com/CategoryView,category,news.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">I have an inherent dislike of self indulgent
blog posts, the whole "I'm not feeling well today" thing.<br /><br />
I've found twitter takes this part of a blogging to it's natural extreme. "I've just
been out to buy some tea bags" kind of pointless, mindless, please have an interest
in me and my life crap.<br /><br />
Well check my hypocrisy out, here's what my twitter post would be today:<br /><br />
"Gave up smoking Monday. Hate everything right now. Haven't got a civil tongue in
my head, so not posting until I'm less of a cock".<br /><br />
Sorry to everyone who I owe emails to, but I really can't write more than 4 words
without them turning into some sort of nasty rant for no real reason so it's best
I go to ground until I stop wanting to burn down the whole world.<br />
Normal service will resume as soon as my brain fully understands that I don't want
to smoke any more and so stops thinking about it every waking second.<br /><br />
Squize.<p></p><img width="0" height="0" src="http://blog.gamingyourway.com/aggbug.ashx?id=5d8c3377-ba21-4e47-ae9d-44ab0b92b580" /></div>
    </content>
  </entry>
  <entry>
    <title>What a great idea</title>
    <link rel="alternate" type="text/html" href="http://blog.gamingyourway.com/PermaLink,guid,0de43c3a-573f-49d7-bfc4-d7decec16a9e.aspx" />
    <id>http://blog.gamingyourway.com/PermaLink,guid,0de43c3a-573f-49d7-bfc4-d7decec16a9e.aspx</id>
    <published>2008-11-16T19:52:32.8681061+01:00</published>
    <updated>2008-11-16T19:52:32.8681061+01:00</updated>
    <category term="General" label="General" scheme="http://blog.gamingyourway.com/CategoryView,category,General.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">Gears of War2, the most stunning game I've
ever seen, and despite some of the on-rails sections being a bit tricky to the point
of swearing at the TV, it's a fantastic game.<br /><br />
One of the new features in it is your "War Journal", where your progress is kept.<br /><br /><div align="center"><img src="http://blog.gamingyourway.com/content/binary/gearsJournal.jpg" alt="gearsJournal.jpg" border="0" height="250" width="448" /><br /><br /><div align="left">Which is a really sweet feature. Although it reminds me ever so
slightly of...<br /><br /><div align="center"><img src="http://blog.gamingyourway.com/content/binary/disJournal.jpg" alt="disJournal.jpg" border="0" height="382" width="603" /><br /><br /><div align="left">Nice to know that my thoughts aren't a million miles away from Epic's
at times ( I didn't come up with the idea of the journal in <a href="http://www.bbc.co.uk/history/ancient/egyptians/launch_gms_death_sakkara.shtml">Death
in Sakkara</a>, but I'm pretty sure that having extra hidden collectables was down
to me. That was obviously before I started the 3 month crunch to actually code the
game ).<br /><br />
Squize.
</div></div></div></div><img width="0" height="0" src="http://blog.gamingyourway.com/aggbug.ashx?id=0de43c3a-573f-49d7-bfc4-d7decec16a9e" /></div>
    </content>
  </entry>
  <entry>
    <title>Everyone loves a number</title>
    <link rel="alternate" type="text/html" href="http://blog.gamingyourway.com/PermaLink,guid,e11cb854-98d6-429a-8d1c-99bddd804a73.aspx" />
    <id>http://blog.gamingyourway.com/PermaLink,guid,e11cb854-98d6-429a-8d1c-99bddd804a73.aspx</id>
    <published>2008-11-15T19:12:15.8900000+01:00</published>
    <updated>2008-11-15T19:16:49.1981445+01:00</updated>
    <category term="General" label="General" scheme="http://blog.gamingyourway.com/CategoryView,category,General.aspx" />
    <category term="news" label="news" scheme="http://blog.gamingyourway.com/CategoryView,category,news.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">The indie Flash game community seems to
love stats. I guess it's 'cause it's always nice to see someone whose written something
good getting the recognition ( Even if it is more in terms of traffic than cash ),
and because it's slightly inspirational, that everyone is just one good game away
from achieving the same results.<br /><br />
When our game Chimbo got <a href="http://blog.gamingyourway.com/PermaLink,guid,80be8431-5e71-41fb-bf81-f2946fdb2cee.aspx">blammed</a> on
newgrounds it really shook me quite hard. It's the first time that I've really had
a project fail on me ( I've had games I've not been able to sell before, but never
something out there which has performed badly on a critical level ).<br />
We thought that was it for the game. We were under no illusions of what the game was,
a reskin of an even older game. It's far from great, but both Olli and I chatted about
it before hand ( Like we always do ) and considered it good enough to go out under
the gyw banner. It's an average game that looks pretty with varying degrees of presentation.<br />
That was it then, a footnote in our history.<br /><br />
And then the traffic started to creep up. It got on some front pages of high traffic
sites, only for a day or two ( Such is the turnaround on such sites ) and got spread
around a little.<br /><br /><div align="center"><img src="http://blog.gamingyourway.com/content/binary/chimboStats.png" alt="chimboStats.png" border="0" height="312" width="704" /><br /><br /><div align="left">At present Chimbo is hosted on 392 sites, and in the 281 days it's
been hosted on gamejacket it's served up 1,248,011 impressions. Not a hit by any stretch
of the imagination, but average traffic for an average game which started it's life
quite badly ( And apparently in gamejacket's all time top 20 hits, although I think
that's more through default 'cause it's been there pretty much since the beginining
).<br />
Today it's had 4359 impressions, which is a nice trickle of people ( Hopefully ) having
some fun with it. It's proved to be a slow burner ( Hopefully <a href="http://www.newgrounds.com/portal/view/445918">pinball</a> will
be the same, as that's done relatively poorly ).<br /><br />
So is there anything you can take away from this ? I mean it's all well and good seeing
a nice graph and knowing one of our games hasn't done too badly, but it doesn't help
you much.<br />
Hopefully it shows that sites with a typical teenage boy market ( Ninja zombie pirate
shoot'em up anyone ?) aren't the be all and end all. There are a lot of sites which
are targetted at young girls too which have insane amounts of traffic. Chimbo had
50k+ hits in one day purely by being front paged on a girl site ( That sounds terrible,
"A site aimed specifically at girls" is what I should have said ). If you got that
sort of traffic on ng or Kong in one day you'd be pretty pleased.<br /><br />
To show this isn't a one off, the game I did for gimme5, <a href="http://blog.gamingyourway.com/PermaLink,guid,7bc482ec-a609-4909-85e2-07aee74eef0a.aspx">Loved
Up</a>, died on it's arse on all the "usual" sites, then went on to be g5's top referring
game for months.<br /><br />
Is there a large mostly untapped audience for "games for girls" ? Hell yes. I spoke
to Barry at gamejacket just the other day and he told me that they're now generating
two lists [ Of portals ], the usual one and one for the female audience.<br />
You may think it's selling your soul to do a game targetted specifically at girls.
You want to do Metal Slug X, not Me and My Pony, but a game which appeals to a young
female audience doesn't have to be overly twee or technically "cheap". Just see it
as another genre which should be on your list of ones to try, same as doing a puzzle
game or a mode7 racer etc.<br /><br />
Anyway to wrap up this posts about stats, here's a great couple of links where you
get to see dirty hard amounts of cash, compiled by <a href="http://drastika.pcriot.com/">Drastika</a> (
Cheers Paul, saved me hunting these down ).<br /><br /><a href="http://blog.elite-games.net/blog4.php/2008/10/31/cash-stats-october-2008">Elite
games' earnings ( For Oct )</a><br /><br /><a href="http://www.emanueleferonato.com/2008/10/28/the-experiment-one-year-later/">Emanuele
Feronato's one year money making experiment results</a><br /><br />
Squize.<br /></div></div><p></p><img width="0" height="0" src="http://blog.gamingyourway.com/aggbug.ashx?id=e11cb854-98d6-429a-8d1c-99bddd804a73" /></div>
    </content>
  </entry>
  <entry>
    <title>Another google post...</title>
    <link rel="alternate" type="text/html" href="http://blog.gamingyourway.com/PermaLink,guid,a7512c5e-5c22-4737-a8f2-ec41a902dfd0.aspx" />
    <id>http://blog.gamingyourway.com/PermaLink,guid,a7512c5e-5c22-4737-a8f2-ec41a902dfd0.aspx</id>
    <published>2008-11-10T20:13:12.0630000+01:00</published>
    <updated>2008-11-15T19:23:34.4716131+01:00</updated>
    <category term="General" label="General" scheme="http://blog.gamingyourway.com/CategoryView,category,General.aspx" />
    <category term="news" label="news" scheme="http://blog.gamingyourway.com/CategoryView,category,news.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">I've posted here before on our <a href="http://blog.gamingyourway.com/PermaLink,guid,55297794-ccc5-41c0-9867-3d9762c6c061.aspx">google
indexing</a>. Also the blog software records what search terms drive people here,
the most popular being "as3 frame counter" and "as3 flex preloader". We get a lot
of disappointed <a href="http://www.lyricsfreak.com/c/cure/friday+im+in+love_10074510.html">Cure</a> fans
with "<a href="http://blog.gamingyourway.com/PermaLink,guid,05980e57-6f3b-4e90-917b-eb95396cda30.aspx">I
don't care if Mondays blue</a>" as well as some other really obscure searches landing
here ( "Boylinks" comes up a lot, don't ask ).<br /><br />
Checking the logs Friday I came across this gem from google.com.au,<br /><br />
"<i>WHY THE FUCK WON'T STUPID FUCKING as3 LET ME FUCKING CREATE AN EVENTLISTENER</i>"<br /><br />
( We've got the number one rank for that phrase, I really don't know why, we can't
be the only people using the word "fuck" and "as3" in the same posts surely ).<br /><br />
Anyway to be so pissed off at coding to swear at google is something we totally sympathise
with ( As well as admire in a slightly mental way ), and whoever you were, you're
a kindred spirit mate. 
<br /><br />
[Update: I've also noticed other people are entering the phrase into google, is that
just to see if we're ranked number one for it ? I think we own it now :)<br />
Also today, "wee sex" gets us a front page hit. I think I may need to calm down the
bad language and obscure sex terms on here, as we're going to be getting hits for
the most obscure stupid things. <font color="#d3d3d3" size="1">golden showers</font> ].<br /><br />
Squize.<p></p><img width="0" height="0" src="http://blog.gamingyourway.com/aggbug.ashx?id=a7512c5e-5c22-4737-a8f2-ec41a902dfd0" /></div>
    </content>
  </entry>
  <entry>
    <title>This is very lovely</title>
    <link rel="alternate" type="text/html" href="http://blog.gamingyourway.com/PermaLink,guid,188ca7c9-fcaf-4b7a-9db0-dd1343bda9db.aspx" />
    <id>http://blog.gamingyourway.com/PermaLink,guid,188ca7c9-fcaf-4b7a-9db0-dd1343bda9db.aspx</id>
    <published>2008-11-07T16:18:31.2100000+01:00</published>
    <updated>2008-11-07T16:20:41.6912547+01:00</updated>
    <category term="news" label="news" scheme="http://blog.gamingyourway.com/CategoryView,category,news.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">A really nice abstract demo, called <a href="http://www.nekogames.jp/mt/2008/11/sugar_cubes.html">Sugar
Cubes</a>, which feels like it uses a lot of Box2D.<br /><br /><div align="center"><img src="http://blog.gamingyourway.com/content/binary/sugarcube_grab.png" alt="sugarcube_grab.png" border="0" height="337" width="590" /><br /><br /><div align="left">Visually it reminds me of <a href="httphttp://www.lemon64.com/?mainurl=http%3A//www.lemon64.com/reviews/view.php%3Fid%3D112">Thrust</a>,
due to the simple colours and heavy scanlines, and it's got an abstract soundtrack
which fits perfectly.<br /><br />
Yet more great work by Yoshio Ishii / Nekogames, just making something visually arresting
out of very simple movement and images.<br /><br />
Squize.
</div></div><img width="0" height="0" src="http://blog.gamingyourway.com/aggbug.ashx?id=188ca7c9-fcaf-4b7a-9db0-dd1343bda9db" /></div>
    </content>
  </entry>
  <entry>
    <title>Jelly cube with an animated plasma texture</title>
    <link rel="alternate" type="text/html" href="http://blog.gamingyourway.com/PermaLink,guid,da23f136-a4c5-4e33-a72f-4cde1172ed4e.aspx" />
    <id>http://blog.gamingyourway.com/PermaLink,guid,da23f136-a4c5-4e33-a72f-4cde1172ed4e.aspx</id>
    <published>2008-11-06T18:24:29.7220000+01:00</published>
    <updated>2008-11-06T18:32:01.4455965+01:00</updated>
    <category term="experiments" label="experiments" scheme="http://blog.gamingyourway.com/CategoryView,category,experiments.aspx" />
    <category term="Tips" label="Tips" scheme="http://blog.gamingyourway.com/CategoryView,category,Tips.aspx" />
    <category term="tutorial" label="tutorial" scheme="http://blog.gamingyourway.com/CategoryView,category,tutorial.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">Quite a descriptive title for this post
for a change.<br /><div align="center"><img src="http://blog.gamingyourway.com/content/binary/651_jellyVectors.jpg" alt="651_jellyVectors.jpg" border="0" height="320" width="480" /><br /><br /><div align="left">In this section of <a href="http://blog.gamingyourway.com/content/binary/index651.html">651</a> we're
running two effects, a bog standard RGB plasma effect and then a "Jelly vector" effect.<br /><br />
To create a plasma you're going to have to suck up to Math.sin, he's your daddy for
this.<br /><br />
Firstly we pre-calc a colour table, eg.<br /><p><span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">        <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">public</span> function
ColourTable(){<br />
            colourTable=<span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">new</span> Array();<br />
            var cnt:Number=-1;<br />
            var col:Number;<br />
            var r:<span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">int</span>;<br />
            var g:<span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">int</span>;<br />
            var b:<span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">int</span>;<br />
            var offset:Number=3.1415;<br /><br /><span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;">//To
avoid /4 for each pixel every frame, we just make the colour table 4 times as big</span><br />
            <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">while</span>(++cnt!=256*4){<br />
                r <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">=</span> 128 <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">+</span> 128 <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">*</span> Math.sin(offset <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">*</span> cnt <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">/</span> 32);<br />
               
g <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">=</span> 128 <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">+</span> 128 <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">*</span> Math.sin(offset <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">*</span> cnt <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">/</span> 64);<br />
                b <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">=</span> 128 <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">+</span> 128 <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">*</span> Math.sin(offset <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">*</span> cnt <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">/</span> 128);<br />
                col=(r
&lt;&lt; 16)<span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">+</span>(g
&lt;&lt; 8)+b;<br />
                colourTable.push(col);<br />
                colourTable.push(col);<br />
                colourTable.push(col);<br />
                colourTable.push(col);<br />
            }<br />
        }<br /></span></p>
Here we're just creating what is in effect a gradient, so we have an array which smoothly
goes from one colour to the last one. When it comes to the look-up when we're plotting
we'd need to divide the value by 4, so to avoid this we make the colour table 4 times
larger than is really needed ( Often it's a balance between memory usage vs speed.
An easy way to think of it is with loops. If your game didn't have any loops and you
just copy / pasted the same thing over and over it would run quicker, but take a lot
more memory, and be pretty insane ).<br /><br />
Right the colour table is done, next up we create instances of our Pixel class,<br /><p><span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">            activePixelsStorage=<span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">new</span> Array();<br />
            var pixelObj:Pixels;<br />
            var j:<span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">int</span>=-1;<br />
            var k:<span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">int</span>;<br />
            <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">while</span>(++j!=120){<br />
                k=-1;<br />
                <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">while</span>(++k!=120){<br />
                    pixelObj=<span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">new</span> Pixels(<span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">new</span> Point(j,k),colourTable);<br />
                    activePixelsStorage.push(pixelObj);<br />
                }<br />
            }    <br /></span></p>
It's just like doing a tile based engine, each instance of our Pixel class is passed
an x/y position so our plasma is 120 pixels wide by 120 high. That's pretty tiny so
we double the scale of the sprite in which we're plotting and add a blur filter just
to smooth it out. It's a lot less expensive than plotting a 240x240 plasma.<br /><br />
On to the actual Pixel class:<br /><p><span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">    <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">public</span><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">class</span> Pixels{<br /><span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;">//---------------------------------------------------------------------------------------</span><br /><span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;">//
Properties</span><br /><span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;">//---------------------------------------------------------------------------------------</span><br />
        <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">private</span> var
xPos:<span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">int</span>;<br />
        <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">private</span> var
yPos:<span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">int</span>;<br /><br />
        <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">private</span> var
cX:Number;<br />
        <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">private</span> var
cY:Number;<br />
        <br />
        <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">private</span> var
jointDist:Number;<br />
        <br />
        <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">private</span> var
offset:<span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">int</span>;<br /><br />
        <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">private</span> var
cT:Array;<br />
        <br /><span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;">//---------------------------------------------------------------------------------------</span><br /><span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;">//Constructor</span><br /><span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;">//---------------------------------------------------------------------------------------</span><br />
        <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">public</span> function
Pixels(pos:Point,colourTableArg:Array):<span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">void</span>{<br />
            cX=xPos=pos.x;<br />
            cY=yPos=pos.y;<br />
            var xDist:<span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">int</span>=120-cX;            <span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;">//Distance
from the bottom</span><br />
            var yDist:<span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">int</span>=120-cY;<br /><br />
            cT=colourTableArg;<br />
            <br />
            var distance:Number=Math.round((Math.sqrt((xDist*xDist)<span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">+</span>(yDist*yDist))/2));<br />
            var distX:Number=256 <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">*</span> Math.sin(distance/8);<br />
            var distY:Number=256 <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">*</span> Math.cos(distance/8);<br /><br />
            jointDist=distX+distY;<br />
       }<br />
        <br /><span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;">//---------------------------------------------------------------------------------------</span><br /><span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;">//Public</span><br /><span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;">//---------------------------------------------------------------------------------------</span><br />
        <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">public</span> function
toString():String {<br />
            <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">return</span><span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"Pixels"</span>;<br />
        }        <br /><br /><span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;">//---------------------------------------------------------------------------------------</span><br />
        <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">public</span> function
pixelmainloop(x:Number,y:Number,plotbm:BitmapData):<span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">void</span>{<br />
            offset <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">=</span> (Math.cos((xPos+x)*0.0525) <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">+</span> Math.sin((yPos+y)*0.0255))*256 <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">+</span> jointDist;<br /><br />
            <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">if</span>(offset&lt;0){<br />
                offset=(offset
^ -1) <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">+</span> 1;<br />
            }<br />
            <br />
            plotbm.setPixel(xPos,yPos,cT[offset]);<br />
        }<br />
    }</span></p>
I'm not going to go into too much detail with this, as it'll take ages to be honest.
The most interesting part is the pixelmainloop, where we pass in the x/y ( As well
as the bitmapData we're plotting too, more on that soon ), and from those coords we
create an offset into the colour table. To create the smooth curves that makes a plasma
look so sexy we use some lovely sin and cos ( That's the bit I'm skipping explaining
in any real detail. It takes quite a bit of tweaking to get something looking how
you like and different values really give different results, for example:<br /><br />
            offset = (Math.cos((xPos+x)*0.0525)
+ Math.sin((yPos+y)*0.0255))*64 + jointDist;<br />
            offset=offset&gt;&gt;3;<br /><br />
That's what's used in the credits plasma / <a href="http://blog.gamingyourway.com/PermaLink,guid,7ef7a44c-0c7d-4be8-8f74-6f8b40880779.aspx">kaleidoscope</a> effect,
which uses exactly the same colour table values but looks totally different ).<br /><br />
All that's left for the plasma part is the mainloop that we run on the enterFrame.<br /><p><span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">            sinOffset++;<br />
            var radian:Number <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">=</span> sinOffset/60;<br />
            paletteShiftX <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">=</span> 128-Math.sin(radian)*255;<br />
            paletteShiftY <span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;">=</span> 128-Math.cos(radian)*255;<br /><br />
            plotbm.<span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">lock</span>();<br /><br />
            var pixelObj:Pixels;<br />
            <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">for</span> each(pixelObj <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">in</span> activePixelsStorage){<br />
                pixelObj.pixelmainloop(paletteShiftX,paletteShiftY,plotbm);<br />
            }<br /><br />
            plotbm.unlock();<br /><br />
            <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">if</span>(plotbm==bm1){<br />
                plotbm=bm2;<br />
            } <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">else</span> {<br />
                plotbm=bm1;<br />
            }<br /><br />
            bmData1.bitmapData=plotbm;<br /></span></p>
Nothing too tricky here. We just increase the position ( Offset ) into the colour
table every frame, and then use for...each ( Much quicker ) to loop through all our
Pixel instances calling the pixelmainloop and passing the args.<br />
The part that may be of interest is the plotbm var. To increase speed slightly we
double buffer the plasma bitmap, so when one bitmapData is being displayed we're plotting
to the other one which is no longer being shown.<br />
To try and explain that a little better, we have two bitmapData objects, bm1 and bm2.
bmData1 is our bitmap ( I find the difference between the two confusing as hell in
as3. It makes total sense, it just doesn't seem to stay in my brain very well ) which
is attached to the our holder sprite for the plasma ( The one we doubled in size and
added a blur to as mentioned earlier ).<br />
So lets say we have something like this:<br />
holderSprite.bmData1.bm1;<br />
And that's what you see on screen. If you can see bm1 that means we're plotting to
bm2, and visa versa.<br /><br />
This is why we pass the currently hidden bitmapData to each instance of the Pixel
class every frame rather than just passing one value in during it's construction.<br /><br />
That's plasmas for you. I've only really given the core concept as hopefully a spring
board for your own experiments.<br /><br />
The Jelly cube is going to be much more straight forward, because someone else wrote
the clever bit. After x amount of time we run a really quick white up over the whole
stage, and that's where we remove the plasma all together and replace it with a papervision
cube.<br /><br />
Ultra simple, we just rotate him and scale him. The twister code came from the excellent <a href="http://blog.zupko.info/?p=140">zupko</a> who
kindly open sourced it. Now we've got a twisty cube, what about the texture ?<br /><br /></div><div align="left">This is another big fat cheat. At best you can get a plasma running
the size we have at around 40fps, so there's no way we could do it realtime and run
the cube. One idea I had early on was to use draw() on every frame of the plasma and
store those away, then update the texture every frame on the cube using those stored
away bitmaps.<br />
I didn't go this route as I was concerned about the amount of memory it would use
and I was concerned that using draw() may have had a negative performance hit when
actually running the plasma ( I'm possibly paranoid about that and it would more than
likely be fine, but it felt like quite a bit of data to be copying every frame when
you want everything running as quickly as possible ).<br /><br />
The solution ? flv baby. Unless it's youTube the flv format seems to be badly over
looked when it can be used for all types of tricks ( I did quite a bit of video work
in games at preloaded long before flv came out so I've learnt what the advantages
of using video are early on ).<br />
I just ran the plasma for a little while grabbing the frames, cropped them up, created
a copy running backwards and then joined the two together, so runs as A &gt; B &gt;
A.<br />
All that was left then was to created a flv texture for each side of the cube, and
papervision along with Flash did everything for me.<br /><br />
The only thing left to cover off is the black outline on the cube. Again ultra simple,
it's just a glow filter. Set it to black, turn up the strength, turn down the blurring
and you've got a sexy outline.<br /><br />
Phew. I think this is going to be last in-depth-ish tut on the 651 effects. Not only
does it takes ages, but I think the rest of the effects not touched on so far can
be summarised in one post.<br /><br />
Squize.<br /><br /><br /></div></div><p></p><img width="0" height="0" src="http://blog.gamingyourway.com/aggbug.ashx?id=da23f136-a4c5-4e33-a72f-4cde1172ed4e" /></div>
    </content>
  </entry>
  <entry>
    <title>Nice one America</title>
    <link rel="alternate" type="text/html" href="http://blog.gamingyourway.com/PermaLink,guid,a53e86cb-c569-4440-b848-52662b37c60a.aspx" />
    <id>http://blog.gamingyourway.com/PermaLink,guid,a53e86cb-c569-4440-b848-52662b37c60a.aspx</id>
    <published>2008-11-05T05:09:03.1456521+01:00</published>
    <updated>2008-11-05T05:09:03.1456521+01:00</updated>
    <category term="news" label="news" scheme="http://blog.gamingyourway.com/CategoryView,category,news.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">And that's as political as we're ever going
to get here.<br /><br />
Squize.<br /><p></p><img width="0" height="0" src="http://blog.gamingyourway.com/aggbug.ashx?id=a53e86cb-c569-4440-b848-52662b37c60a" /></div>
    </content>
  </entry>
  <entry>
    <title>Bitwise AND, IF and a big WTF</title>
    <link rel="alternate" type="text/html" href="http://blog.gamingyourway.com/PermaLink,guid,efa93dce-0e13-4fed-94d4-1f5fc3e25d8f.aspx" />
    <id>http://blog.gamingyourway.com/PermaLink,guid,efa93dce-0e13-4fed-94d4-1f5fc3e25d8f.aspx</id>
    <published>2008-11-04T16:33:54.1034403+01:00</published>
    <updated>2008-11-04T16:33:54.1034403+01:00</updated>
    <category term="coding ideas" label="coding ideas" scheme="http://blog.gamingyourway.com/CategoryView,category,coding%2Bideas.aspx" />
    <category term="experiments" label="experiments" scheme="http://blog.gamingyourway.com/CategoryView,category,experiments.aspx" />
    <category term="Tips" label="Tips" scheme="http://blog.gamingyourway.com/CategoryView,category,Tips.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">So what's wrong with this code:<br /><p><span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">if</span> (<span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">this</span>._iDrawLayer
&amp; ChipsGame.VIEW_LAYER_A == ChipsGame.VIEW_LAYER_A) {<br /><span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;">//
draw contents of layer A ...</span><br />
}</span></p>
nothing, really. Nonetheless it's not working in CS3 (yet again, prove me wrong).<br /><br />
Basically it's just the unoptimized check if a certain bit is set or not. Let's do
some traces:<br /><p><span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">trace
(<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"with
():"</span>, ((<span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">this</span>._iDrawLayer
&amp; ChipsGame.VIEW_LAYER_A) == ChipsGame.VIEW_LAYER_A))<br />
trace (<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"without
():"</span>, (<span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">this</span>._iDrawLayer
&amp; ChipsGame.VIEW_LAYER_A == ChipsGame.VIEW_LAYER_A))<br />
trace (<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"values
:"</span>, <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">this</span>._iDrawLayer
&amp; ChipsGame.VIEW_LAYER_A , ChipsGame.VIEW_LAYER_A)</span></p>
The result is this:<br /><p><span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">with
(): <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">true</span><br />
without (): 1<br />
values: 1 1</span></p>
Interesting, isn't it?<br />
It seems like the compiler chains the &amp; and the == for some reason that escapes
me...<br /><br />
So if you get something undesiered with bitwise operators ... use ( and ) around it.<br /><br />
nGFX<br /><br /><p></p><img width="0" height="0" src="http://blog.gamingyourway.com/aggbug.ashx?id=efa93dce-0e13-4fed-94d4-1f5fc3e25d8f" /></div>
    </content>
  </entry>
  <entry>
    <title>Happy Halloween</title>
    <link rel="alternate" type="text/html" href="http://blog.gamingyourway.com/PermaLink,guid,1d70c430-70ff-4737-b676-6ed255bed170.aspx" />
    <id>http://blog.gamingyourway.com/PermaLink,guid,1d70c430-70ff-4737-b676-6ed255bed170.aspx</id>
    <published>2008-10-31T17:25:19.8623055+01:00</published>
    <updated>2008-10-31T17:25:19.8623055+01:00</updated>
    <category term="General" label="General" scheme="http://blog.gamingyourway.com/CategoryView,category,General.aspx" />
    <category term="news" label="news" scheme="http://blog.gamingyourway.com/CategoryView,category,news.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <div align="center">
          <img src="http://blog.gamingyourway.com/content/binary/petal.jpg" alt="petal.jpg" border="0" height="441" width="537" />
          <br />
          <br />
Meet Petal<br /><br /><div align="left">As way of a slight added bonus, click <a href="http://blog.gamingyourway.com/content/binary/halloweenIndex.html">here</a> to
expand your mind ( Or make yourself feel sick, it'll be one or the other ).<br /><br />
Squize.<br /></div></div>
        <p>
        </p>
        <img width="0" height="0" src="http://blog.gamingyourway.com/aggbug.ashx?id=1d70c430-70ff-4737-b676-6ed255bed170" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Vector Bobs</title>
    <link rel="alternate" type="text/html" href="http://blog.gamingyourway.com/PermaLink,guid,af8d4c49-de0c-4028-94f5-e812574d41b5.aspx" />
    <id>http://blog.gamingyourway.com/PermaLink,guid,af8d4c49-de0c-4028-94f5-e812574d41b5.aspx</id>
    <published>2008-10-30T13:42:37.0839327+01:00</published>
    <updated>2008-10-30T13:42:37.0839327+01:00</updated>
    <category term="coding ideas" label="coding ideas" scheme="http://blog.gamingyourway.com/CategoryView,category,coding%2Bideas.aspx" />
    <category term="experiments" label="experiments" scheme="http://blog.gamingyourway.com/CategoryView,category,experiments.aspx" />
    <category term="tutorial" label="tutorial" scheme="http://blog.gamingyourway.com/CategoryView,category,tutorial.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">Another quick break down of an effect in <a href="http://blog.gamingyourway.com/content/binary/index651.html">651</a>.<br /><br /><div align="center"><img src="http://blog.gamingyourway.com/content/binary/651_vectorBallGrab2.jpg" alt="651_vectorBallGrab2.jpg" border="0" height="300" width="500" /><br /><br /><div align="left">On paper this is quite impressive, 500 3D objects with depth of
field running over a skybox. In real life, it's not exactly rocket science.<br /><br />
Although we used <a href="http://blog.papervision3d.org/">Papervision</a> in 651,
we didn't for the effect itself ( Just for the skybox, which uses the background from
Orbs as it's texture ).<br /><br />
We start by creating the 3D objects and giving them random x,y,z coords ( For the
very best introduction to 3D movement in Flash check these excellent tuts on <a href="http://www.kirupa.com/developer/actionscript/3dindex.htm">Kirupa</a>,
everything you need for an effect like this is there ).<br /><br />
Right, we're spinning some objects around in 3D space, what about the depth sorting
?<br /><i>This is just between us right ? It's not going any further ?</i><br />
Ok then. We just don't bother. It's a very old trick ( I remember doing it back on
the Amiga ). If the vector bobs are translucent enough, it's pretty hard to tell if
they're not being z-sorted correctly. Looking at that grab above quickly I can't see
anything too wrong in terms of sorting, and even if there was, the bobs would all
have moved in the demo before you really notice it.<br />
By dropping the sorting we've got more cpu power for more objects, and the more the
merrier.<br /><br />
Next up, depth of field. Such a buzzy thing in Flash atm. We all know it's only a
blur filter, but depth of field sounds so much cooler. To avoid an extra hit we pre-calculate
each blur frame, we're not blurring in real time. Or even using the blur filter itself
as it's all done in PaintShop Pro ( And each frame is imported into Flash ).<br />
Each bob is a movieclip ( Which feels very old school already ) and when we're calculating
the scale ( Based on it's z property, ie how close or far away from the camera it
is ) we can also gotoAndStop() to the correct level of bluriness.<br /><br />
So to recap, the 3D code can be found in some great tuts, there's no z sorting, the
depth of field is gotoAndStop and the skybox was done in about 10 lines of code. Drop
a nice image over the top of some scanlines and it's all done.<br /><br />
It may seem like I'm talking the effect down quite a bit. I'm not really, it looks
sweet, I just don't like people acting like their code is l33t and they're so clever
for doing it. Smoke and mirrors is as good a technique as clever code, and there's
not always a need to mystify everything.<br /><br />
Squize.<br /></div></div><p></p><img width="0" height="0" src="http://blog.gamingyourway.com/aggbug.ashx?id=af8d4c49-de0c-4028-94f5-e812574d41b5" /></div>
    </content>
  </entry>
</feed>