Skip to Navigation

Muffinlabs!

Games

I wrote pitch about a million years ago it seems like. It was fairly popular for such a niche game. Anyway, I've gotten the occasional request to release the code, so I've done so on github. Perhaps someone will use it to make a version of the game for another platform.

Enjoy!

Crossfire

21
May 2010

Here is Crossfire, my latest game project.

The original Crossfire is an 8-bit game published in the early 80s. It's one of the first memories I have of plucking away at our old Apple ][. This game is my attempt to recreate it, making a couple things easier but also hopefully a few things more interesting as well.

I used Flixel to build the game. It's a great library.

Although the game plays well enough, I'm not entirely happy with it. The balance could use some work, and it would be interesting to have some other modes.

Anyway, here's the game.

You are missing some Flash content that should appear here! Perhaps your browser cannot display it, or maybe it did not initialize correctly.

sfxr for flixel

10
May 2010

Also Posted here

I've got a game in progress using flixel, and I used sfxr to generate the sounds, but I ran into a bunch of mp3-related issues during the embedding process, and I decided I would go ahead and implement sfxr directly into my game to see how that works. So, I wrote a very basic class 'SfxrSound' which handles this. I've added it as a zip which includes the original as3sfxr code, and pasted it below.

Using it is pretty basic. For starters, just unzip [url=http://muffinlabs.com/sites/default/files/sfxr-for-flixel.zip]the code[/url] into your app. I've got it setup to work with embedded sfs files, although there is an (untested) method for loading settings directly as well. To use it you'll want to do something like this:

[Embed(source = 'explosion.sfs', mimeType="application/octet-stream")] public static var ExplosionSound:Class;

var explosion:SfxrSound;
explosion = new SfxrSound();
explosion.loadEmbedded(ExplosionSound);

// meanwhile, something blows up
explosion.play()

Right now, the sound is generated when it is loaded and cached so its ready to be played on demand, because there's a chunk of lag the 1st time you generate it. From my experience, it is wise to instantiate the sound well before you need it, and it might be worthwhile to have some sort of sound manager class if you want to call the same sound from a bunch of different objects.

The code inherits from FlxSound and could probably be made to work with the proximity/translation methods with a little tweaking.

I'm experiencing a certain amount of latency which sounds like it's an FP10 issue. There might not be a decent workaround, so I'm not sure this is a good option if you need your sounds to play with any precision.

Anyway, it's rough and might not work for you, but hopefully it's helpful.

/**
 * very basic integration of SFXR AS3 lib into Flixel, to generate sounds on the fly
 * coded by Colin Mitchell (<a href="mailto:colin@muffinlabs.com">colin@muffinlabs.com</a>)
 * licensed under WTFPL <a href="http://sam.zoy.org/wtfpl/<br />
" title="http://sam.zoy.org/wtfpl/<br />
">http://sam.zoy.org/wtfpl/<br />
</a> *
 * usage:
 *  embedded sfs files
 *      [Embed(source = 'explosion.sfs', mimeType="application/octet-stream")] public static var ExplosionSound:Class;
 *       var explosion:SfxrSound;
 *       explosion = new SfxrSound();
 *       explosion.loadEmbedded(ExplosionSound);
 */
package sfxr {
  import org.flixel.*;
  import flash.events.Event;
  import flash.utils.Endian;
  import flash.utils.ByteArray;
   
  public class SfxrSound extends FlxSound {
        private var _synth:SfxrSynth;

        public function SfxrSound():void {
          super();
          _synth = new SfxrSynth();
        }

        override public function loadEmbedded(EmbeddedSound:Class, Looped:Boolean=false):FlxSound {
          var tmpData:ByteArray = new EmbeddedSound() as ByteArray;

          stop();
          init();

          setSettingsFile(tmpData);
          initSound();
          return this;
        }

        private function initSound(Looped:Boolean=false):void {
          _synth.cacheSound();
          _looped = Looped;

          updateTransform();
          active = true;

          updateSound();
        }

        public function loadSettings(string:String, looped:Boolean=false):Boolean {
          if ( _synth.setSettingsString(string) == false ) {
                return false;
          }

          initSound(looped);
          return true;
        }

        /**
         * Call this function to play the sound.
         */
        override public function play():void {
          _synth.playCached();
        }

        private function updateTransform():void {
          _transform.volume = FlxG.getMuteValue()*FlxG.volume*_volume*_volumeAdjust;
          if(_channel != null)
                _channel.soundTransform = _transform;
        }


        /**
         * Reads parameters from a ByteArray file
         * Compatible with the original Sfxr files
         * @param       file    ByteArray of settings data
         */
        public function setSettingsFile(file:ByteArray):void {
          _synth.deleteCache();
          file.position = 0;
          file.endian = Endian.LITTLE_ENDIAN;
                       
          var version:int = file.readInt();
         
          if(version != 100 && version != 101 && version != 102) return;
                       
          _synth.waveType = file.readInt();
          _synth.masterVolume = (version == 102) ? file.readFloat() : 0.5;
                       
          _synth.startFrequency = file.readFloat();
          _synth.minFrequency = file.readFloat();
          _synth.slide = file.readFloat();
          _synth.deltaSlide = (version >= 101) ? file.readFloat() : 0.0;
                       
          _synth.squareDuty = file.readFloat();
          _synth.dutySweep = file.readFloat();
                       
          _synth.vibratoDepth = file.readFloat();
          _synth.vibratoSpeed = file.readFloat();
          var unusedVibratoDelay:Number = file.readFloat();
                       
          _synth.attackTime = file.readFloat();
          _synth.sustainTime = file.readFloat();
          _synth.decayTime = file.readFloat();
          _synth.sustainPunch = file.readFloat();
         
          var unusedFilterOn:Boolean = file.readBoolean();
          _synth.lpFilterResonance = file.readFloat();
          _synth.lpFilterCutoff = file.readFloat();
          _synth.lpFilterCutoffSweep = file.readFloat();
          _synth.hpFilterCutoff = file.readFloat();
          _synth.hpFilterCutoffSweep = file.readFloat();
         
          _synth.phaserOffset = file.readFloat();
          _synth.phaserSweep = file.readFloat();
                       
          _synth.repeatSpeed = file.readFloat();
         
          _synth.changeSpeed = (version >= 101) ? file.readFloat() : 0.0;
          _synth.changeAmount = (version >= 101) ? file.readFloat() : 0.0;
         
          _synth.validate();
        }
         
  } // SfxrSound
} // package

Art, Games

20
Apr 2010

Scott McCloud | Journal » Archive » Wrong Question?

If you’re asking if videogames are art, I think you’re asking the wrong question. I don’t think art is an either/or proposition. Any medium can accommodate it, and there can be at least a little art in nearly everything we do.

Once in a while, someone makes a work in their chosen medium so driven by aesthetic concerns and so removed from any other consideration that we trot out the A-word, but even then it’s a matter of degrees, and for most creative endeavors you can find a full spectrum from the sublime to the mundane.

This all started with Roger Ebert's post stating that "Video games can never be art" -- which, as much as I respect Ebert, is a completely baseless statement.

I've been toying with the concept of very simple, distilled strategy games that don't take long to play, but involve some brainwork on some level. I was already thinking about putting a game of some sort on a very small (maybe 5x5) board, and then I stumbled across a description of Quadpawn, an old C-64 game. Each side has four pawns on a 4x4 board, and the objective is to either get a piece to the other side of the board, or prevent the other player from being able to move. The game concept is also described on algorithmist.com.

Anyway, here's a version in Flash. The source code is available as well. Update: now the link for the code actually works.

You are missing some Flash content that should appear here! Perhaps your browser cannot display it, or maybe it did not initialize correctly.

The game is simple, and once you get the hang of it, it's not hard to win most of the time, but it stayed enjoyable the whole time I was playing it.

The sourcecode is pure AS3, so you don't need Flash to compile it. Among other things, it has a pretty clean implementation of the minimax algorithm, something that is reasonably hard to come across.

Syndicate content