Skip to content

8-Bit Gilgamesh Battle (Famitracker)

I redid my 8-bit Gilgamesh thing!  I used Famitracker this time, and I put a lot more attention to detail into it.  I think you might like this one, Eric :-)

This is a cover of ビッグブリッヂの死闘 from Final Fantasy V!

The voices jump between the two square waves for stereo effects, which the NES doesn’t support, but if you download the NSF and use a stereo NSF player, it’ll do neat things  :-)

WordPress is funny.

WordPress keeps telling me to click a button to upgrade my database. Like, er, all the time. I keep wondering if everyone else who loads the page sees that, which would be pretty funny. And a little sad, but mostly funny ;-)

Gee, I sure am awful at this blog stuff.

Drawing!

I drew 25 things yesterday :-D Most of them were enemies for Snaily.

Whew!!

Still working on Snaily!!

Whew, this game is big :-)   Someday, I’m going to teach myself a lesson about scope creep, and make a small, simple game.

But it will not be this day!

I posted a couple bits of art over at deviantART.  I’ve been drawing a lot!  But I’ve only posted a couple things publicly.  I wouldn’t want to give away very much!  But there’s a baby snail in my game now ^-^

Coding bosses takes forever.  It’s fun, though!

Snaily!! :-)

Coming along well :-D   Maybe I should make another fun with Flixel post.

More fun with Flixel!

  • Map splitting revisited.  Now I hash each layer of each room, so I don’t store identical room layers more than once.  This means, for example, adding empty rooms takes no space.  I added a second background layer behind the collideable layer, which makes my life easier as a map designer, though it’s strictly unnecessary.  What if I use it in only 4 or 5 rooms?  Then it costs me nothing for the rest of the rooms, rather than costing an extra 250,000 tiles like it would have in Snaily 1.  This also means there’s no advantage to laying out the map densely, and I can lay out the map however I want this time, and as big as I want :-)   And the memory usage is tiny.  I also scan for more metadata, so I was able to add…
  • Doors!  Hit up or down to enter, and it takes you to its pair with the same ID.  They get scanned when the rooms are split, then stored as room,x,y coordinates in embedded XML.  They work pretty well, I think!  I could add a teleporter hub using about the same system, but I haven’t yet.  Right now doors only function in pairs.  To avoid confusion with the doors in snaily 1, I called these “portals”.  I can do more stuff like this, because of the map splitting.
  • Main loop, and timestep sadness!  One problem Snaily 1 had was gameplay that was inconsistent across machines.  A couple bugs never showed up for me, but did at low frame rates due to Flixel’s variable timestep.  I felt kind of bad about that!  I resolved to use Flixel 2.55, which has a fixed timestep.  But it’s just not as smooth!  I think Flash is basically incapable of consistent frame timing, especially re: multiple platforms.  That’s okay, as it’s not TOO bad.  But I took Photonstorm’s advice (not given to me specifically) and cut out the accumulator entirely, and switched back to a variable timestep.  Everything felt much nicer and smoother!  But now I had noticeably inconsistent physics again.  So I rewrote the main loop–the timestep is allowed to vary a bit, but between certain thresholds, frames are split into 2 or more pieces, to keep the timestep RELATIVELY consistent.  If the system slows down past a final threshold, the game simply slows down rather than becoming more choppy.  So I’m hopeful that this gives the most consistent experience across computers, without sacrificing the smoothness I had in Snaily 1.  What I’ve heard back from alpha testers so far makes me optimistic :-D
  • Generating asset embeds!  I wrote a couple perl scripts which automatically generate AS3 files containing embed directives for all the files under art/ and sfx/.  The art script makes a list of all PNGs under art/, but then removes any that aren’t in use by the code.  It creates symbols for each that match the filenames.  The result is I save time doing annoying manual input adding hundreds of images to an assets file, and the file size ends up smaller, as I almost surely had unused assets in Snaily 1 editing the file by hand.  The sfx version is similar, but it invokes swfmill on any SWFs in the directory, converting the SWFs to XML to get a list of exported symbols; it includes these in its tests for which sfx are used.  (This is of course because sounds are less latent if you encode them from the IDE rather than embed MP3s directly, but I don’t have the IDE, so I ask xdanond to use the Flash IDE to encode and export the sfx for me when he gets a chance.)  Last, an XML file contains default volumes for each sound effect (if I want to override the global default).  Managing this stuff automatically is a life saver :-)
  • Debugging: collision pt. 1!  Not everything works the same way it did in Flixel 2.43.  Some things do, and I was simply unaware at the time.  FlxG.worldDivisions bit me–Flixel decides objects collide when they don’t actually, if this is too low.  PhotonStorm’s explanation indicated this wasn’t a bug, but I don’t think it makes sense to say it’s not.  In any case, rather than rely on a high value for worldDivisions, I changed the design of my code not to use the collision code for the fine granularity checks I needed.  They were too slow, anyway, even with a smaller value!  But I have a class which temporarily sets worldDivisions higher, creates (well, recycles) an invisible “hit box” object, sets its size and position, collides it against a target, then resets worldDivisions to the old value.  It’s useful for checking if something would collide if you changed its size or position, though it’s not terribly fast.
  • Debugging: collision pt. 2! Flixel 2.55 keeps track of the last position of objects, and how far they’ve moved.  My old code for Snaily changes the physics often (size and position), whenever you go in or out of your shell, or switch to walking on a wall or ceiling, or when you teleport to a save point.  In the new game, portals add to this, and so do [secret].  But they all mess with the delta!  All sorts of things go wrong with Snaily if I don’t translate the *previous frame’s* coordinates as well.  For example, when Snaily went through a door to another room, the silly snail would pick up all of the items nearby, without touching them!  This took me some digging to find, frustratingly, though it was simple to fix in the end.
  • Debugging: collision pt. 3! Tunneling is too expensive to solve in the general case, but easy to solve in individual cases.  Some objects in my game have multiple sets of physics–pea circles can collide with enemies with a size of 26×26, but with terrain they only collide on a single pixel.  This is so Snaily can fire them straight forward without hitting the ground or ceiling!  They also move very, very fast, enough that rewriting the game’s main loop makes them substantially more consistent across different computers.  But not enough.  A simple hack: I put in checks for 5 pixels, drawing a line between the center pixel on the last frame, and the current one, and interpolating 5 different points.  If it collides at any of these, it hits the terrain.  Fast enough, and I get the behavior I want without tunneling.   Hooray!
  • Debugging: memory leaks!  Snaily 1 called FlxG.play(), passing in sound effects from an assets file containing a list of embeds.  Apparently if you do this, you leak memory.  A lot.  Crap, how much memory did Snaily use, anyway?  Snaily 2 shows memory usage hovering between 12 and 21MB.  It rises, but then drops back down with no permanent increase, so the gc is working.  (I didn’t know any AS3 when I programmed Snaily, and although I’ve been a programmer all my life, I think I was a bit unaware of what I was doing at the time.)  To make sfx NOT leak, just hold onto a FlxSound and call play() on it.
  • Animation!  My copy of Flixel is pretty Flixely, but it has lots of little changes.  Things you wouldn’t get very excited about, like outlines on text, but to me, the little things start to add up.  I’ve been expanding the animation class for a while for different needs.  Instead of just looping the whole thing, you can set a loop point; you can set a next animation to go to when the current one’s finished; you can set up parallel animations and switch between the two keeping the current frame #; and you can set an object to die when its animation is finished.  See, all little things :-)   But they make my life easier.

Of course, this is all driven by the actual game, but that’s not what this blog post is about, so I’ll stop there… :-)

Fun with Flixel

  1. Water.  People complained about the water in Snaily 1, which stood still and didn’t affect physics at all.  (The only things it did were create bubbles, and prevent water creatures from going above a specified height.)  They didn’t really feel like they were underwater, and it was kind of ugly.  Now I’ve got dynamically rendered waves on top of the water, splashes (visual and sfx), water physics, and (hehe) four kinds of liquid.  To render the waves, I create a right-triangle sprite (16×16 pixels), one pixel tall in the first column, 2 pixels tall in the second, and so on.  Then, I override draw(), and make 16 calls to copyPixels(), each time with a one-pixel-wide source rectangle, drawing the tile from left to right.  I move the source rectangle’s x coordinate from 1 to 16, which changes the height in each column from 1 to 16.  Then, I put in a function which sums a few sine waves to calculate the height at each x coord, and voila!  Waves!
  2. Palette swapping.  Similar to what Flixtra does, though I don’t think I did it identically.  I added swapPalette() to FlxSprite.  The first time colors are swapped, I create a backup of the original _pixels in a variable called _unswappedPixels.  If it’s called again, the swap is done from _unswappedPixels instead.  Anyway, with Chroma Shell, Snaily can have 40 different shell colors, and 40 different body colors.  :-)
  3. Map splitting.  Snaily 1 had one giant map, divided into rooms by metadata tiles which indicated room boundaries.  Only one region of the map was ever updated at once, so it wasn’t really inefficient for the most part, but it did take up an unnecessary amount of memory, and also had a noticeable startup time when you began a game.  Neither of these mattered on my computer, but I figured I’d go ahead and fix this, for the sake of older computers AND for creating larger maps.  A bit of C++ auto-splits a single Tiled map into separate room maps now, and (yecch) generates AS3 embeds for them.  It takes about a quarter of a second to run, and I put it in my Makefile (and as3proj, for FlashDevelop).  It also scans rooms for metadata tiles (like Player Start coords+room, etc.) and sticks these in an embeddable XML file, and makes another bit of XML showing which rooms connect to which other rooms on each side (with X and Y ranges, so that multiple rooms can connect on one side).  No more startup time, no more big memory usage.  Downside: slightly larger file size, but not enough to matter, I think.  I’m currently testing it with 232 rooms.
  4. FlodXM.  Snaily 1 used music written in Famitracker, and I love FT, but there’s no open source Flash NSF player, and MP3s are pretty big.  Out of 6.4MB, Snaily used 5.5MB for music.  But since FlodXM exists now, I decided to learn how to use Milkytracker, and re-created Mare Carelia in XM format to test it out.  The XM version’s only 22KB (after SWF compression) for 40 seconds of music, versus 323KB for a 64kbit MP3.  Assuming each song added an average of 25KB, that’d bring the file size for Snaily 1 down to 1.15MB!  Whew!

With Snaily 1, both music and map size were limited somewhat.  With those limits out of the way, I could make a game as big, or as small, as I wanted.  Will I make a game bigger than Snaily?  I don’t know, but I’m having fun :-)

Projects

I was working on a new project with someone really talented, and we haven’t officially cancelled it, but he asked if I might be willing to work on a smaller project instead, for now.  So, it’s at least on hold.

I said sure, but I’m waiting for some kind of design to act on it.  So for now, there’s:

  • Fire: on hold. It’s definitely promising, though.  It’s fun playing even what we’ve got so far, and the art is amazing.
  • RS2: on hold. Paul’s working on the characters and script.  I wrote a basic engine for it, though I could probably go back and incorporate some code I wrote for Fire.  xdanond wrote all the code for RS1 (well, I contributed a couple functions, but that’s all), and he’s kind of excited about having me do the coding for the sequel :-)   I’m planning on working really hard on the boss design, which is my favorite part, really!
  • VR: in my head.  I still want to work on this, but I’m reluctant to write the entire story myself.  I love writing, but I’m kind of afraid of failure, and if I want to do it, I have to push myself past that fear and invest a fair amount of time for what may simply not be good enough.  I’ve been working on other things instead (coding), which is more or less playing it safe, since that’s where my talents lie.  Then again, there’s an off-chance xdanond will write VR, depending on what we do.  In any case, VR isn’t supposed to be a very big project, so maybe I should just make it and can it if it’s not good enough.
  • S2: playable, but I’ve been working on other projects instead.  I think I made a couple missteps with it.  What works well for me is working within limitations, and by changing them for the sequel, I opened myself up to the paradox of choice and took away the feel of consistency the limits provided.  I think that feel is what made Snaily work despite my lack of art skills, so that’s a pretty bad move on my part.

Okay, so now that Fire’s on hold, I guess it’s time to go back to S2.  I’m not sure I’ve given my subconscious enough time to design additional bits, though.  In any case, I’ll probably drop whatever I’m working on as soon as xdanond is ready for me to work on RS2, because RS1 (Starwish) was really successful, and I think it’ll be a lot of fun working on it.

BTW, I give all my projects names even before I know anything about them, but I’m sure the names are meaningless to most people.  Then again, most people aren’t reading this blog.  (I’m always a bit surprised when someone I don’t know comments!  I expected this blog to be public in theory, but restricted to a dozen or so friends in practice.  I wonder who reads it?)

I’ve been spending a lot of time just working on music, and guitar in particular.  I’m also making a tutorial for Famitracker!  Yay, me!  But if I’m not working on Fire anymore, I think I’d rather do Snaily 2, because I know I can push myself to finish a project on my own, and it’s disheartening when a project gets put on hold.

So, prepare for more crappy programmer art, world!

Drive died T_T

My Windows drive died.  I think I’ll take some notes here for how to set up an out-of-date Windows system, as I’m not likely to buy Windows 7 any time soon.

These notes may not be of use to anyone else!

  • Take out Linux/BSD drives, etc., THEN install.  You want Windows to decide its own drive is C:.  Although Windows itself works fine installing to e.g. F:, you’ll run into problems installing things that assume it’s C: instead–for instance, the latest nVidia drivers, 290.53.  (285.58 worked, but presumably next time I read this I’ll have no use for this information.)
  • PuTTY, Window > Translation, UTF-8.  MS Gothic.  (Don’t pick the “@MS Gothic” listing with the @, which makes your font sideways.)
  • Install the VC++ redistributable runtime before trying to install Audacity.  It won’t work without it.
  • JRE, Flash Player debugger (ActiveX for IE), Flex, FlashDevelop.  FD wants .NET runtime 2.0, and 4.0 does not imply 2.0.  Flash Player installs McAfee, so Add/Remove Programs it into oblivion.
  • MinGW with msys, then mingw-get install mintty.  Spawn msys.bat with -mintty via a shortcut, stick that in the start menu.  :set background=dark, don’t munge PATH with your silly regular .bashrc.  Color in vim fails because of a termcap problem, so stick these in .vimrc (from this FAQ page):
              let &t_Co=8
              let &t_AF="\e[3%dm"
              let &t_AB="\e[4%dm"
  • That one font is called うずらフォント, and you can find it here: http://azukifont.com/font/uzura.html
  • The old free Xsplit without the watermark is VHScrCap.
  • The sixaxis driver that works is ps3sixaxis_en.
  • TortoiseSVN.
  • IFS for ext3.

TODO:

  • Figure out how to make msys play nice with Pageant, instead of keeping a separate ssh-agent around.
  • Figure out how to make font rendering look okay in Pidgin.  Yeep.

Love2D is pretty neat.

Check it out: http://love2d.org/

(I’m too lazy to type an umlaut, so I’m probably going to consistently misspell Love2D.  Sorry!)