Geo Reminders for WP7

I wanted to build this app since I bought my WP7 but unfortunately it wasn’t possible to have background tasks running on the phone. It was great to know that Mango would bring this functionality to the Windows Phone and I started working on the app right away.

Since I program these WP7 apps outside work it takes a while to get them done. Geo Reminders allows us to program alarms or reminders depending on our location. This is useful to set a reminder for the next time you visit a place for example. Or imagine that you left a book at work and you want to bring it home, you set the reminder that will only go off when you arrive at work so that way you can grab the book and put it near your stuff when you leave.

Here are some screen shots:

georeminders_1georeminders_2georeminders_3

georeminders_4georeminders_5georeminders_6

georeminders_7georeminders_8

The application is available since early March in the marketplace. You can download it here.

Kinect and WP7 interaction

By the same time I did my portfolio I also did another experiment that’s in this post. A few days ago I saw the KinectoPhone project and thought it would be cool to adapt it to another project I was developing with Francisco Campelo. This project allows a desktop application using Kinect to communicate with another application on the Windows Phone 7 synching its state between the two apps by communicating through a server.

I changed a bit the network code and plugged in with other code I had done for the particles and here’s the result:

Kinect and WP7 interaction

The red particles on the big screen are from Kinect’s skeleton and the blue particles are sent from the WP7 through touch screen input. On the WP7 screen, the blue particles are from Kinect’s skeleton and the red/white ones from the user’s input.

This could get many improvements, network and feature wise but I’ll leave that to some other time. I have many ideas but the time is short so I’ll be moving to another one soon.

THANKS TO

  • My parents for helping me out testing and recording the video.
  • Anabela Faria for the video editing.
  • Francisco Campelo for the original idea which led me to the Kinect version.

Jumping Jack for WP7 – GameDev Fun Facts

Last night was time for another XNA Pizza Night event at Microsoft Portugal (Tagus Park). Once again ZPX presented a “new” game. “New” between quotes because the original game is from 1983 and it was older than 90-95% of the people in the audience. The game is none other than Jumping Jack for ZX Spectrum.

I played this game for the first time almost 27 years ago when I had just made 5. In fact, this was the first game I ever played on a computer and it’s probably because of it I’m here making games.

I want to dedicate this game to the memory of Nuno Sabino, my brother. It was him who received the ZX Spectrum 48k as a Christmas present and it was him who got this great game and so many others that influenced me and made me want to program and make games since then. Thanks for everything bro.

jumping_jack_wp7

Let’s get into the development fun facts:

  • It took me about two weeks working after my daily job to get this working for the demo. This would take less time if I worked on it regularly everyday, I would say 1 week. I don’t know how much time it took Albert Ball to program the original version but my guess is that it took him a little longer. He had  to program it in Z80 assembly and didn’t have help from tools we have available today, specially for debugging, it must have been a challenge at that time.
  • Although we had the Spectrum 48k, the original version of the game ran on the Spectrum 16k, i.e., it ran in less than 16k of memory. The actual version for WP7 takes about 10-16 MB, more than 1000 times larger than the original version. I didn’t and won’t make an effort at this time to make the game as smaller as the original version and I probably couldn’t do it for the WP7 but I think I could do it for the PC version if I had some time. Maybe someday, who knows.
  • The game took around 23 seconds to display a splash screen and 55 seconds to load the game making that 1 minute and 18 seconds total to be able to play it. The WP7 version takes about takes 3 seconds to load (and that’s because it displays the splash screen for 3 seconds otherwise the splash screen would pop in and out too quickly.)
  • At this moment this version has about 2000 lines of code. Once again I don’t know the exact number of lines for the original version but I think it will probably be more than 2k lines of Z80.
  • I started by using Farseer Physics but during development I realized that doing the “physics” by hand would be easier than tweaking Farseer Physics. In this demo I’m still using Farseer doing raycasts to see if the player can jump or falls and the debug to draw the lines “Fixtures”. I will probably end up removing Farseer completely in the final version.
  • The graphics and sounds are exact replicas of the original game. I took screenshots from the game playing on a Spectrum emulator and edited them to adjust the transparencies. I was going to record the sounds from the emulator but Zalo had already done that and I used the sounds from his 3d version.
  • The last thing I want to talk about comes from a Spectrum limitation in the graphics display. Spectrum machines had a 256×192 resolution and 15 available colors (3-bit palette that makes 8 colors and another additional bit that says if a color is bright or dark but since one of those colors was black, that didn’t have the bright version making the 15 colors.) The way the information was drawn on the screen was in blocks of 8×8 pixels known as attribute blocks. Only two colors could be used in each of these blocks and if a program tried to display 3 colors in any attribute block one of the colors would change to match one of the other colors, this was known as attribute clash. In Jumping Jack this problem was evident in various situations, one of them was when Jack crashed against a line/wall as seen in the following image:

jumping_jack_wp7_headcrash

Jack was rendered in red due to this limitation and I decided to keep it rendered in red as I thought it was funnier and made sense to show the shocking moment.

And that’s it, Jumping Jack for Windows Phone 7 will be released eventually (soon I hope), maybe by other name.

Places I’ve Seen for WP7

This summer I decided to build something for WP7 in Silverlight to learn something new. Places I’ve Seen was the result of my learning experience. It was fun to use Silverlight, it’s very easy and the Visual Studio Editor for Silverlight/WPF is amazing (didn’t try Express Blend yet) and the data binding of controls saves a lot of boring work.

Based on Where I’ve Been, Places I’ve Seen allow you to save a list of your visited locations around the globe, as well as a list of locations to visit (like a wish list). There are three ways to add items to your lists:

  • by typing the name and choosing from a list;
  • by picking a image from your library (only works if you have geo tagging on);
  • or by adding the current location using GPS (this only adds to the list of visited places).

In addition I thought it would be cool to view images from each place so I added that functionality that searches images on Flickr from a place of your choosing.

Here are a few screen shots of what it looks like on the phone:

pis_1pis_2pis_3

pis_4pis_5pis_6

pis_7

 

It’s available on zune here.

Think Fast!

Since I didn’t post here for a while I had to come up with a good reason for that. The reason is Think Fast! a new game from ZPX for the WP7 platform. Think Fast! started as an experiment to test the world of free apps and see how people would react to such a simple game. I can say that we’re happy with the feedback that received so far.

tf_ss_02_ntf_ss_01_ntf_ss03

Let me first explain why the visual contrast between (Orange Game or Puzzle Jumble) VS Think Fast!. The reason why Think Fast!’s graphics suck is because I was the one doing them. While the other two games have the gifted hands of Bruno Nunes (2D/3D artist and animator), Think Fast! has only my poor programmer’s hands.
Also, each one of the other two games took more or less 1 month to complete and the first version of Think Fast! took me about 14 hours to complete.

But besides its ugliness, we thought the game was fun enough as it was and that we should release it to see if people liked it. And from the reviews we can conclude that the people like playing it thus proving that gameplay is much more important than the graphics (as if there was any doubt in that!)

This game challenges your brain by presenting two opposite facts and forcing you to take quick action or risking to lose the game. The person who can hold on longer wins the game. At this moment there are two mini games you can try but you can expect more in the future.

Do you expect more challenges in Think Fast!? I’m sure you do! I’m planning on releasing more updates as soon as I can. The next update will have a “news” system to keep players updated about information related to the game and/or new features to come. You can also expect an update/upgrade in the graphics to make it more user friendly. There’s one review complaining about no help for the second level, so I’ll probably add an information panel to each level. And last but not least, more brain twisting challenges of course! Smile

Anyways, go download it for FREE here and try to beat the high scores.

SilverMenu library for WP7

Inspired by the menus of WP7 game Puzzle Jumble, I decided to write a library that would help me and others to build menus for WP7 games easily. The Puzzle Jumble’s GUI code is a bit of a mess because it wasn’t thought for this kind of interface from the beginning so I decided to write SilverMenu from scratch.

Puzzle Jumble’s GUI

 

SilverMenu aims to bring some of the Silverlight user interface that is now present on WP7 to the XNA. To make it simple to use you can build simple animated menus with just a few lines of XML. It has only one week of development but you can see some progress already:

First SilverMenu sample.

 

With time I hope it grows into something more complete and useful. I’ll still update my blog about this project but if you want to follow the project closely and keep up to date, as well as, download the last build, you can do it at http://silvermenu.codeplex.com. I hope you find it useful and I appreciate all the feedback I can get. Thanks!

Windows Phone 7 – Tips for programming games

Puzzle Jumble started as an experiment to test and learn a little bit about XNA and Windows Phone 7. I decided to write some tips to help those who like me started experimenting with XNA and WP7.

Stencil

The stencil was used to cut the hole for doors so that pieces would appear to be sliding over the doors but under the board. The stencil was active in every frame which lowered the frame rate quite a lot (18-20 FPS). The solution was to activate the stencil only when a piece is going to leave through a door, so be careful when using the stencil buffer on the WP7.

DXT

GPUs like the DXT format and the WP7 is no exception, but unlike desktop’s GPUs the WP7 processor only loads DXTs that are power of two. My regret is not using DXT from the beginning when I started working on Puzzle Jumble. When I changed all my textures to DXT I had to change a lot of code, all the draw calls where I was using a position to draw a sprite had to be changed to a rectangle because the textures had a different resolution (power of two).
But the change was very useful:
– I gain some FPS;
– the memory footprint was reduced from 95MB (total peak) to about 45MB;
– the XAP file was reduced from 25MB to 9MB;
– thus, as a consequence reduced the loading times.

Floats (culture)

When parsing floats it’s easy to add bugs in your application if you ignore the culture format. Make sure to use the correct format provider or at least use the culture independent System.Globalization.NumberFormatInfo.InvariantInfo.

Float precision

Another problem that I found when using floats was that this comparison: if(a < float.Epsilon) (when a = 0) would work everywhere except on the WP7 device itself where it would always return false.

HTML page requests

This is not a WP7 specific problem but I thought it was worth mentioning it. Since Microsoft didn’t provide us with an API for leader boards I implemented an online score system using our servers to keep track of the users’ scores and best times.
The system was working fine to post data online but there was a problem when retrieving it. The first time the data was retrieved everything was fine but the subsequent retrievals would always be the same as if the data was cached somewhere.
After searching for a while I found out that the problem was that the HTTP request was being cached since the URL didn’t change, it would cache the result for that URL. The solution was to add a random attribute to the URL so that the the request couldn’t be cached. Not pretty but it was the only way I found to make it work.

And those were the problems that I found during the Puzzle Jumble’s development phase. I hope this useful for you!