SpriteHand
Module Border
  Most recent blog entries
Module Border
Data Visualization with Physics
Andy's Blog By Andy Beaulieu on 2/14/2009 3:43 PM

Data Visualization is a hot topic right now, and understandably so. It seems that a diverse amount of data is being collected for every aspect of human life, and RIA technology is being used to create new ways of interpreting and using that data.One interesting Data Visualization project using Silverlight is the Descry Project which contains several open source visualizations which are available on Codeplex.

Along these lines, I had an idea to make a standard bar graph a bit more interesting by using physics to have a kind of "Bucket Graph" where symbols drop into "buckets." This adds absolutely no value to the interpretation of the data, but I thought is would make a cool visual effect. So here is what I came up with:

[DOWNLOAD SOURCE CODE]

[VIEW DEMO]

Comments (4)

Silverlight Game Programming Contest
Andy's Blog By Andy Beaulieu on 2/12/2009 7:33 AM

Get your game on, there is another great Silverlight Game Programming Contest, this one from Server Quest with a $5000 booty!

Game programming is a fun way to get started with learning Silverlight, and the chance to win $5k is an added bonus. For those of you that are new to Silverlight Game Programming, here are a couple of links to get you started:

Getting Started with Silverlight Game Development: A list of resources I compiled for game development in Silverlight.

Physics Helper Library for Silverlight, Blend and Farseer: A library of controls to get you past the burn with adding Physics to your game.

Comments (0)

Another Surface and Physics Helper/Farseer Project
Andy's Blog By Andy Beaulieu on 2/4/2009 1:56 PM

Wow, two Surface posts in one day?!

On the heels of my last post, Tiago Andrade e Silva has been working on a port of the Physics Helper Library and Farseer to WPF and Microsoft Surface (obligatory video below). In chatting with Tiago, he is willing to collaborate on getting his WPF port of the Physics Helper on the Codeplex site (more info coming soon!)

Comments (3)

Surface-like Demo of Physics Helper + Farseer
Andy's Blog By Andy Beaulieu on 2/3/2009 9:27 PM

I stumbled upon this neat video of a project using a Microsoft Surface-like multitouch interface along with the Physics Helper library and Farseer Physics engine. Pretty cool!

Comments (3)

Silverlight for Interactive CD/DVD
Andy's Blog By Andy Beaulieu on 1/11/2009 9:29 PM

Back in the day before broadband internet access, it was quite common to distribute Flash applications on CD or DVD along with large video files and interactive content. This was the only practical way for users to view video because internet connection speeds were too slow for streaming video.

But even today, there is still a demand for Interactive content on CD – a couple of examples that come to mind are educational software and media distributed at conferences and trade shows. Silverlight is an attractive option for interactive media, because of its quick adoption rate and small runtime install. So what if we wanted to use Silverlight as a solution for an Interactive CD?

There are a few ways we could go about this, including using a Stand-Alone Silverlight solution such as Desklighter. Or, we could use an HTML Application (HTA) – which is the approach I took for a recent project. An HTA is really just an HTML file, renamed to have an .HTA extension, and with optional embedded tags to control things such as Window Title, Menus, and Icon. Oh, and an HTA is a trusted application, so it can get access to the client operating system unlike a normal HTML page in a browser.

[DOWNLOAD SAMPLE CODE]

THE INGREDIENTS

1.       A Silverlight Application, compiled to a XAP.

2.       An HTML test page pointing to the Silverlight XAP (the testpage HTML file generated by Silverlight Tools for Visual Studio will work fine). Rename this file’s extension to .HTA so that it can be launched as an HTML Application (after renaming the file you can test launch it by double-clicking the HTA file). You can also add optional HTA attributes inside the section of your HTML to control things such as Window appearance and menus. An example Application tag is shown below, and you can find all of the HTA attributes here.

BORDER="Thin"
CAPTION="yes"
APPLICATIONNAME="Hello Silverlight DVD"
MAXIMIZEBUTTON="yes"
MINIMIZEBUTTON="yes"
SINGLEINSTANCE="yes"
SHOWINTASKBAR="yes"
SYSMENU="yes"
SCROLL="no"
SELECTION="no"
WINDOWSTATE="normal"/>

3.       An autorun.inf file.  This will allow us to “AutoPlay” the Silverlight application on CD or DVD. Autorun.inf is a simple text file with an [autorun] section containing the name of an Executable file to launch and an optional icon file to show:

[autorun]
OPEN=ShellExecuteWin.exe
ICON=setup.ico

* The important thing to note here is that the Autorun OPEN setting MUST point to an EXE file. We cannot point directly to our HTA file for launching.

4.       A small executable file to launch the HTA application (see note above). Since we want to keep our runtime requirements to a minimum, a wise choice for this little “bootstrap” EXE is Visual C++.  We can use Visual Studio 2008 to create a Win32 Project and add a call to ShellExecute, which allows us to launch another application:

ShellExecute(NULL,_T("open"),_T("AutoRunTestPage.hta"),_T(""),_T(""), 0 );

NOTE that the sample download includes the Visual C++ Project to save you some grief. But if you need to create your own VC++ launcher, remember these notes:

a.       You need to add includes to windows.h and shellapi.h

b.      In order to avoid dependencies on runtime DLLs which may not be present on a client’s system, you want to statically link. To do this, select Project Properties and select C/C++ and then Code Generation and make sure to select Runtime Library= Multithreaded (/MT)

THE SAMPLE DOWNLOAD

The download ZIP contains a sample implementation of a Silverlight HTA application with Autorun for CD/DVD. If you look in the DistributionFiles directory, you will see these files:

1.       AutoRunSilverlight.xap is our Silverlight Application

2.       AutoRunTestPage.hta is our HTML Application, containing the Silverlight App Reference

3.       Autorun.inf is our Autorun configuration file

4.       ShellExecuteWin.exe is our EXE launcher, created in C++ and using ShellExecute to launch the HTA

To complete the CD, you just need to burn these files onto the root folder of a disk. When a user inserts the disk, their experience will vary depending on their Autoplay settings in Control Panel.

Comments (8)

Blend and Silverlight with VS Dev Web Server
Andy's Blog By Andy Beaulieu on 1/5/2009 8:56 PM

Recently I was working with a designer on a Silverlight project that accessed a WCF web service. We discovered that the project would work fine when launched from Visual Studio, but when launched from Expression Blend, it would fail on web service calls. As a coder, I generally run and debug from inside Visual Studio and only hop into Blend to do quick design, so I had never seen this issue before.

As it turns out, it's an issue with how Blend and Visual Studio interact with the Cassini Development Web Server. If you've done much Web Service development with Silverlight, you've probably learned that it's a good practice to set a static port value for the Development Web Service so that the port doesn't change between runs and cause errors.

To set a static port, you select Project/Properties in VS and then select the "Specific Port" option like below:

Unforunately (and here is where the problem lies), Blend does not honor this setting. So if you run your project from Blend (using F5 or the Project/Test Solution menu option), Blend will start a new instance of the Cassini Web Server on a different port, and web service calls will subsequently fail.

Fortunately, there is a pretty easy work-around for this problem. Since the WCF web services we call usually live in the same relative path as our Silverlight application, we can use the Url of the Silverlight application to compute the location of the WCF web service.

First we add a small method to get a relative resource (such as a WCF .svc file) based on the source location of our Silverlight app:

public static string GetUrlForResource(string resourcePage)
{
    string webUrl = System.Windows.Browser.HtmlPage.Document.DocumentUri.ToString();

    string containerPage = webUrl.Substring(webUrl.LastIndexOf("/") + 1);

    webUrl = webUrl.Replace(containerPage, resourcePage);

 

    return webUrl;

}

Then we can use this method to get the relative path of the WCF service (this will conveniently include the Port of the development web server), and create a manual binding to this Url:

string webServiceUrl = GetUrlForResource("MyService.svc");

System.ServiceModel.BasicHttpBinding binding = new System.ServiceModel.BasicHttpBinding();

webSvc = new MyService.MyServiceClient(binding, new System.ServiceModel.EndpointAddress(webServiceUrl));

 

This is actually a good practice for other reasons too, such as switching between environments like test/beta/production - which I alluded to in a previous blog post.

 

Comments (2)

Happy New Year!
Andy's Blog By Andy Beaulieu on 1/1/2009 11:21 PM

Wow, what a great way to start off 2009 --- I'm honored to have received an MVP Award for the first time, for my work with Silverlight! If you're unfamiliar with the MVP program, you can learn more about it here.

I'm really excited about what Silverlight brings to web development, both present and future, and am looking forward to all the great things we'll see in 2009!

 

Comments (8)

MIX 10k Smart Coding Contest
Andy's Blog By Andy Beaulieu on 12/22/2008 7:34 AM

The MIX 10k Contest asks, "What could you create for the Web if you only had 10 kilobytes of code?" ... and offers some great booty to the winners: the Grand Prize is a pass into MIX, 3 nights at the Venetian, and a $1500 Visa Gift Card!

Given the possibility of such fortune and glory, I couldn't pass up making an entry into the 10k. I created a little game reminiscent of Kaboom! but with a little twist: it uses the FlickR Public Feed to get recent photos with certain tags. The object is to catch all of the falling photos into your photo album. The neat thing about using the FlickR photos is that they do not increase the 10k size since they're provided from a web service. Also, the FlickR photos make the little game dynamic because they change constantly.

Shameless Plug: I NEED YOUR VOTE!
Go to the submission page and Rate it Up! The community prize is based solely on community votes.

For more info on the 10k contest:

Comments (0)

Physics Helper now supports Farseer 2.0!
Andy's Blog By Andy Beaulieu on 12/21/2008 8:53 PM

The Physics Helper Library for Blend and Silverlight (more info here) now supports Farseer 2.0! Thanks to Ian Qvist (aka Genbox on the Farseer Project), I was able to resolve the tunneling issues with Farseer 2.0.

You can get the update (1.0.0.4) on the Physics Helper Codeplex site.

If you are using Farseer 2.0 outside of the Physics Helper controls and are seeing similar issues with tunneling (objects passing through each other and becoming "stuck"), then you might also want to try Ian Qvist's suggested fix:

In PhysicsSimulator.cs - change line 63/64 to the following:

internal int maxContactsToDetect = 10;
internal int maxContactsToResolve = 4;

Thanks Ian!

Comments (0)

Physics Helper Beta 3
Andy's Blog By Andy Beaulieu on 12/15/2008 7:17 PM

Today a new version of the Physics Helper library was released to CodePlex. This version adds a Camera Controller class and a couple of new demos: Camera with Rag Doll and Camera with Truck

Overview

The Physics Helper for Blend and Silverlight contains several user controls which allow you to draw objects in Expression Blend 2, and have those objects translated directly into Physics objects using the Farseer Physics Engine. You can even add Joints to your creations to create wheels and connect limbs. This can be a great timesaver for creating games, as it is traditionally difficult to line up underlying physics geometries with your Blend artwork.

Intro Video

Watch this short video to see how easy it can be to design physics using Blend 2, Silverlight, and the Physics Helper controls:

LAUNCH VIDEO (please give the video a few moments to display)

Download

Download from Codeplex (includes source and demos below)

Enter Feedback/Discuss on Codeplex

Demos

These demos were created with minimal or no coding using the Physics Helper (click images to launch demos):

Egg on a Hill Car on a ramp
Simple Physics Game Rag Doll
Camera with Rag Doll Camera with Vehicle

What's New in Beta 3

1. A new Camera Controller has been added. Drop the Camera Controller on the same Canvas as your Physics Controller, and set the Body property to the object you want the Camera to follow. You can also optionally set ScrollSpeed and ZoomSpeed.

2. Two new demos have been added to show the Camera Controller in action.

3. Various other API changes and improvements

Known Issues

1. Elements that you want to have translated into Physics objects at run time must exist on the same Canvas as the Physics Controller. In the case of UserControls that are added dynamically, you need to have 1 instance of the UserControl on the Canvas at run time - other instances can be added through code.

2.  If you rotate or otherwise transform an object in Blend, the object will lose that rotation when running, and the Boundary determination will be incorrect.

3. This version does not work with Farseer Physics 2.0. I found that Farseer 2.0 has more tunneling issues (objects passing through each other and getting "stuck") when used with the Physics Helper, so I am sticking with Farseer 1.x for now. You can easily enough update the project to Farseer 2.0 if you need to (add a reference to the new Farseer assembly, and Resolve any namespace changes).

Comments (8)

Module Border Module Border
Module Border
  Subscribe
Module Border
RSS   Twitter
Module Border Module Border
Module Border
  Diversions
Module Border

TALKING RAGDOLL
This Windows Phone 7 App was created using Silverlight, the  Physics Helper Library,  and the Farseer Physics Engine. It gets interesting when you import your friends photos and have your way with them!

MORE INFO



DROPPYPOP
This Windows Phone 7 game was created using Silverlight, the  Physics Helper Library,  and the Farseer Physics Engine.
DEMO

MORE INFO



BOSS LAUNCH
This physics game won first place in the Server Quest Contest. Created using Silverlight 2, the Physics Helper Library,  and the Farseer Physics Engine.
PLAY IT

MORE INFO



DESTROY ALL INVADERS
A scrolling shooter game where the objective is to destroy the invading UFO's flying over a neighborhood of your choosing. Imagery provided by Microsoft Virtual Earth. Created using Silverlight 2.
PLAY IT

INFO AND CODE



PHYSICS HELPER DEMOS
These demos were created for the Physics Helper Library, which makes it easy to create physics games and simulations using Expression Blend, Silverlight, and the Farseer Physics Engine.
PLAY IT

INFO AND CODE



HOOK SHOT
This little basketball game took first place in the TeamZoneSports Silverlight Contest. Created using Silverlight 2 and the Farseer Physics engine.
PLAY IT

MORE INFO



SORT THE FOOBARS
A game where you need to sort the good foobars from the bad ones. Created using Silverlight 2 and the Farseer Physics engine.
PLAY IT

MORE INFO



POLYGON PHYSICS DEMO
A demo showing polygon physics where the user draws physics objects with the mouse. Created using Silverlight 2 and the Farseer Physics engine.
PLAY IT

MORE INFO



SILVERLIGHT ROCKS!
Destroy the asteroids before they destroy your ship! Created using Silverlight 2.
PLAY IT

INFO AND CODE



FISH GAME
A simple game of harpoon-the-fish. Written using the AJAX Sprite Toolkit.
PLAY IT

INFO AND CODE

Module Border Module Border
Module Border
  Search_Blog
Module Border
Module Border Module Border
Module Border
  Blog_Archive
Module Border
Module Border Module Border
Copyright (c) 2013 andy.beaulieu.com - Login