Sleepwalker game now Open Source

By robin, July 28, 2010 12:32 pm

Sleepwalker XBox Indie gameOur Sleepwalker game in now open source. It was built with Swf2XNA and it a good example of how you can build an XNA game using Flash and C#.

You can find the source and more info here: http://wiki.github.com/debreuil/Swf2XNA/sleepwalker

SVG vs SWF, Seven Years Later

By robin, July 25, 2010 4:15 pm

horse animationAbout seven years ago I made a swf to svg converter. It converted all graphics and animations and played fine (if a bit herky jerky) in the Adobe SVG player. As far as I know all markup was legal and approved (I avoided any player specific hacks and scripting). Now with an increasing interest in svg due to Html5 and Apple, I thought I’d revisit the project. Chrome and Mozilla can play SVG content now, IE might one day, who knows, maybe it can finally be useful!

Or not. For a final demo, I shrank and spliced an old Flash3 animation that showed off what the converter could do without choking the player. While it didn’t look set to take over, it was a start – like many people I really wanted vector control at the page level so all was cool. “Imagine what the future will bring!”

Have a look for yourself:
SWF Animation
SVG Animation (warning, may take down Chrome)
Download

In Mozilla the svg just gives a blank screen. Chrome has a little more luck – it plays for a bit and then gives an ‘oh snap’ error. The swf to xaml converter we made suffered a similar fate, and broke later versions of xaml tools as well. Fwiw, all flash animation we have (going back to Flash2) runs flawlessly in the latest player, as does 99.99% of our actionscript code. This is seriously something to consider when moving your assets to html5 (or any direct play xml based format imo). But hey, you can bet on whatever horse you like – just you really should watch them warming up first – in these links above that is ; ).

chrome svg animation
SVG animation plays in Chrome, sort of (used to look great!)

Chrome End
…and then it dies.

I’m sure it will have uses. Any new graphic support in browsers is a good thing — just don’t bet on it replacing Flash anytime soon.

Remapping shortcut keys in FlashDevelop

By robin, July 24, 2010 8:29 pm

*** Note: You can do it my way below, or you can do what Philippe Elsass (who probably made the feature) says below. Err, thanks Philippe!
Shortcuts which are not in MainMenu.xml can be changed in plugin settings. Press F10, and look into ASCompletion settings.

Now back to our regular scheduled irrelevant blog post : )

**************************************

This is a mental note to self. I think I put a note like this on my last blog, and its gone now. Damn internet wreckers!

So I always map F3 to copy and F4 to paste, otherwise my arm gets shooting pain, and not the big H type. F3 is easy, just open ProgramFiles>FlashDevelop>Settings>ScintillaMenu.xml. Duplicate the Copy command, and change Control C to F3. You might as well do paste as well, but it won’t work yet. This duplicates those things in the menu – there is a MainMenu.xml file that has copy and paste, but that didn’t seem to work for me.

The problem with F4 is it is used by OpenDeclaration, and because of this it is added to an ignore list, and is ignored when I map it to paste. I’m not sure the following step is needed anymore, but I recompiled the source and changed the hardcoded value at ASCompletion>Settings>GeneralSettings.cs line 36:

const Keys DEFAULT_GOTODECLARATION = Keys.Control | Keys.F11;
const Keys DEFAULT_DECLARATIONBACK = Keys.Control | Keys.F12;

That still didn’t take. The last thing needed it to go to FlashDevelop’s Tools menu, and select Application Files. This brings up the config folder, and from here you want to load Data>ASCompletions>Settings.fdb
These are binary flashDevelop config files, so you need to load them in FlashDevelop. Add the the part two tags at the top, and change to whatever keys you want:

<GeneralSettings xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema”>
<GotoDeclaration>F11</GotoDeclaration>
<BackFromDeclaration>F12</BackFromDeclaration>
<JavadocTags>

Last caveat: When you save this file is saved, however the settings require a restart. When you close, it will be overwritten with the old settings! Ok, so save, go to explorer and rename a copy, close, switch the copy back, et voila! Now those are remapped, and F4 will paste.

Whew.

Sleepwalker (Swf2XNA) released!

By robin, July 12, 2010 11:48 am

Sleepwalker has finally been passed and released, just in time for me to be starting more contracting :)

http://catalog.xna.com/en-US/GameDetails.aspx?catalogEntryId=635e46d7-3dc3-4caf-aad1-6ab7b78ba3f3&type=2

Have a look, if you know flash it is really easy to make something like this (or better of course). This took my brother and I two weeks, though the sequel will take a lot less time. I think I’m starting to understand why Hollywood likes sequels when no one else does.

Getting started with Swf2XNA

By robin, July 1, 2010 5:04 am

Swf2XNA is now live! This is an open source (BSD) program that allows you to make Windows/XBox/Win7 games by leveraging Flash for assets and layout, as well as using Box2D visually. It makes 2D games in XNA quite simple to make!

There is a reasonable amount of documentation, some videos, and a lot of sample code and components. If you have any questions, feel free to email or ask on twitter (I’m there more often than anywhere – @debreuil).


Getting Started with Swf2XNA


Swf2XNA Components

48 hour game at PegJam (Sleepwalker, made with Swf2XNA)

comments Comments Off
By robin, May 31, 2010 2:09 pm

Great weekend. PegJam was the 2nd Winnipeg version of TigJam, which is where game devs from all over get together for weekend of coding madness. I believe the idea is to make a 48 hour game, but the whole thing is more about ideas than rules. There were some really really talented people around, and by demo time Sunday night it was pretty phenomenal what everyone had done. Really, it was like, wow! Huge thanks to Alec Holowka and everyone involved : ).

Sandy and I really wanted to test out the swf2xna framework in a real world deadline situation, and the 48 hour game seemed perfect. Sky and Free (my sons) helped a ton out too – in spite of missing almost a full day for their concert, they added (to the framework) shadows and highlight shaders, zoom/follow camera, and lots of physics goodness. Sandy made all the art from scratch in Flash. Most of the coding time was spent on components, but we managed to finish the main screens and three levels (the levels are very quick to make now though, as it is just placing assets in flash and testing). I was sort of keeping track of time, I figured Sandy and I spent roughly 16 hours on it, and Sky and Free 8 each. Lots of visiting was happening, which of course was the best part!

Note: swf2xna does box2d layout (in a similar way to the V2D layout engine for flash). It uses the super duper box2dXNA port, which is optimized for xbox – highly recommended!

Here is the game:

JSFL for Circles, Grids, and Auto-Naming

comments Comments Off
By robin, April 28, 2010 3:18 am

I’m doing a lot of layout for some games using the swf>xna converter. One thing that is tedious in flash is renaming all your instances sq_0, sq_1, sq_2… Also grid layout is more tedious than it should be, and circular layout almost not doable (Flash really needs a ‘repeat’ like ctrl’R in CorelDraw!). Jsfl to the partial rescue.

These are the scripts I’ve been using a fair bit, they are somewhat handy to me, so posting them here just in case they are for you too. Like all script it is basically vomit on the page, tweaked until it barely works, so buyer beware. Basically you select objects on the stage, and run the commands.

// makes groups of grids in place (and reindexes) based on the w/h and instance root names.
// Selection of multiple groups allowed.
// eg. 20 objects with the root “square” and 15 with the root “circle”
// will make two grids, one of circles and one of squares.
// To change the center point between fixed, averaged, or weighted, look at the last lines

http://blog.debreuil.com/images/CirclesAndGrids.zip

makes circles with jsfl

I’m an iPad

comments Comments Off
By robin, April 26, 2010 12:29 pm

Removing Components from a Circuit Board with Sand and Oil

comments Comments Off
By robin, March 9, 2010 5:18 pm

We finally had a nice warm day here in Manitoba, so outdoor experimenting was finally a go : ). I had tried removing components from old boards with hot cooking oil before and it worked somewhat well. The temperature is right (220C+), but it was a bit messy, and while the solder melted, it didn’t flow out of the board without a whack.

The new theory was that if the cooking oil was added to sand, it could still regulate the temperature, and the sand could act like a large soldering wick, and suck out the solder as well. Lo and behold, it worked great!

I did this outdoor as there is a certain smell involved. I’d recommend old clothes and not standing down wind as well. I had teflon and steel skillets from the thrift shop, the steel one worked better as it got hotter (not sure if that is a teflon thing, or just that particular brand). I used canola oil because that is what I had, peanut oil does get hotter though, and motor oil might work too.

setup for board stripping
The smell of cooking boards in the morning.

measuring the temperature with multimeter
Check to make sure things are getting hot enough

the first victim
a nice power supply board. Never did like TRS-80’s.

just pull em out
Parts can be pulled out with a glove, I held the board down with a scraper in the other hand sometimes.

This Epson no longer complains about the cold garage.
A bunch of memory chips and holders. Even the holders come out unscathed!

even worked for fancy plastic
From a video recorder – there was a little damage to the outer plastic holder, but only because I pulled it too early.

solder sucked into the sand
See how the solder was sucked right off the board. Hey, maybe I could reuse that too ; ).

like a digikey order arriving, almost
I feel like a big order just arrived from Digikey. Well almost : ).

Particle Effects Without Particles

By robin, February 3, 2010 12:14 am

Particle effects are made by taking a lot of small bitmaps and varying their location and attributes over time. The resulting ‘animation’ can look like fire, smoke, or nearly anything else you like.

Shader ExampleNormally when coding these you create a small particle class or struct, and it holds things like position, color, direction, acceleration, alpha, scale, etc. These properties change each update which makes them ‘come alive’. You then assemble a bunch of these particles into ‘effects’ or some such thing. To leave a trail, or create blowing smoke, you can drop a series of these effects.

Our approach is similar, but we don’t use a particle class. Instead we use a random number between 0 and 1, and an equation. The random number is used to vary an effect, otherwise they can look very symetrical. So for example the alpha can be (255 * nextRandom()) to have it vary between invisible and visible. To make it also fade in, it can be (255 * nextRandom * t). To make it ease out on fading it can be (255 * nextRandom * Easing.FadeOutQuad(t, 255, 0)). I think you get the idea.

So instead of particles, there is just a calculation waiting to happen. Not having to deal with individual particle instances or state allows you to do things like change the particle count on the fly (by simply changing the loop size), or reverse time by changing ‘t’.

For anyone who does Flash, I’m sure the Easing idea is familiar. Robert Penner’s easing equations are universally popular, as they allow people to easily add tweening, fading and bouncing from code. I’m basing the equations on these, and adding a few non easing ones that are useful for particles (trig functions, weird functions, etc).

Rather than store the random numbers for each particle (which would require a particle class), we store the random seed and regenerate the same sequence of random numbers each update. This may sound slow, but reasonable random number generation can be surprisingly simple and blazingly fast (one billion numbers in 1.8 seconds on a p4!). We are using the FastRandom class by Colin Green which is really fast, and a drop in replacement for System.Random. This allows resetting the random seed without penalty. This is important as we reset the seed every update in order to get the same random number sequence time. It is also easy to extend – we have added saving state, so for example we can start at the 500th random number of a given seed without going through the first 499. Awesome code, I’d recommend using it for anything random in your game.

Note this code is available at http://www.codeplex.com/swf though the particle part hasn’t yet been added (using git locally, so it is a pain).

Here are some quick demo videos, I’d like to say they will clear up this crappy explanation, but I’ve seen them.

Part 1


Part 2

Panorama theme by Themocracy