 |
|
|
|
Physics Behaviors for Silverlight 3!
|
|
|
 |
|
Location: Blogs Andy's Blog |
|
| Posted by: host |
7/15/2009 7:21 PM |
Today I released an initial version of “Physics Helper 3” to Codeplex. This includes a collection of new Behaviors for Expression Blend which makes it very quick to create physics games and simulations in Silverlight using the Farseer Physics Engine. This release requires Silverlight 3 and Expression Blend 3, which you can get here.
DOWNLOAD PHYSICS HELPER 3
Demos
There are four new demos using Behaviors, plus the original demos depending on the older User Control model. Note that version 3 still supports the User Control model, but I would recommend checking out the new Behaviors model as there is nice design time support in Blend.
VIEW ALL DEMOS
|
| Falling Astronaut | |
|
| Rag Doll | |
|
| Truck w/Camera | |
|
| Flying Astronaut | |
Getting Started Videos
I have a couple of quick (10 min) screen casts which show how to use the new Physics Behaviors:
VIDEO ON "THE BASICS": VIEW | DOWNLOAD
VIDEO ON "JOINTS + PROGRAMMING": VIEW | DOWNLOAD
Enhancing Behaviors with Code
Behaviors are great, but I can't imagine creating a full game using only canned behaviors. So at some point, you will need to add code to do AI, control levels and game state, and other tasks. Here are some pointers to get started with that:
Once you drop a PhysicsController Behavior onto your main Canvas, you can later get a reference to that Physics Controller (the object that contains the simulation context) in code. Suppose your main Canvas is named "LayoutRoot" then you can get a reference as follows:
PhysicsControllerMain _physicsController = LayoutRoot.GetValue(PhysicsControllerMain.PhysicsControllerProperty) as PhysicsControllerMain;
After you have a reference to the PhysicsController, you can modify any of the Farseer Physics Geometry or Body objects by getting a reference throught the PhysicsObjects dictionary:
_physicsController.PhysicsObjects["ball"].GeometryObject.RestitutionCoefficient = 1.3F;
... and you can also get a reference to the oringal XAML UI Element using the uiElement property of the Physics Object:
Ellipse ball = _physicsController.PhysicsObjects["ball"].uiElement as Ellipse; ball.Fill = new SolidColorBrush(Colors.Red);
Feedback and Issues
This is an initial release and my first swing at Behaviors, so I'm sure there will be issues and suggestions. Please let them fly on the Codeplex Forum, and I hope you have fun! |
|
| Permalink |
Trackback |
Comments (8)
Add Comment
|
Re: Physics Behaviors for Silverlight 3!
|
By Anonymous on
7/17/2009 8:18 PM
|
Way cool Andy!!! Congrats.
- Rodrigo Díaz Concha http://rdiazconcha.com
|
|
|
Re: Physics Behaviors for Silverlight 3!
|
By Anonymous on
7/20/2009 10:35 AM
|
|
You are the man. Thank you for doing this. Abstractions (making hard stuff easy like this ) is the highest form of Programming mastery.
|
|
|
Re: Physics Behaviors for Silverlight 3!
|
By Anonymous on
7/28/2009 9:12 AM
|
|
Immense work :)
|
|
|
Re: Physics Behaviors for Silverlight 3!
|
By Anonymous on
8/11/2009 10:17 PM
|
Hi, I have been playing around with the idea of behaviors in my Silverlight games (http://bit.ly/7Ract). I will definitely try out your Physics behaviors. They look really interesting and useful.
I am interested in your comment though that not everything can be done using behaviors. I had all my game code done as part of behaviors. Though it is not neatest at the moment I can still think of an elegant way of doing it all in behaviors.
For AI I was just thinking to have a NPC behavior which would control a Image/XAML control. Controlling levels and states could be done using States and Navigation. I could have a Game Over trigger which gets fired when the Player had died enough number of times which would trigger the action to show the Replay dialog.
For me behaviors has been really useful in separating the Developer and Game Designer in me and allowed me to focus better on the task at hand.
Let me know what you think.
|
|
|
Re: Physics Behaviors for Silverlight 3!
|
By Anonymous on
8/12/2009 6:26 AM
|
Yeah, I guess I should rephrase what I said :)
For working on a specific solution (like a single game or class of games), then it's certainly possible to do everything in Behaviors.
But for a generic library of Behaviors like the Physics Behaviors, it would be hard to cover everything needed like AI, scoring, level control, etc.
So I suppose that you could start with the Physics Behaviors, and then add in your own behaviors on top of it if you want to entirely separate the Designer/Developer process.
-Andy
|
|
|
Re: Physics Behaviors for Silverlight 3!
|
By Anonymous on
8/18/2009 12:08 PM
|
Cool deal. I'll show this in my Blend 3 session today.
|
|
|
Re: Physics Behaviors for Silverlight 3!
|
By Anonymous on
8/22/2009 4:44 PM
|
Hi Andy, This is such great stuff! I cannot stop playing with this and I have turned your Truck w/Camera demo into my MINI Clubman Physics demo http://bit.ly/tSa5L
|
|
|
Re: Physics Behaviors for Silverlight 3!
|
By Anonymous on
6/4/2010 1:59 AM
|
|
There is a game on FaceBook created using this library http://apps.facebook.com/ittiGator. Friend of mine and i coded this in very short time.
|
|
|
|
 |
|
 |
|
|