Welcome to MSDN Blogs Sign in | Join | Help

Have a happy 4th of July! Be Safe! Build a Silverlight application

Building a Silverlight Fireworks program would be just the thing.  I did my usual search for a project that already is build and found a great site that compares Flash and Silverlight, both create a fireworks display!  You get to compare the two side by side, I won’t, because I am focused on Silverlight, but if you aren’t, then take a look at the Flash code and project.

Get this great firework project at: Flash vs. Silverlight Colorful Fireworks, keep in mind that Silverlight 3.0 works outside of the browser and Flash doesn’t.

Problem and Solution

Problem: When loading the silverlight application into my VS 2010 Team System IDE, but it didn’t convert. 

System: VS2010 with Silverlight SDK 3.0

Solution: Install Silverlight SDK 2.0

Once you have installed the Silverlight SDK 2.0, which could be after you installed the Silverlight SDK 3.0 the project will run as expected.

 

An aside on Fireworks:

Fireworks were initially invented by the Chinese, and likely the medical protocol for missing hands from explosions followed shortly.    image

In the United States July the Fourth represents the date of the signing of the Declaration of Independence, although the real date might have been July 2 depending on your legal point of view.  The making of “joyous” noise and so forth slowly became a tradition, with the slow communications and independent nature of the US in the early years slowed the adoption of the fireworks and parades.

If you are going to the beach, make sure that you enter the water in a manner that allows you to check out the new environment, and all waters, except pools, are renewed everyday.  I surf quite often, but I always, and I mean always do a quick wade out to check for sandbars, etc.  Please do the same.

Fireworks are interesting since they are really the basis for our current civilization.  If we didn’t have fireworks, created by the Chinese, then wars would have been forced to be fought with arrows, rocks, and catapults.  The idea of combustion would have delayed and Carnot might not have investigated the concepts of Thermodynamics.  Exploration of the Solar System would not have happened, and now with Voyager and the Pioneer craft would not have passed the edges of the Solar System.

July 4th is an important date in American History: Signing of the Declaration of Independence is completed!

  

Bottom line: Be safe, have fun, celebrate Independence! no matter where you are, write something important.

Creating a Model Project for your game design

With some versions of VS 2010 you are able to create UML projects, if you are a student in a science, technology, engineering or math class you have access to the full version of Visual Studio 2010 Team System through MSDNAA, if you do not have access, it is because of your school administration.  Please comment on this blog and I will get back to you, I think the blog comments have emails.  Well give it a try, make sure to include your school.

 

The Model Project is a template that you select from File New Project, it then allows you to create standard UML cases.  Over the next few blog posts I will take you through the following UML cases:

image

In the next blog post I will discuss the Activity Diagram, the order of discussion is the order in the Add New Items, not the way you would normally use them,  companies vary in how they make use of the modeling diagrams.

Farseer: Water Play

Play with water at FarSeer It’s summer, and Farseer Physics guys created a fun tool to play with water, even if you are stuck in the office.  Click on the picture to go to the Farseer site.

 

This is a great example of a physics modeling the real world.  Or is it?  In cyperspace things look like they are modeled correctly, and no negative toward Farseer, it is unlikely that it really matches the real world.

 

In the real world, if a model is created without a way to confirm them using actual environments, then they can’t be trusted outside of the computer.

 

Bottom line: Modeling tools they are real only if you test them in the real world.

Best line: Farseer is awesome!  But always test your models before going into production.

XNA: Using Fonts in XNA 3.1

XNA 3.1

No difference in how to use Fonts in XNA 3.1 over XNA 2.0.  If you already know how to use text in your project, this won’t be a big help to you.  This article was written to try to look a little smarter than my previous blog may have made me look.

Using text in your XNA project

Using the previous Blog approach, was simple, but not elegant. 

It would be better to add text that indicates whether or not SpriteBatch is an abstract class or a base class.

In this case you will need to add an existing content resource to the project.  The image below shows you how to add the spritefont material to the content folder.  There is a link that gets you to a very clear way to implement text in your game project.  Over future blogs we will go over how to add text, scoring and so forth to your game. 

Follow the article on MSDN:

Use the diagram to the right to add the existing content templates, in this case Sprite Font.

image
Ok, now you have added the content resources what do you do?

First you have to construct the objects from the base or abstract classes, the objects need to build the fonts/letters and the location of the fonts/letters

construct/instantiate a SpriteFont object and in this case the object’s name is Font1

You will also need a way to place it on the gameboard. 

The way you put it on the game board is through the construction/instantiation of the class Vector2, and the object that is constructed is named FontPos.

SpriteFont is a sealed class which is a member of the Microsoft.Xna.Framework.Graphics, which is in the file named:
microsoft.xna.framework.dll



public class Game1 : Microsoft.Xna.Framework.Game
   {
       GraphicsDeviceManager graphics;
       SpriteBatch spriteBatch;

       //Add the two lines below


       SpriteFont Font1;
       Vector2 FontPos;

 

       //******************

Your code should look like:

image

Later in the code, the FontPos will be used to determine the HEIGHT and WIDTH of the pixels that make up the text that are being written on the screen

In your test of whether or not spriteBatch is abstract or a base class, this test will function to change the screen red if spriteBatch is a class, and it will stay blue if it isn’t and write the message on the screen.

image

Posted by SoCal Sam | 0 Comments
Filed under: , , ,

My XAML object doesn’t show up in my Code Behind!

Sometimes you add the name of an object, or you have built an object in Expression Blend and named it.  Then when you try to use the object in your code behind, it doesn’t appear!

 image
image
ClickMe doesn’t appear when you try to use the Code Behind!

That’s just frustrating, awful design, URGGHHHH!

Not really, you need to do a save all

 image
image
Simple: Click the Save All button as shown here

 image
image
Then, magically, you get the object name showing up like you thought it would.

Cool, nice, good.

Hope this helped out.

image
image
Posted by SoCal Sam | 0 Comments
Filed under: ,

Silverlight Games: Getting the infrastructure down by blowing it out of the browser

In the XAML AppManifest.XML file there is a bunch of arcane symbols and words.  In the previous blog I detailed the high level of how to detach the Silverlight Application.  This is an important part of the future of Silverlight, works in the browser and works out of the browser.  Build once and really use everywhere and every when.  Uggh, just getting examples for the AssemblyPart that is comprehensive is going to take awhile.  Okey dokey, here are the combined links, as you can tell it is mostly cut and paste from MSDN.  Although I did add a few comments here and there.  Anyway, mark this one for the future discussions.

<Deployment xmlns=http://schemas.microsoft.com/client/2007/deployment >

<Deployment.Parts>

          <AssemblyPart x:Name="xamlName" Source="assembly" />

</Deployment.Parts>

</Deployment>

AssemblyPart Class

An assembly part is an assembly that is to be included in a Silverlight-based application package (.xap).

AssemblyPart Members exposes these members:

AssemblyPart Constructors

    • AssemblyPart, used in managed code, not XAML
AssemblyPart Methods
 
AssemblyPart Properties
  • Dispatcher: Gets the Dispatcher this object is associated with. (Inherited from DependencyObject.) A dispatcher object  provides services for managing the queue of work items for a thread.  Cannot be directly created in an instance of XAML, it is used only in managed code. (Reference)

  • Source: Gets the Uri that identifies an assembly as an assembly part.  The value of the Source property should be the physical name of the assembly, including the .dll file extension. For example, Application.dll.

Silverlight: Blow it out of the browser and links to definitions

Here is the code you need to make Silverlight work out of the  browser.  AppManifest.xml to see the XAML code I am talking about

Delete a comment in the AppManifest.xml.  The picture tells the story.  Once you delete the comments that surround the Deployment.ApplicationIdentity object, you can right click on your application and get that out of browser experience.  No activeX control, no Java Applet, clean and simple.

That’s it.  Really. And there are a gazillion blogs out there that tell you how to do this, along with how to add icons, etc.

Not here, I want to define some of the terms like

Deployment.ApplicationIdentity

Umm, I can’t, it isn’t written up anywhere.  What does it mean, how can you find out?

Confusion.  Pain. 400 Vulcans dead.  Oh wait, back to reality.

First you need to visit http://msdn.microsoft.com, and use the search tool on that page, there is a reason not to use the general search engines like BING.  BING and those other search engines like google, ASK and so forth won’t return the random item you can find by using your eyeballs.  MSDN search (based on BING) is tuned to only look inside of the MSDN and Microsoft.com site.

I was able to locate the article: Deployment properties, here I found a reference to a property, which is different than a method, called Parts, put it together you get 

<Deployment.Parts>

This property is defined as a property that gets an object that contains information about the application that is used for out-of-browser support.

Then I looked around looking for Deployment.Application, I wanted the actual article, not blogs that basically did what I did in the initial part of this blog.  The blogs are all good stuff, but not what I was looking for, I wanted to know exactly what this deployment class is. 

The deployment class is defined as providing an application part and localization information in the application manifest when deploying a Silverlight-based application.

I found the article, and you will need to just click this link:

Deployment.ApplicationIdentity Property, because you won’t find it using ANY of the search engines as of June 9, 2009. 

Moving to the ApplicationIdentity Class, which is defined as a class that represents the information about an application that is configured for out-of-browser support.

Then to see the class members you will need this link: ApplicationIdentity Members.

Now we have the properties that we need to fully utilize the ApplicationIdentity

Name: Description

  • Blurb: Gets a short description of the application.
  • Dispatcher: Gets the Dispatcher this object is associated with. (Inherited from DependencyObject.)
  • Icons: Gets a collection of Icon instances associated with the application.
  • ShortName: Gets the short version of the application title.
  • Title: Gets the full title of the application.

Example of the ApplicationIdentity XAML use:

<ApplicationIdentity  

           ShortName="shortName"   clip_image004

           Title="title">  

<ApplicationIdentity.Blurb>     blurb   </ApplicationIdentity.Blurb>  

<ApplicationIdentity.Icons>    

<Icon Size="iconSize">   iconSource   </Icon>  

</ApplicationIdentity.Icons>

</ApplicationIdentity>

To see the correct formatting, take a look at John Papa’s MSDN article.  Next article I will clean up how to use the Deployment XAML for fun and profit!

Posted by SoCal Sam | 0 Comments

Silverlight Games: Making Silverlight 3.0 work off the internet

I wander around looking at all the shining objects that is Silverlight, I am amazed how fast the product has evolved from Silverlight 1.0 to the current imageSilverlight 3.0.  This is incredible, for instance Silverlight 3.0 applications can run on the server via the browser or directly on your computer.

And you don’t have to understand the General Theory of Electromagnetism to make it happen. 

First of all create a simple Silverlight project, after you have downloaded the Silverlight stuff for 3.0.  If everything is working correctly you should be able to run the Silverlight application, and all it has to do is be the white web page.

Note that the “Install onto this computer…” is disabled. 

Well that is different.  Next blog I’ll try to stay focused and work out how to get that “Install onto this computer…” thingie working.

But what I really want to talk about is this: Research Using Games, I found a site that does that.  It looks cool but I haven’t used it yet.  More later on this one, and it doesn’t use Silverlight, but I might be able to get the source code.  That is if that John Nordlinger can work his magic to get it!

 

That’s it, this is a teaser.  Code in the next blog, stay tuned.

Posted by SoCal Sam | 0 Comments

Serious Silverlight Games: PMP, thoughts on cancer research

One of the problems with cancer research is how to utilize single trials for research.  What that means is this: Say you have an interesting result from a patient that responds well to a drug or drug cocktail, it doesn’t count as research.  With respect to PMP, there are enough patients worldwide to constitute a research program like there is for breast cancer or prostrate cancer.

Using an approach similar to the SETI project that had people doing research on interstellar radio waves a few years ago, would it be possible to use the similar approach to doing research on PMP?

What if the serious game could implement research through play.  The components that make up the PMP or PC disease would constitute a component of the game.  Players would use the many constraints forced on the human body in the game and they would then use various approaches.  Since there are so many variables, it is difficult to use the digital programming approach to gain a solution.  Plus the cost of careful programming is quite high, and the patient count is quite low.  Let’s face, good programmers are not going to work for free, but gamers might work in solutions if it is fun.

How would you set up a game like this?  It is just an idea. 

Take a look at the use of artificial intelligence in games, in actuality the game AI usually is simply responding to the player(s) in a variable manner.  What if the AI was designed to respond like actual bacteria, cancer related viruses, and so forth.  The player would then respond using various levels of medical efforts such as drugs, etc.  The play would then be graded according to some sort of criteria that mapped to known parameters from patients that had the disease.

Other types of research, like the use of animals in medical research could be minimized through similar types of research through games.

There, that is what  I will call the idea: Research through Games.

Now where is John Nordlinger’s phone number, I need to give him a call on Monday about this idea.

Let me know what you think,  but I think this is a powerful idea! :)

Silverlight Games: Seriously, using Photosynth

imageTake a look at the NASA-Silverlight announcement about the use of Photosynth ON MARS, that’s pretty serious!  Well I have to stay focused on the PMP, Appendix Cancer game, but once I am done with that one, I definitely am going to work on a Mars Based game!  Maybe using a new development language F#.

Ok, in the previous, I did a very high level design document that discussed the audience or the people who would play the game, in th e post--Silverlight Games: Seriously

The PMP cancer impacts the ability of the patient to be able to digest food and causes other problems that are quite serious.

On the bright side, for the design of a serious game, the PMP cancer occurs in the intestines, which are tubes.  There are good components that move in the body that are twisted to evil purposes by the cancer and there is floating through the mucous membranes (or medically similar surfaces) that the avatar can move through.  All of this is EXCELLENT!  Why?  Games are easier to design that allow us to work in tubes, that allow floating, and have good versus bad cells.

Of course, the game is presenting a serious problem, but now we have a way imageto describe the problem using common terms.  Tubes, bad versus good cells, and movement can be done via floating.  We can do battle tables, boss battles and so forth.  It beats having to utilize the medical terminology, as you can see in the flow chart.

Now we need to get started. 

First off, can we use an image as a map for our game?   Can we target specific color pixel to keep our game pieces in place?  Next post.

Silverlight Games: Seriously

Seriously, my bud had PMP, Farah Fawcett has cancer down a little further down the alimentary canal.  Farah’s is tragic, but it occurs more often than the PMP, so the research is going to go after the cancer that occurs more often.  How do we prepare a game that will help the family understand an orphan disease and the hard required to survive.  I had pneumonia and thought that I was going to die, but I got over it after a week of intense antibiotics and major painkillers (I am a big baby).  Ok, I have decided to struggle with this game, I guess if the PMP patients can go through what they have to go through, I can at least stick with the game.

This is the worse way to get the numbers for my blog, I should use the keywords to attract the web crawlers, I know that Cy (he is my mentor on getting hits!) and Hilary (she is a big help as well), but I just have to stick with this.  So here we go, from “clean” paper to a game.  For once I will have to stick with it. Normally you wouldn’t decide on the technology ahead of time, but I made the decision to use Silverlight 3.0, that’s it.  If you want to create a Flash based game, let me know, I would like to present it as well.

So let’s start our game with the following requirements analysis:

Who is the audience?

  • The PMP patient
  • The patient’s family
  • Doctor’s trying to communicate efficiently with the family

What  is the purpose of the game?

  • Help the patient understand the road ahead for the cure
  • Reuse the code to demonstrate the path of the patient for the family and friends so that they can better understand how the process will impact them and their relative or friend with PMP

How will it be best presented?

  • In this case it will be presented using Silverlight 3.0 using web presentation with Silverlight videos.  As we work through the game, and it has to have a fun factor even if the subject isn’t a ton of fun

What is the message?

  • Help the patient have a tracking process of their medical procedures and planning

One of the rules of creating a game myself, I get to change the requirement analysis to map to the needs of my blog, PMP patients, and so forth.

Also, like any game, we have a deadline, the model patient is going into treatment and hopefully recovery. 

It would be nice to have something to show him prior to he gets to deep into treatment.  If you want to collaborate, I will set-up a Codeplex project to store the code and to allow collaboration.

Creating a serious game using Silverlight

Giving it some thought about a serious game around that disease PMP, something about cancer of  the appendix?  How would you tell a young child about this cancer?  Heck, how do you tell me about this type of cancer, or even a doctor that accidentally did the correct diagnosis but has no contacts on how to cure it? 

The PMP website certainly is “profssional”, or intimidating. For example the Multiple Sclerosis site uses dotNet and the PMP site doesn’t.  MS has around 250,000 people with the disease, and PMP has around 300, both fall under the orphan drug and disease.  PMP with only 300 patients a year, that is hardly enough for a medical office for the whole year! 

How would this serious game project get started? To startt:

Who is the audience?

What  is the purpose of the game?

How will it be best presented?

What is the message?

Just as any game, these are the basic questions to start off with.  The audience would be quite small, if you take all of the people who may have PMP, and say that they have 5 concerned relatives and friends each, that would be around 1500 people to view the web site.  Maybe 10% would at any time, or at all.

Pretty grim, but I think that it might still be a good idea to see if a serious can’t get this story out about PMP.

Posted by SoCal Sam | 1 Comments

Using Games to help people better understand diseases

One of my relatives  has been diagnosed with PMP, a rare type of cancer that affects your intestines.  Very serious, it is an orphan disease.  When I read about it on the web at http://pmpawareness.org/, my brain just about burst.  In the case of this disease, I would have liked to work through a serious of game levels that helped me understand how the disease functioned and how the doctors would work with my relative. 

It is really tough luck for him, the PMP strikes 1 in 1,000,000 people in the US each year.  That means that 300 people get it a year, and if you are doctor, hospital or drug company, there is just not enough patients to pay for treatment.  This means it is an orphan disease, or it means that a lot of people get it, but aren’t diagnosed with it.

In the case of the PMP disease, a serious game using Silverlight would mean that more people could know about the disease and what the medical ecology needs to get better at making these patients better.  If the disease is caught early enough AND the patient is a fighter there is a great chance of survival.

I hope that my relative makes it, and I am certain that he will.

Posted by SoCal Sam | 1 Comments

Check out the Silverlight Showcase!

image Check out the Silverlight Showcase, there is over 662 applications.  The one I like is the music note match game, see if you can find it in the applications!  There are some great business applications, and if games aren’t your thing, then you might be able to find something that you would like to improve on.

Games are coming, but not today.

Technorati Tags:
Posted by SoCal Sam | 1 Comments
Filed under:

Great video about creating Silverlight graphics

image Found a great video about creating your own pixel shaders and other graphics tools using Silverlight 3.0. Head over to http://videos.visitmix.com/MIX09/T17F, use the Zune Video, it will play in your Windows Media player, for some reason the WMV link isn’t working on May 9, 2009.  You can find the code for this great demo at: Video of "Deep Dive into SL Graphics"

Just got back from the ACM Foundation of Digital Game Cruise and it was great!  More in future posts.

Got some great ideas about game stories using Silverlight.  But for now, if you want to view really lame Flash games, check out the Star Trek Movie site, as absolutely awesome movie, and games so lame why play them.  The use of Flash games on the Star Trek movie site is truly using 20th century technology in the 21st century.  Silverlight is so much better for the developer, with the ability to use the programming language I want, not just Actionscript, but rather any of the .NET languages.  Silverlight was designed from the ground up to be multi-browser, multi-OS, where as Adobe just recently modified the aging Actionscript and Flash to function in browsers on multiple OS.  Silverlight is tight with XML via the XAML tools and through the Visual Web Developer Express, you can develop full commercial games for no cost to you.  If you are a student you can get Expression through Dreamspark or MSDNAA.

Get up to speed, learn Silverlight and build games.  I am working to create a series of coherent posts (how unusual) that will lead you to building and posting your first game.  It will take a couple of weeks, but stay tuned.

More Posts Next page »
 
Page view tracker