Tuesday, March 29, 2011

XNA Flixel Port of HelloWorld


Download binaries and source.

Update: I found that StAidan ported Mode and posted the code here: https://github.com/StAidan/Mode . Look at that code and you'll see that some of my suggestions below are a bit different, with no changes in the original code.

I love Flixel. It's a framework for games written in Flash but I almost hesitate to call it a framework. When I talk about frameworks with friends, they generally have a negative connotation for many reasons but that's another topic. Flixel is one of the few very light weight frameworks that helps developers get stuff done without all the fuss.

If all goes well and we act like Professionals, the next Fellowship project will be based on XNA. I checked around and Flixel had indeed been ported to XNA and is available over at GitHub and is called x-flixel.

A couple of reasons I would like to convince NeilO to use Flixel are not just cause the library is cool and complete but it offers a bit more portability. Flixel will let us make a Flash version pretty easily but Flixel has also been ported to iOS so putting it on iPhone is also a possibility. Flixel is also great for tile based pixel art games.

I needed to get XNA going on my laptop anyway so I thought to test out the Flixel port, I wrote the standard HelloWorld sample. Links to the source and binaries are at the top of this post. At the end of this post I pasted my notes getting the project set up. There were some very minor tweaks I had to make. I'm not sure if its for XNA 4.0 compatibility or what. These are for my own reference but hopefully you will also get some use out of them.

This project isn't much to look at so I don't think it warrants the traditional video but here is a video of the Flixel standard sample game, Mode ported to XNA:

http://www.youtube.com/watch?v=jY4T0iagriY

Rough notes for getting X-Flixel up and running:

  1. Install XNA Game Studio and download x-flixel
  2. Create new XNA Windows game
  3. In the main project, add new folder called 'flixel'. Create a subfolder called 'data'.
  4. Copy all the x-flixel code to those folders. In Visual Studio right click each and select Add -> Existing Item... and add all the code for each folder.
  5. In Visual Studio, create a folder in the Content project called 'flixel'
  6. Copy all the content from the x-flixel\Content\flixel folder to the new flixel folder.
  7. Edit FlxGame.cs. Add a constructor that takes and passes a Game instance to the base class DrawableGameComponent:

    public FlxGame(Game game) : base(game) { }

  8. Edit FlxFactory.cs. In the protected Initialize method, comment out where FlxGame is instantiated and instantiate your own game class that inherits from FlxGame. In my case, HelloWorld() in HelloWorld.cs.
  9. xflixel doesn't come with the default font 'nokiafc22.ttf'. Download the actual Flixel source code from flixel.org and install the font located in the data directory. You may need to restart Visual Studio to pick up the newly installed font.
  10. In the Content project, change the Content Processor from Song to Sound Effect for "beep.mp3" and "flixel.mp3"

Monday, March 28, 2011

Resistance Beat Me

I had a long, rough Friday and no desire to use my computer over the weekend. Except I installed Ubuntu 10.10 and that was a mistake. My excuse was Ubuntu 10.04 crashed suddenly on Thursday night and it messed up all the sound control applets. How it came to such a catastrophe I cannot explain, it literally just black-screened and upon rebooting required me to scan all disks even though it complained about being unable to scan the swap. Ugh ... I wonder if my netbook is beyond being beaten up.

Friday, March 25, 2011

Bugs!

Due to an unresolved bug and having to rush to get a rental car and head into work, I wasn't able to make a video or checkin this morning! Argh ... hoping to get that sometime later today. I have some stand-in wolf sprites that I'm anxious to see animated. They're a bit over the top at 6 frames, but I don't have that many sprites so maybe that's okay.

Wednesday, March 23, 2011

Lanturn Turns Direction

Resistance almost got me this morning; I went to bed late and had difficulty dragging myself out of bed. Poking around the code I felt the weight of the schedule bearing down on the project: a week left and that's it. Anything I do beyond that is next month and I knew I could not finish within that allotment, even if getting up every morning. Still, I kept grinding with little success and the minutes ticked by until I halted completely so as to decide how to cut this thing down. And I did!

Monday, March 21, 2011

Super Powers

I didn't want to get up this morning, least of all to work on something before work. Yet, I dragged myself out of bed, or rather rolled out of my sleeping bag and stood up after fiddling with my alarm to stop it (and then rebooting my phone as I have to do after the alarm goes off). That was 6:30, I stepped into the shower at 6:45, and didn't actually sit down in front of my computer until past 7. I stopped working at 8:15 and therefore only got in about an hour. Somewhat surprising ... I actually got some shit done.

Thursday, March 17, 2011

Resistance can Kiss My Ass

Yeah baby; The War Of Art is on, son!

Has it really been a month since I posted? That's some heavy procrastination, but this morning I actually started on the main code of Lanturn. I didn't get very far except to have a graphic sprite, page flipping, main loop timing, and rough arrow-based controls for moving the player around the screen. However, as if inspired by serendipity, I turned over on my air mattress after awakening and checked my LG 420G for the time (I don't have any clocks in the bedroom) ... 6:00am.

Wednesday, March 16, 2011

Good Morning Resistance


I bet you didn't expect this, did you? Resistance, you think you can hide behind people I love but you can't. Everyone sleeps at some point you coward.

Thanks for sticking with me, Fellowship.