Every Tuesday, Mike Sylvester brings you REVOLUTIONARY, a look at the wide world of Wii possibilities.

de Blob has been getting a lot of coverage here lately because it's been announced that the freeware PC game will be making its way to our favorite console. I first heard of the game a few months ago, and it seemed like it could make for an interesting bit of roll-up gaming for my Wiimote in the absence of Katamari. I figured this week would be an opportune time to finish the scripting project I'd started back then and present a script for this gelatinous ball of Technicolor fun.

Originally conceived by students at the Utrecht School of the Arts and Utrecht University, de Blob was developed in just four months by a 9-person team in their free hours. The project began as a commission to show what the station region of Utrecht could look like after the completion of an ongoing rejuvenation process. This full game can be enjoyed for hours at a time, and is freely available to download. The installer weighs in at only 99MB, whereas most contemporary 1-level demos are hundreds of migs and megs bigger.

It's an innocent (if you can call the assimilation of the passive populous into your amorphous mass "innocent") sandbox sort of game which occasionally requires a bit of dexterity. You roll around, absorbing the colorful essence of people and transferring it onto buildings, trees, and vehicles you come in contact with. You'll flex your platforming skills to try and reach some of the targets and coins on high-rise buildings. Sometimes you'll need precision to finesse your way past the I.N.K.T. agents, or to keep from falling into the water and washing off the tint you've acquired from rolling over hapless citizens.

I had my preconceptions of how the Wii port of de Blob would look and play, but it wasn't until the first video was released that I realized how far off I was. The PC and Wii versions of the game are fundamentally different, which is great, because, despite being a blast to play on the PC, it would be an impossible sell at the standard going rate of Wii games. Plus, we'll have distinctive experiences playing the Wiimote-ified PC version and the official Wii version. We're Wii Fanboys because we believe that more of something different is better than more of the same.

The following code is used for going through the menus and options in the game. The game also responds to mouse input in the menus, so you'll also be able to tilt the controller to make menu selections, although the D-pad won't roll your Blob during gameplay.

Key.Escape = Wiimote.Home //Menu back, city map
Mouse.LeftButton = Wiimote.Two or Wiimote.Up //Selects the left option, Blob jump
Mouse.RightButton = Wiimote.One or Wiimote.Down //Selects the right option, city map
Up = Wiimote.Right //Menu up
Down = Wiimote.Left //Menu down


Since this script takes over your mouse pointer, it can be a bit tricky getting the game started or stopping the script once it's running. We'll use shortcuts to handle both of those functions and make things a bit easier. Assigning them to the "clicky" Plus and Minus buttons prevents accidental activation of these shortcuts.

Shift + P + I + E = Wiimote.Minus //Stops the script
Ctrl + Alt + E = Wiimote.Plus //Starts de Blob

It's not especially fancy, but this little line of code makes the LEDs light up in a way that they normally wouldn't outside of running a script. I recommend throwing something like this in if you're going to record a demo of your script in use. I find it helps to keep the naysayers quiet.

Wiimote.LEDs = 9

Now we're going to create variables for fixed numbers because these numbers will be used throughout the script. Instead of us changing this number at every place it occurs in the script, we let the program do it for us by assigning it as a variable.

var.Xres = 1776 //Change this number to the screen's horizontal resolution
var.Yres = 1000 //Change this number to the screen's vertical resolution

To get the Remote's tilting to translate into the mouse movements the game is looking for, we have to tell GlovePIE that "Mouse = Wiimote." But we use the MapRange function along with the Smooth function to get the relatively low dynamic range input of the Wiimote's rotation to be smoothly interpreted as the high dynamic range of a mouse gliding across a surface.

If Wiimote.Pitch < -1 or > 1 //While holding the Wiimote "NES-style", tilting left or right initiates the following:
Mouse.DirectInputX = MapRange(smooth(Mouse.DirectInputX + Wiimote.Pitch), -90 degrees,90 degrees, 0,var.Xres)
EndIf //Ends the statement

If Wiimote.Roll < -1 or > 1 //While holding the Wiimote "NES-style", tilting forward or backward initiates the following:
Mouse.DirectInputY = MapRange(smooth(Mouse.DirectInputY + Wiimote.Roll), 45 degrees,-45 degrees, 0,var.Yres)
EndIf
//Ends the statement


Without the following code, the program will stop responding once you tilt beyond 45 degrees forward or backward, and your Blob will stop dead in its tracks. This results in you having to roll the controller to keep your Blob rolling. While, that's a unique kind of fun as you can see in the video above, it's a bit more activity than what we're aiming for. Of course, if that looks like your idea of a good time, you can leave the code as it is and paint the town!

We'll be adding in some variables to modify the limits that the mouse output will map to. Instead of getting to a number and stopping, it will keep going, so we're going to have to change a couple of the lines of code we just wrote, before we proceed.

If Wiimote.Pitch < -1 or > 1 //While holding the Wiimote "NES-style", tilting left or right initiates the following:
Mouse.DirectInputX = MapRange(smooth(Mouse.DirectInputX + Wiimote.Pitch), -45 degrees,45 degrees, var.XMinus,var.XPlus)
EndIf
//Ends the statement

If Wiimote.Roll < -1 or > 1 //While holding the Wiimote "NES-style", tilting forward or backward initiates the following:
Mouse.DirectInputY = MapRange(smooth(Mouse.DirectInputY + Wiimote.Roll), 25 degrees,-25 degrees, var.YMinus,var.YPlus)
EndIf //Ends the statement

We've also reduced the range within which the remapping is applied, so that we don't have to tilt so far to get the automatic rolling to kick in.

If Wiimote.Pitch > 45//Checks whether the Wiimote is tilted more than 45 degrees to the right
var.XPlus = (var.XPlus + 10) % var.Xres
//Increments by 10 until it hits the horizontal resolution we've set, then resets to 0
Else //If the Wiimote is not tilted more than 45 degrees to the right
var.XPlus = var.Xres //This variable will be set to equal the horizontal resolution we've set
EndIf //Ends the statement

If Wiimote.Pitch < -45 //Checks whether the Wiimote is tilted more than 45 degrees to the left
var.XMinus = (var.XMinus - 10) % var.Xres //Decrements by 10 until it hits the horizontal resolution we've set, then resets to 0
Else //If the Wiimote is not tilted more than 45 degrees to the left
var.XMinus = 0 //This variable will be set to 0
EndIf //Ends the statement

If Wiimote.Roll > 25 //Checks whether the Wiimote is tilted more than 25 degrees forward
var.YPlus = (var.YPlus + (var.YPlus * .2)) % var.Yres //Increments by 20% until it hits the vertical resolution we've set, then resets to 0
Else //If the Wiimote is not tilted more than 25 degrees forward
var.YPlus = var.Yres //This variable will be set to equal the vertical resolution we've set
EndIf
//Ends the statement

If Wiimote.Roll < -25 //Checks whether the Wiimote is tilted more than 25 degrees backward
var.YMinus = (var.YMinus - (var.YMinus * .2)) % var.Yres
//Decrements by 20% until it hits the vertical resolution we've set, then resets to 0
Else
//If the Wiimote is not tilted more than 45 degrees backward
var.YMinus = 0
//This variable will be set to 0
EndIf
//Ends the statement


Now we've got cruise control! At this point, the script has a lot of room left for improvement. Feel free to try it out, give the code your personal touch, and share your scripts in the comments.

This article was originally published on Joystiq.

Destroy All Humans gets a Big Willy for PSP