This tutorial will guide you through the development of a simple arcade game for WidSets called "Paddle Game". The final game will bear more than a passing resemblance to a popular paddle-and-ball game created over 35 years ago. Although this tutorial will build toward the development of a specific pong-style game, many of the concepts covered are applicable to a wide range of games.
Games represent only one type of widget. However, they are very popular with users and at the time of writing four of the top ten rated widgets on WidSets are games. It is possible to loosely sub-categorise games into turn-based/puzzle and real-time games:
Figure 1 (top). Turn-based/puzzle games (except Breakout).
Figure 2 (bottom). RetroBall game based on this tutorial.
The scope of this tutorial is focused quite narrowly on developing a real-time game and not on game or widget development in general, so we'll try to avoid covering topics that are already well documented in the developer wiki. If you are interested in creating a puzzle game, there is an example of a memory game on the wiki that you might find useful. Where appropriate, links will be provided to relevant pages/sections within the wiki, or other resources, that you should follow in order to gain an understanding of the concepts covered.
It is perhaps best to think of WidSets as a platform for casual games (first person shooters will have to wait). As widget game developers, we should learn to embrace the constraints or as Nokia put it Turn Limitations into Strength. For example, imagine if your game could only use a single button.
Before we go any further, you might be questioning why you should develop for WidSets when there are so many other mobile languages/platforms vying for your attention. Let's list some of the benefits of developing widgets and in particular, WidSets widgets:
Of course, there are still many situations where you would want to develop for S60 Web Run-Time, J2ME, Symbian, Python etc. However, it's important to note that WidSets represents a viable platform for many kinds of mobile content with unique advantages in some areas.
Before we go any further, now would be a great time to visit the developer wiki to find out more about WidSets development and how to develop your first widget.
If you've not already done so, register as a WidSets user then download and install the WidSets SDK on your PC. Updates made to your widget can be pushed immediately to the WidSets client on the handset (Figure 3).
Figure 3. Example of push update in WidSets developer client.
All the information you need to get started is on the wiki but if you get stuck, try posting a message on the developer forum. The WidSets developer community is quite small (for now) but very helpful.
After you've got an understanding of what WidSets is about, you'll need to setup your development environment. To create your widget files, all you need is a text editor. Windows Notepad or Emacs will suffice. However, if you want to take advantage of features like syntax highlighting and code folding, you may want to try using EditPlus or UltraEdit and configure them to recognise WidSets source code files (instructions on the wiki).
Whilst developing WidSets widgets, you should probably have at least two tabs open in your browser: The developer wiki and the Apidocs which lists all the classes and methods you can use in your widget (the Apidocs shipped with the SDK may be more up-to-date than on the web site).
This tutorial is now split into three steps. In the first step, we'll develop the foundation for our widget, most of the code presented will be present in all WidSets widgets. In step two, we'll create a framework suitable for any real-time game. In step 3 we'll implement the logic that is specific to our paddle-and-ball game.