Jaa


Twisted Pixels - A Mobile Game Development Diary

My name is Norm Sohl, and I work for the Windows Mobile Developer Experience Content Team.  I used to work for a game development company back in the day when a desktop PC had about as much power as the mobile phone that sits in my pocket right now. Many of the issues we contended with in those days are similar to the ones we deal with today on mobile devices. The one difference is that today the features available on our phones are far cooler than what was available on a PC back then. Data connections, WiFi, GPS, accelerometers, touch screens add so many possibilities that it can be hard to figure out where to start.

For me, the desire to play with all this new technology is hard to resist, although I’m not even sure what to do with all these features yet. That being the case, I’m going to start by doing some experiments to see how powerful different devices are, and what kind of performance (graphics, input, audio, etc.) I can expect from them. This information will help me (and hopefully you) make a decision about what kind of game might be successful on the Windows Mobile platform.  Expect to see updates to this diary about once a week in the near future.

Day One: Setting up for Windows Mobile Development

Where to start?

It is safe to say that there are more options for development on Windows Mobile 6 than on any other mobile platform. WM has been around for a while, and Microsoft has built up a huge variety of APIs and development tools to support the platform. This is good - no matter what your preferred style of programming is, there is probably a supported solution on WM. It can also be confusing if you are trying to find out where to start when developing an application.

The options include:

  • Browser based development using scripting languages and Flash or Silverlight. This option is poorly supported in the existing mobile browsers, so at the moment, this is not a practical option.
  • Managed Code using . NET languages and the .NET Mobile Library.
  • Native coding using C++ and Windows Mobile native libraries.

Speedbump3_thumb_130CCC46[1]  Speed bump: Not all Windows Mobile native libraries have managed equivalents. This means that the author of a managed program (in C# or VB for example) will have to use cumbersome and potentially unsafe methods to integrate the native library into the managed application if they wish to make use of the full libraries.

There are also different flavors of Windows Mobile 6: Standard and Professional. The big difference is that Professional devices have touch screens, and generally more features. It’s reasonable to expect that the performance of a professional device will be superior to that of a standard (no touch screen) device and the touch screen allows more input possibilities so I expect to focus on those devices.

At the moment, I’m not sure if I want to develop on managed or unmanaged code. I prefer to develop in C# using managed code, but may need the performance and APIs that are available to the C++ programmer. Luckily, I will use the same tools to develop both kinds of applications for WM, so I don’t have to decide what environment to use quite yet.

Reading up

In the past, the first stop in making sense of all these options would be to check Microsoft’s official documentation on MSDN, but that is changing. The official starting point for development on Windows Mobile is now the Windows Mobile Developer Portal.

For the moment, I actually prefer the material found on a different site -Windows Mobile Developer Center, although I’m told that these two sites will be integrated in the next few months. This site has webcasts, videos, and (of course) this blog.

The first thing I want to do is set up my development environment, and so I started looking for a section that would tell me how to start.  I already have a copy of Visual Studio 2008 installed, and wanted to use it, so I looked for that first.

Setting up

Speedbump3_thumb_130CCC46[1]Speed bump: Unlike the documentation on MSDN (Windows Mobile 6 Documentation) which only covers Visual Studio 2005, the information I found for setting up Visual Studio 2008 on the Developer Center was in videos. See https://code.msdn.microsoft.com/WM6YourFirstApp for a good getting started video.

Although the videos are current, excellent and accurate, watching the video is more time consuming than reading a procedure, (and impossible to find via search) so I’ll summarize them here:

  1. Install Visual Studio 2008. The SDK only works with the Standard and Professional editions, not with the free Express editions. There is a 90 day trial edition that you can download for free at the following web page: Try Visual Studio 2008 - Trial Software.
  2. Install the Visual Studio 2008 Service Pack 1 and .NET Framework 3.5 Service Pack 1. There may be other service packs available by the time you read this. Information on the latest service packs may be found at the following page: Visual Studio 2008 Development System.
  3. Download the Windows Mobile 6 SDKs from the following page: Mobile 6 Professional and Standard Software Development Kits Refresh. I am installing both, although I am planning on writing only for the Professional Edition device. You never know when you might change your mind!

Note: if you have installed the SDKs before Visual Studio 2008, you will need to remove and re-install them after the VS 2008 install.

Building a test application

To confirm that you have a working installation of Visual Studio and the SDK(s), try creating a simple application. I created a blank C++ project by following these steps:

  1. On the start page of Visual Studio 2008, in the upper left hand corner, there is a block titled “Recent Projects”. At the bottom of this block, there is a link for Opening a Project, and for Creating a Project. Choose Create Project.
  2. In the New Project dialog box, choose “Visual C++, then “Smart Device in the Project Types list. The Templates section should be populated with different project templates for different kinds of projects.
  3. Choose Win32 Smart Device Project, and enter a name for the project. “Test” is fine. Click OK.
  4. The Win32 Smart Device Project Wizard opens. The presets are set to Windows Mobile 5.0, which I don’t want to use, so I choose the Next button at the bottom of the dialog.
  5. This brings up a list of installed Windows Mobile SDKs. I am going to remove the Windows Mobile 5.0 SDK from the Selected SDKs list, and add the Windows Mobile6 Professional SDK and Windows Mobile Standard SDK. Once this is done, I click Next.
  6. In the Project Settings Dialog, I select “Windows application” and click Finish. The dialog closes, and Visual Studio creates a new project, populated with basic files, named “Test”.

In Visual Studio, I make sure that “Windows Mobile 6 Professional Emulator” is chosen in the drop down list on the upper left tool bar. I then build the application “Test”, and choose to start debugging.

The Emulator appears, and in a moment, my application (with a blank screen) loads and is displayed in the emulator.

 TestProgramImage_7_7C4A0A8C

Clicking on the close icon in the upper right hand corner shuts down my application, and Visual Studio returns to its default state.

Excellent – that was easy, and everything works!

If I wanted to build for a different flavor of Windows Mobile (Standard, Windows Mobile 5, or deploy to an actual device, I would choose a different option from the upper left hand tool bar drop down. Does it all make sense so far?

Next up – Doing Graphics!

Comments

  • Anonymous
    March 20, 2009
    Please, repair links to images.

  • Anonymous
    March 20, 2009
    Nice material for newbies.. I am myself looking forward to experiment with graphics on WM6 and work on a few simple games maybe... Im sure to follow your posts.. thanks!

  • Anonymous
    March 20, 2009
    Hey, Norm Sohl, can u plz tell me how to run asp.net pages on emlators. I am new to mobile development. I,ve VS.net 2005. The emulators are working fine with windows app, but when I started doing stuffs in ASP.Net (Mobile), I found no way to run my pages onto the emulators. Plz help me. I know this is not the place to ask suchq uestions, but I'm really in need to do it. Hope u understand. Anyways, u've started a very good topic, I'll be a regular reader of this. Thankyou & Regards

  • Anonymous
    March 23, 2009
    Is this the part where you get the DirectDraw frame buffer and write a bunch of pixels with a lot of code, or the part where you write a Direct3D engine that only runs acceptably on a small subset of WinMo devices? When do we get to the part where we have to write completely different controls for D-pad, touchscreen-only, and accelerometer devices? Yay WinMo!

  • Anonymous
    March 25, 2009
    The comment has been removed

  • Anonymous
    March 25, 2009
    Thanks for your comment - everything I know about Silverlight on mobile platforms can be found at the following link: http://silverlight.net/learn/mobile.aspx Hope that helps.

  • Anonymous
    March 25, 2009
    Late last year availability of a public preview version of Silverlight for Mobile was forecast for this quarter, which obviously isn't going to happen - judging by Scott Guthrie's answer at MIX09 it sounds like we won't see anything any time soon. To talk about Silverlight as a development option for Windows Mobile is sadly to talk about something which doesn't exist, which is less than helpful. I'm beginning to get a sinking feeling that it will only be released with Windows Mobile 7 and won't be available for earlier versions. It'd be nice actually if at least the required Compact Framework update were made available earlier, since to support Silverlight it needs to include features which would improve the .NETCF considerably. I could argue that the Microsoft partners who've had access to preview versions since the beginning have an unfair advantage over other developers, but I'd be wasting my breath, wouldn't I? I do believe in this platform, so I hope that in this matter as in the terms around the Marketplace Microsoft comes to grasp the value of the MicroISV/small developer to the health of their software ecosystem. Anyway, I'm looking forward to Twisted Pixels, Day Two.

  • Anonymous
    March 25, 2009
    I understand your frustration.  I've made changes to the blog to make it clear why these technologies are not ready for consideration at the moment. Thanks again for your feedback.

  • Anonymous
    March 30, 2009
    I have Visual Studio 2008 Standard SP1 with .Net 3.5 SP1 installed, and after installing the Windows Mobile 6 SDK, I noticed that there were no project templates for smart devices.  After a lot of searching, I discovered that the smart device templates are not supported for Visual Studio 2008 Standard edition.  Very disappointing.  This bit of information should be published on the Mobile development website. Thanks, Charlie

  • Anonymous
    April 06, 2009
    Scratch my previous comment, I see Day 2 is up at last

  • Anonymous
    May 20, 2009
    Like you I come from game development background. I thought I'd give it Windows Mobile a shot. After all it's just a recompile of the code I have running nicely on my PC. NOT! Indeed the port was fairly easy and I had it up and running in about an hour. I've run into several issues and I'm wandering weather Windows Mobile is really a viable platform. Granted I have not spent much time trying to figure out coding alternatives or looking for bottlenecks, but the thing I've run into are showstppers:

  • Lack of support for transformations in particular RotateTransform and TranslateTransform
  • PNG transparencies do not work
  • Commenting all Transformations I got the game running at about 1 frame per second. This is extremely simple game with a few bitmaps moving around. I have to cap the same code on iPhone at 50fps. I am wondering whether it makes any sense to write games for Windows Mobile platform using the technology Microsoft provided. At this point I have to say no.
  • Anonymous
    May 21, 2009
    Peter: I think you have to do transformations the hard way with matrices

  • Anonymous
    June 01, 2009
    thx for your guide. really appreciate it

  • Anonymous
    June 02, 2009
    Thank you!