This is a mirror of official site: http://jasper-net.blogspot.com/

Write an Online Basketball Shooting Game Using Silverlight 4 and Farseer Engine

| Thursday, August 5, 2010
Part 1 In this series of articles we will develop an online basketball game using the famous two-dimensional physics engine - Farseer (mainly PhysicsHelper 3.0) under Visual Studio 2010 and Silverlight 4.0 environments.
Part 2 In the first article of this series, you’ve learned the fundamentals in using Farseer Engine and its enhanced buddy - PhysicsHelper. Starting from this installment, we are going to develop the online basketball shoot game itself.
Part 3 In the previous article, you've learned all the elementary work in writing the ball shooting game. And also, we've made clear the loop principle under the PhysicsHelper environment. In this article we will study the rest and more interesting parts.
Introduction
In particular, we will use the PhysicsHelper kit to help to achieve the goal of basketball moving and collision detection as well as other functions. In this installment, we are mainly going to make preparation work for using Physics Helper. Please note that because there are numerous new characteristics and somewhat traps in using the PhysicsHelper API compared with (and different from) the initial Farseer Engine API we plan to use more space to discuss these questions.

In addition, due to the novelty and difficulty of PhysicsHelper, I suggest entry-level readers to read the first two sections, skip the rest, and continue to read from the second article. When you will be studying the source code later you can go back to read the unread sections in this article to gain a better understanding. Anyway, all the notes put forward in this article deserves your close attention when you use PhysicsHelper.

NOTE
The development environments we'll use in the ball shooting application are:

Windows XP Professional (SP3);
.NET 4.0;
Visual Studio 2010
Silverlight 4
Microsoft Silverlight 4 Tools for Visual Studio 2010
PhysicsHelper 3.0
Microsoft Expression Blend 3;

Introduction to PhysicsHelper 3.0
Farseer physics engine, as a two-dimensional game engine, plays a decisive role in Silverlight based game development. First, two-dimensional physics engines that aim at the current popular Silverlight game development are extremely rare. Second, the author of Farseer physics engine has devoted many years of hard work insisting to maintain the engine, so that the engine has provided the typical functions of a two-dimensional physics engine. Third, Farseer is an open-sourced two-dimensional physics engine (the support site is http://farseerphysics.codeplex.com/), which are extremely beneficial for developers to deeply study the API even for secondary development. Although the latest version of Farseer physics engine is 3.0, it is not the official release.

So, in this series we will choose to base on the mature Physics Helper for Blend, Silverlight and WPF (http://physicshelper.codeplex.com/) to develop our game. Moreover, it is worth noting that PhysicsHelper depends on FarseerPhysics.2.1.1 (which is also a very popular and stable version), which provides a set of assistant classes and behavior components, greatly simplifying the application of Farseer API. However, to fully grasp the depth or the use of the PhysicsHelper API still requires developers to understand the underlying Farseer API. So, to gain a full understanding with the game developing principle you are highly suggested to own some skills of using Farseer API and had better first read related articles, such as Get started with Farseer Physics 2.1.3 in Silverlight 3 and Adding Behaviors Programmatically.

Components in PhysicsHelper
Specifically, the PhysicsHelper kit provides two forms of Farseer engine class package:

1. A group of helper classes, as follows:

CameraController
CameraLayer
PhysicsController
PhysicsJoint
PhysicsSprite
PhysicsStaticHolder

Read more: dotNetSlackers Part 1, Part 2

Posted via email from .NET Info

0 comments: