Elmo’s World: The Video Game

Elmo’s World: The Video Game is not licensed or endorsed by Sesame Street. All graphics and sounds are used without permission. It’s a homemade game that your small kids might enjoy.

Download Elmo’s World: The Video Game

System Requirements:
Windows XP/Vista
Bluetooth Adapter
Nintendo Wii Remote
Wii Sensor Bar

Screenshots:

Installation:
Download and unzip to any folder you create. You will need to have a Wii Sensor Bar on top of your monitor. I recommend purchasing a wireless Wii Sensor Bar so you don’t have to fiddle with your Wii game system if you have one. If you don’t have one already you will also need a Wii Remote. Make sure your sensor bar and Wii Remote (also known as a Wiimote) are turned on.

How to Connect Your Wiimote to your PC

To allow your computer to use the Wiimote you will need a bluetooth adapter. To connect the Wiimote to your computer open up your bluetooth device manager. Hold down the 1 button and the 2 button on your Wiimote and then use the bluetooth device manager look for bluetooth devices. Click next to continue through the device manager. If you are asked to enter a pin or code to connect click “skip.” You may be asked which service to use from the Wiimote. Select the keyboard/mouse/HID service if prompted (you should only see one service available).

It seems complicated but once you get it working it’s easy to do again.

Make sure your Wii Sensor bar is turned on and double click on ElmosWorld.exe. If the game reports an error and fails to load your Wiimote is not connected.

Press the home button to quit a mini game and go back to the main title screen. All games simply require that you move the Wiimote to complete the tasks: Feed Dorothy, Catch Soccer Balls or Collect Letters.

Elmo and the Wii Part 2

The next game I decided to go with from the original Elmo game is the Feed Dorothy game. The object of this game is to move Dorothy so she catches the food. In my version you feed her cookies. In the original version the object is to feed Dorothy fish food. Bleck.

From a technical standpoint this demonstrates some additional game programming concepts. The cookie comes from the fish food container. The fish food container moves around and shakes. Dorothy is actually animated to look like her tail is waving. A 2D image of a goldfish was progressively modified with the “bulge” filter in Paint.Net (a free and excellent image editing tool for Windows). The fish object then progressively rotates through the frames of animation. “States” are used extensively to keep everything in sync. Also, both the fish food and Dorothy face the direction they are moving.

We’re no longer simply moving around static images like the Soccer Game.

The next game to be implemented is the Alphabet Game where Elmo must dodge obstacles and collect one letter at a time. I found a couple examples of Elmo saying the alphabet on YouTube. One is a rap song. The other is a skit with Grover where Elmo says every letter except one. I’ll see how I can best use those in the Alphabet Game.

Elmo and the Wii

For Christmas I picked up Sesame Street Elmo’s World My First TV Fun & Games because it was only $5 at a store that was going out of business. My daughter is only 21 months and likes to play with the Nintendo DS because she can use the pen and make it do things. I figured that since this thing has all of three giant buttons she might be able to make use of it.

Here’s a sample screenshot:

She enjoys it because it has Elmo. However the graphics are dreadful and it features no actual music or sound effects related to Elmo. The graphics are primitive NES quality. Worse than Super Mario Bros 1. So I’ve decided to remake the games using the Wiimote and the XNA Game Studio.

It’s coming along nicely. The soccer game is mostly done. I’m just hunting for my Elmo sound effects. For as popular as he is there is a distinct lack of Elmo media on the net. I guess when most of your fans are still in their diapers you can’t expect too many fan sites to pop up.

On top of being something that my daughter can actually do (she likes swinging the Wiimote around and seeing Elmo move) it’s a good demonstration of how to put together a game using the Wiimote and XNA Game Studio.

I like my software rendering stuff because I’m doing a lot more. But the XNA Game Studio is my choice for this project. The focus is less on learning graphics programming and more on making games with the Wiimote. It’s ridiculous how easy the XNA stuff is to learn. There is no shortage of sample code to do anything you want. It even integrates with Visual Studio Express so you can get started making 2D or 3D games with little to no effort. And best of all, no cost.

Sesame Street really should look into releasing games for the Wii and DS. Parents would love it. There are so many educational games out there that just have terrible graphics and/or require sub-par gaming systems and there’s no reason for it. My parents didn’t have video games. These days kids are growing up with parents that played and still play video games. Parents today are going to have an XBox, Playstation or Wii. Why require that they buy yet another console or handheld system when they already have one or five?

I’d rather buy an educational title for a system we already own than have to buy yet another console just to have educational titles. With Nintendo’s expandable Wiimote it would be ideal for companies that not only want to create simple games but also have simple controls. I’d happily pay $15 for a Wiimote extension with 3 giant buttons for a toddler to use if I could get simple games for her to play as well. That makes more sense than $5 for yet another game system that she’ll quickly grow out of.

In the meantime, I’ll have to stick to making use of my talents to create my own educational titles for my kid to play.

Some Misconceptions About the Wiimote

One of the early mistakes people made in understanding how the Wii works was thinking that the Wii Sensor Bar actually did anything. After all it plugged into the Wii with what looks like a USB cable and you must have it on or the Wii Remote doesn’t work. Turns out that it’s essentially just a flashlight with infrared LEDs. You can put two candles on top of your TV and play the Wii.

The second misconception seems to revolve around what the Wii Remote actually does. I e-mailed Brian Peek who wrote the Managed Wiimote Library and he was apparently unaware that there was anything missing in his library. He was under the impression (as are a lot of people) that the points returned by the Wiimote for the infrared sensors indicate where the Wiimote is pointing. He didn’t realize that you can’t use those values by themselves to use the Wiimote as a pointing device.

It appears to work in some cases but once you start rotating the Wiimote (you know, twisting your wrist) things don’t work anymore.

Those values are actually where the infrared points appear in the camera. They do not by themselves indicate where the wiimote is actually pointing.

There’s a very good reason for that: the Wiimote is a collection of sensors that reports back the raw data to the Wii. It is not a computer. The individual sensors are not communicating with each other. The camera finds the x and y coordinates of its light sensor that are activated by the infrared light that hits it. The accelerometers measure their respective g-forces. There is also circuitry that indicates what buttons are being pressed. All of those parts feed their data into a bluetooth transmitter.

The reason that the Wiimote is not doing calculations is because it would add additional cost to the controller for no good reason since there is a perfectly good computer sitting on your entertainment center. All that raw data is feed to the Wii and the Wii crunches the data and spits out usable information that games can make use of. The Wii takes the positions of the infrared points of light that the camera sees and combines it with the data from the accelerometers and generates the X and Y coordinate indicating where on the screen the controller is pointing.

If the remote were to do that it would require some sort of CPU and memory and custom software, etc. As it is the Wiimote is not a programmable device. All it does is take data from the sensors and feed it through a bluetooth transmitter for more sophisticated hardware to deal with. It’s genius in its simplicity.

Anyway, the point is that the Managed Library is a great start but like the Wiimote, it only gets you the raw data. You still have to do calculations to realize the full potential of that data. The biggest missing piece is being able to use the Wiimote as a pointing device. I’ve got a good start on that as I’ve mentioned in previous posts. I’ve started work incorporating my pointer code into an XNA project to create a few sample games using the Wiimote as the pointing device.

Yes, that’s right, I’m using a game programming library intended to be used to create XBox games to create Wiimote based games. My software rendering library I wrote from scratch is nice and all and is fun to work with but it’s not going to cut it for making the types of games I want to create now that I can make better use of the Wiimote.

Hopefully I’ll have a release of some games this weekend. The games I’m currently working on are designed for a 21 month old. Perfect for demoing the capabilities of my Wiimote code without burying it under complex game code.

A Better Wiimote Pointer

This is a higher resolution of the sample Wii Pointer app in action.

You can download the app from
wiimote_pointer.zip

Everything is precompiled and ready to go. All the source code is also included. Just follow the directions at Brian Peek’s blog to get your Wiimote connected to your PC. You must have a sensor bar for this app to work properly.

Hit “+” on the number pad to increase the resolution (not the “+/=” key). You can also drag the corners of the app to change the resolution.

common\input_buffer\wiimote_class.cs contains the logic for figuring out where the Wiimote is pointing.

I updated the code to be able to approximate the location of the pointer when one of the IR sensors goes out of range. It works best when you stand several feet back from your computer monitor.

I’m sure there are some potential improvements that could be made but it is an excellent starting point for using the Wiimote as a pointing device in your own games. The sample app uses software rendering so you don’t need DirectX or OpenGL to try it out.

I’ll have some sample DirectX games created in a week or two that make use of this library.

Doing the Math with the Wiimote

Using the Wiimote as a Pointer

In my previous post I simply checked the orientation of the two IR points to determine if the Wiimote is upside down. After playing around a bit I noticed something strange. If I moved the Wiimote off the screen and then back on the screen sometimes the two points would reverse and the pointer image would flip upside down. Apparently the order of the IR points depends on which one the Wiimote registers first, not how they appear on screen. So you can hold the Wiimote perfectly horizontal, move it down off screen and back up and (what are the blue and red indicators in the above screenshot) will flip position.

So that method doesn’t actually work. What does work is even simpler: the roll angle is the atan of the z acceleration and the x acceleration. The pitch angle is the atan of the z acceleration and the y acceleration.

In C# that’s simply


//WiimoteLib.AccelState acc passed into the method
roll = (float)(Math.Atan2(acc.Values.Z, acc.Values.X) * 180.0 / Math.PI) - 90.0f;
pitch = (float)(Math.Atan2(acc.Values.Z, acc.Values.Y) * 180.0 / Math.PI);

I subtract 90 degrees so that horizontal is 0 degrees. I think the pitch could use a fixed adjustment as well but I haven’t made use of it yet so I haven’t looked into it. I use degrees in my code in various places but you could just leave it in radians.

Now the hard part is figuring out what the Wiimote is pointing at. I finally downloaded and tried out the head tracking demo that became very popular on YouTube. I was very disappointed to find that the IR values were being used as pointer position values directly. What that meant is that the demo only seemed to work because the sensor bar was kept horizontal. If you rotated the bar the motion was no longer correct. In other words, it was clever but the hard part was glossed over.

So let me make this clear: the IR values cannot be used directly as the location that the Wiimote is pointing at.

Hunting around on the internet I found a lot of references to triangulation and doing rotations but nobody had any equations. There’s a mouse demo out there were if you hold the Wiimote still but roll it slightly the cursor shoots across the screen. The reason is because it’s misusing the accelerometer data. Rotating the Wiimote in any direction doesn’t not necessarily imply acceleration: and the Wiimote knows this if you do the math right.

So what is the math?


position = new point_class((1.0-ir.Midpoint.X) * (double)sx, ir.Midpoint.Y * (double)sy);

If you’ve looked at the Wiimote Library test app you’ve seen something that looks like that. It’s basically unchanged except for one “minor” detail: the x-axis is flipped.

And you’re not done. That equation gives you the midpoint of the two IR sensors with the x-axis flipped. That doesn’t give you where the Wiimote is pointing just yet.

To finalize the equation you move the position point to the origin. In my code you subtract the point in the center of the screen from the position. You then rotate that point using the value of Roll. Now, add the center of the screen point back to position.

Done. That’s it. That’s the secret of using the Wiimote as a pointer.

Is it perfect? No. You can’t get all the way to the edges because this method requires that both IR sources be visible. It also may not be getting the exact spot on the screen that the Wiimote is pointing at but it’s close enough that I can’t tell. If I point the Wiimote in the upper left corner and roll the Wiimote the pointer stays in the upper left hand corner and so on with the rest of the quadrants.

So it’s a very good start. The basic thing to keep in mind is that input has to be simple. The equations for processing input have to be simple and fast otherwise you’re wasting CPU cycles that should be used for graphics and game play. So there was no reason for me to believe that you have to be doing complex 3D equations to get the pointer going.

Maybe that’s ultimately what Nintendo is doing, but you don’t have to. I’ll have the full code and download available soon so you can try it out yourself and maybe find ways to improve it.

Getting the Wiimote Pointer Oriented

One of the things the Wiimote doesn’t know by default is whether or not it’s upside down. This presents a mild problem when using the Wiimote Library and you want to rotate the pointer most every Wii game does.

The trick is realizing that the Wiimote is calculating the angle based on the two outer points. To know if you’re upside down you simply check to see which point is to the left of the other. You then invert the angle if the points are flipped.

The angle given by the Wiimote is from -1 to 1 so you subtract the angle from 2 when the remote is upside down. You multiply the given angle by 90 degrees to get the 0-360 degree angle.

In Wii-Land the x axis is pointing into the screen so we use the x axis rotation to determine how to rotate the pointer on the screen.

You can see in the code below that the x pos is flipped. That’s because 1024 is the left side of the screen and 0 is the right side of the screen according to the Wiimote. I flip that as well to simplify things.

This is all part of the work I’ve been doing with software rendering. I finally got a wireless Wii sensor bar to use with my computer so I can start making games that make use of the Wiimote and other Wii controllers.


if (ws.IRState.IRSensors[0].Found && ws.IRState.IRSensors[1].Found)
{
remote.rot_x = accel.X;
remote.rot_y = accel.Y;
remote.rot_z = accel.Z;

if (ws.IRState.IRSensors[0].Position.X < ws.IRState.IRSensors[1].Position.X)
remote.rot_x = 2.0f - remote.rot_x;

remote.pos_x = 1.0f - (float)ws.IRState.RawMidpoint.X / 1024.0f;
remote.pos_y = (float)ws.IRState.RawMidpoint.Y / 768.0f;
}

Get Rid of Your Cellphone

When it comes to phones you have a number of options. You can go with a landline, a cellphone or internet phone. If you have a high speed internet connection you can go with a company like Vonage and pay only $24.99 per month for unlimited local and long distance. Because it’s VoIP you don’t get billed all sorts of taxes and fees that you find on a traditional land line phone. If a phone company advertises $24.99 the final bill will be closer to $40. When Vonage says $24.99 the finall bill will be close to $24.99. There may be sales tax but that’s about it. Also, Vonage lets you keep your same phone number.

The only problem with a VoIP phone like Vonage provides is that it may not be an option if you have a home security system. Home security systems can sometimes require a traditional landline. We ran into that issue and ended up getting the barebones phone plan from Qwest which starts at $14.99 and after all the fees and taxes is more like $25. It has far fewer features than Vonage such as no long distance but costs the same.

Another option is the cell phone. With plans typically started at $40 a month you can see that you’re quickly paying far more than any type of home phone you could get. We used to be paying $80 a month for two cell phones. That works out to nearly $1000 a year. Once the contracts were up we ditched the monthly plan and went with a prepaid Tracfone. Other companies have pay as you go plans but they’re all far more expensive than Tracfone. With Tracfone you can get a phone for $15-20 and you only pay for minutes. There are no connection fees or daily fees that companies like AT&T charge.

The fact of the matter is that you are near a phone almost all the time. I remember years ago when all I had was a pager. It cost something like $8 a month. I’d get a page and somehow I managed to always be somewhere where I could use a phone. I don’t remember ever having to use a payphone. Many places of business will let you use their phone as long as it’s local and you keep it short.

With a prepaid cell phone you can use the phone anywhere and you just keep it short.

The issue is that people think they need a cellphone. They think they need to be available 100% of the time. You don’t. If your friends want to hang out they can call you at work and let you know. Or they can leave a message on your answering machine at home. Instead of talking to people in person now people substitute face to face interaction with cellphones. It’s so much easier to have unlimited talk time on a cell than to take time out to meet in person or wait until the evening when you’re at home to sit down and talk to your friends.

The only things that are so important you must tell someone now are emergencies. Prepaid cell phones are sufficient for that. If it’s not worth 20 cents a minute to tell someone then it can wait until you can call them on a land line or send an e-mail.

Believe it or not, cellphones have only been a “must have” item for about 10 years. Before then people managed to survive using beepers and home phones. People have forgotten that cell phones are a convienence not a necessity.

So next time your cell phone contract is up, let it expire. Get a prepaid Tracfone and see how it works out. Use it for 2 months and see if you really need that subscription based cellphone. It’s amazing how much money people throw away on cellphones because they think they need it.

And once you finally cure yourself of your cellphone addiction, take the $100 a month you’re saving on cellphone bills and do something useful with it like save it. Or invest it. Or save it for Christmas presents instead of using credit cards.

Team Fortress 2

I decided to start up a Team Fortress 2 dedicated server at tf2.dawnofthegeeks.com. That’s hardly unique. What is unique is that it is running a very verbose stat generating plugin.

The plug in is a modified version of the N1G-TF2-RANK plugin which out of the box as given is pretty much trash. The plugin is supposed to generate the MySQL tables automatically which it does but incorrectly. So no stats get logged until you manually add default values for everything in the table structures. The biggest problem is that it only does cummulative stats and doesn’t tell you player v player stats. What that means is that you can’t see how well players fare against each other and you can’t view improvement (or lack thereof) over time.

So what I did is whip up an “action_log” table which collects raw data from the modified plugin. The modified version simply feeds the action log with things like “bob killed steve” and even tells me what weapon was used.

The result is that eventually the above listed web-site will be displaying some pretty interesting charts.

The one good thing about the given plugin is that it supplies a very good skeleton for plugging your own database queries into. So if you want to run a Team Fortress 2 server and have some good stats get the source for the above plugin and edit it to generate the stats you want. It took me only about two hours to get it generating more useful stats. With some more time I could clean up the code even more. There are some places where I think the code could be simplified.

The original plugin also allows you to see the top 10 players in game. I broke that with my modifications. Future feature, once data is being collected and charts being generated, is to put that back in. Although I don’t see the point of having that in game. What might be useful is telling the player who to avoid and who to go after based on previous encounters.

The possibilities are endless but I think I’ll give it at least a month of getting the basic stat collections taken care of before jumping in too far.

Visualizing the Housing Bubble

Census.gov has a PDF with all the average and median home values from 1963 to October of 2008.

There’s news coming out that home prices are dropping rather quickly. Well, if you look at the chart you can see that the drop is a market correction. Much like what happened in the 80’s. The house prices shot up unreasonably high and now they’re dropping back down. Current prices are looking more like they should had the bubble not happened.

I’m providing the Excel workbook with all the numbers from the PDF and the chart.

house-prices

ss_blog_claim=70b9168863fc97c91e6d88b40542a327 ss_blog_claim=70b9168863fc97c91e6d88b40542a327