Compact Pong - game in C# for the Pocket PC (Windows Mobile 2003)
Last updated on December 3, 2016, 15:07 by Sebastian Mihai
Some years ago, before smart phones were common, Pocket PCs were available. They were small devices which offered watered-down office applications, as well as organizer/calendar type functionality.
My Pocket PC is an HP iPAQ, running Windows Mobile 2003. The cool thing about these devices is that they can run programs written for .NET Compact Framework 2.0, a version of .NET which targets resource-limited devices.
Compact Pong is different from regular Pong in that it's a single player game, where the player controls 4 paddles (top, bottom, left, and right of screen), trying to not miss any of the balls which periodically increase in quantity.
Developing an application in .NET CF for Pocket PC is similar to developing a Winforms application for Windows. Having worked extensively with .NET 4.0+, I found dropping down to .NET CF 2.0 constricting. Not to mention that the device was low on horsepower, and everything lagged. However, the tool chain was very easy to install.
One hurdle I had to overcome was the flicker caused by screen updates. I accomplished this by performing the heavy bitmap rendering operations to a back buffer, and then dumping the buffer to the screen.
Another challenge was being unable to rely on a simple "main game loop", like some of my other games on older platforms. Compact Pong is entirely event-driven.
Finally, Pocket PCs have slow CPUs, which, coupled with the overhead of the .NET CLR, meant that video frames had to be skipped in order to maintain a decent game play speed. This also influenced the game design of Compact Pong: I opted for multiple, slow moving balls, rather than one fast ball.
- copy this to your Pocket PC, and then run it to play the game
Source code package
- Use the following development environment to build and run the game:
- Windows XP
- Visual Studio 2005
- ActiveSync 4.5
- Windows Mobile 5.0 Pocket PC SDK
Other setups might work, as well. I'm suggesting the above because that's what I used. With the above tools, I could use either an emulator, or real hardware to test my code.
If you use the materials on this page, or any other page on this web site, you do so at your own risk. They are provided "as is". No warranty is provided or implied. I neither guarantee that the materials will work, nor that they will not be harmful in any way.