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:
The application is available since early March in the marketplace. You can download it here.
This program adjusts Kinect to better see the user, this way the user doesn’t have to move back or forward (unless Kinect’s angles aren’t enough to see the user). I think this is a useful thing to have when you start your Kinect application.
The code is very simple to follow. Use Kinect’s elevation angle to change the Kinect’s “view” and track the user in sight. For each angle count how many joints Kinect is tracking and save that angle as the best if we reach a new maximum number of tracked joints.
void KinectSkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
// Get skeleton information
using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame())
if (skeletonFrame != null && m_skeletonData != null)
m_curTime = m_watch.ElapsedMilliseconds;
if (m_calibrationState == CalibrateState.GoingDown)
// If the sensor reach its lowest angle, let's do a full scan from min angle to max angle.
if (m_curTime >= WaitTime)
m_bestAngle = m_kinect.MinElevationAngle;
m_maxNumTracked = 0;
m_calibrationState = CalibrateState.GoingUp;
m_kinect.ElevationAngle = m_angles[m_curAngleIndex++];
else if (m_calibrationState == CalibrateState.GoingUp)
if (m_curTime >= WaitTimeGoingUp)
// If we scanned all the angles, lets adjust kinect to the best angle.
if (m_curAngleIndex > m_angles.Length - 1)
m_calibrationState = CalibrateState.GoingBest;
m_kinect.ElevationAngle = m_bestAngle;
m_kinect.ElevationAngle = m_angles[m_curAngleIndex++];
// For each skeleton, count the number of tracked joints and save the best
// angle when the number of tracked joints is greater than previous values.
foreach (Skeleton skeleton in m_skeletonData)
if (skeleton == null)
if (skeleton.TrackingState == SkeletonTrackingState.Tracked)
//TODO: Improve algorithm by using the number of inferred joints.
int numTracked = 0;
int numInferred = 0;
foreach (Joint joint in skeleton.Joints)
if (joint.TrackingState == JointTrackingState.Tracked)
else if (joint.TrackingState == JointTrackingState.Inferred)
if (numTracked >= m_maxNumTracked)
m_maxNumTracked = numTracked;
m_bestAngle = m_kinect.ElevationAngle;
else if (m_calibrationState == CalibrateState.GoingBest)
// Just wait until kinect adjusts itself to match the best angle.
if (m_curTime >= WaitTime)
m_calibrationState = CalibrateState.Idle;
m_kinect.SkeletonFrameReady -= KinectSkeletonFrameReady;
// Reset Kinect state.
// Signal that we finished the calibration.
if (OnCalibrationComplete != null)
You may notice two things about the code:
- First is that I’m using time to control between Kinect movements. The reason for this is that if we try to compare Kinect with the angle we set, we might not get the same value for different reasons (Kinect sensor is not 100% accurate or it couldn’t physically rotate the sensor to that exact angle).
- And second is the fact that I’m only scanning the skeleton for some angles. I don’t know if this is a Kinect’s limitation or if I did something wrong in the code but I couldn’t track any joints while Kinect was moving. So what I did was move the sensor between some angles and wait there a bit to count the bones for each one of those angles.
- it only supports 1 user at this moment;
- the scanning process is not ideal.
Kinect Calibration (13Kb)
I just posted an updated version of my Interactive Portfolio using Kinect. It was updated to work correctly with the latest Kinect SDK 1.0. The application is now installed via ClickOnce which checks if you have the software requirements installed to run the app. It took a bit to figure out while ClickOnce wasn’t including some required files in the installer but it appears that there is a problem when mixing XNA and WPF projects.
You can grab the project here.
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.
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:
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.
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:
It’s available on zune here.
In 3D Cascais you can visit and explore the natural park of Sintra-Cascais. All the work in this project was made based on real world data. ZPX’s team members (me included) made several visits to the park and took some photographs to be used as reference. Detailed height maps and information about fauna and flora (including actual sounds recorded in the park) were provided by our partners SiQuant and Cascais Natura.
This project took about 6 months, two programmers and two artists but one of them not fulltime. It was built using the Unity3D engine.
Go on and visit the park:
http://percursos.webcomfort.org/PedraAmarela@26.aspx – Pedra Amarela – partial demo (faster download)
http://percursos.webcomfort.org/Pisao@27.aspx – Pisão – partial demo (faster download)
http://percursos.webcomfort.org/Global@30.aspx – full project online (slower download)
http://percursos.webcomfort.org/Viewer3D/cascais3d_1_1_8.zip – full project with better quality to download and test it on your pc.
Since the terrain is all generated on real data and is very highly detailed the builds became a bit big so bare in mind that the downloads can take a bit.
Visit Sintra-Cascais park
Sintra-Cascais natural park is now just a click away, offering an unprecedented interactive experience.
This was my first 3D interactive project at ZPX and was developed for the EMEPC (Task Group for the Extension of the Portuguese Continental Shelf) aiming to captivate the interest of the general public to this project.
All that you see is mapped using real data that took several months to gather. Visit the deep Atlantic ocean or follow the automatic trails to take a tour. It took about 6 weeks of development with two programmers using the Unity3D engine. All the graphic content was delivered to us by our partner. Unfortunately there wasn’t time to add more interesting stuff to the deep ocean, such as some fishes or plants.
See the Ocean as never before
An amazing journey to the bottom of the Ocean, illustrating the Extension of Portugal’s Continental Platform project. This project was the result of a partnership between ZPX and Caixa d’Imagens.
You can try it here! Click on “Modelo Virtual 3D” – gamepad icon and wait for it to load, it may take a while due to the dimension of the terrain. You may have to install Unity3D web player.
The Lego miniature car constructions below gave me the inspiration to build a simple 3D application where you can interact with the vehicles. I’ll present now the steps that took to achieve what you’ll see in the program: the models were built in the LDD (Lego Digital Designer), then they were exported to the LDR (LDraw file format) and later converted to the 3DS format. Each 3DS file was imported in 3D Studio Max and the normals along with the pivots/rotation had to be adjusted per each Lego piece (basically a reset transform was applied to each piece). The model was then exported to the FBX format and finally imported in Unity3D. This time the programming was easy and took only one afternoon of work.
Below you can find the build and play around with it. You’ll have to install the Unity Web Player plug-in for your browser if you don’t have it already. It’s free and it shouldn’t bring you any problems.
Click on the image to run
[WP_UnityObject width=”640″ height=”480″ src=”/wp-content/uploads/2009/05/mini_lego_hires.unity3d” altimage=”/wp-content/uploads/2009/05/mini_lego_hires.jpg” /]
I’m not a Lego fanatic like someone I know but I like to play a bit. This colleague of mine bought some legos from a new collection called creator. These models have an interesting characteristic, that is, you make 3 different lego models from each set that comes in the box(or at least, according to the instructions) and besides this, the models are very small.
It’s curious how you can do so much with just a few pieces and to show you what I just said I propose a challenge: how many mini cars can you build with the following 10 lego pieces?
The following model is the original that came in one of the sets:
Now lets see the models that were made from these 10 pieces (each line is a new mini car variation, except from the truck loaded with the cookie which takes 2 lines):
Well, there were some rumours about not having a plane so… here it is ;)
With some effort we could have done some more mini cars, but I think these are enough to show that we can do a lot with just 10 pieces. :)
Note: With minimal changes we could have done lots of permutations on the cars. Example: changing the two orange triangular pieces by the white ones and other similar changes but we tried to minimize these kinds of permutations.
I hope that you liked the models and in case you have some suggestions to new ones, go ahead, send them to me!