Archive for the ‘Silverlight’ Category

Sneak Peek at Next WP7 Game and the future…

Tuesday, December 28th, 2010

Been working very hard on a new Windows Phone 7 game, and at the same time I have pushed two new versions of Hanoi.  I have to admit that I am not doing a very good job at keeping this blog in the loop on what is going on with everything.  With that said, I am going to make 2011 my new attempt at trying to keep things more updated.

To the left is a sneak peek at the new game, it should be out very shortly.  Its about 75% completed, its fully functional, I only need to add some polish to the main menu, etc. If you can guess what it is from that then you definitely get some brownie points! ;)

This will be the last game that I write for a bit, I am going to focus on productivity and business applications for Windows Phone 7  at which point I may switch back and forth between the two of them.  I am also looking into Appcelerator to do some Android and iPhone work.  I have done Objective-C iPhone work in the past, but its pretty time consuming and I have been an Appcelerator beta tester for as before the company even existed but never really used any of their products.

Windows Phone 7 User Agents

Friday, November 19th, 2010

I ran into an issue where I needed to check for a Windows Phone 7 user agent, turns out however, each device has its own unique user agent.  Here are the following user agents I have been able to muster up so far, as of 03/24/2011:

Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0) Asus;Galaxy6
Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0) HTC;WP7
Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0; Microsoft Corporation; CEPC)
Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0) LG;LG-E900
Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0; LG; GW910)
Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0) SAMSUNG;SGH-i707
Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0; SAMSUNG; Taylor)
Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0; TOSHIBA; TSUNAGI)
Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0; SAMSUNG; SGH-i917)
Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0; LG; GW910)
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; XBLWP7; ZuneWP7)
Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0) LG;LG-E900h)
Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0; LG; LG-E900)

If you find any additional ones, post in the comments and I will add it!

Update: For Mango devices and for best practices around using the User Agent string from Windows Phone 7 please read the following Blog post from Microsoft.

WP7 Lessons Learned Part 1: Using IsTrial() Properly

Friday, November 12th, 2010

If you are developing for Windows Phone 7, and planning on publishing to the marketplace it is a good idea to support a trial mode of your product.  You will get a much wider audience if you support trial than if you don’t, Microsoft themselves said they found it increased sales and drove further demand.  In this post I am going to discuss how I went about implementing IsTrial following the Microsoft best practices, how I setup my development environment to make it extremely easy to switch between testing my game in trial mode and paid mode and other best practices to follow.

First and foremost, when using IsTrial() you should be aware of the Microsoft best practices as follows are some generalized ones:

  • Do not rely on usage time limited trials to protect your application’s value.
    Typically, it is best to protect the value of your full mode application by limiting trial access to key code paths. A user may uninstall and retry an application without restriction so a trial design that offers full mode behavior for a limited time provides only inconvenience as a barrier to reuse.
  • Cache license state if you check trial state frequently.
    Note that the IsTrial() and the Guide.IsTrialMode methods are designed to be event-driven. A typical call takes approximately 60 milliseconds or more.
  • Check the IsTrial() state when your application loads or resumes.
    You can avoid some potential trial design flaws especially if you cache the IsTrial() state.
  • Provide a way for users to buy your trial application before the end-of-trial.
  • Make sure that you help users understand why they want to buy your application, perhaps, by implementing your trial limit at a point in the application where they will naturally want more.
    For example, let users experience the first level of game play and require them to purchase the application to play higher levels, retain points, or to connect to a gaming service.

See the Microsoft site for more details.

One of the most important things to pay attention to here is where they state you should “Cache the IsTrial() state..”, since each call to IsTrial() could take up to 60 milliseconds if you call this in a loop or if you call this method often it could potentially affect performance of your application.  It may also cause your application to fail certification if they later enforce restrictions on calling this method a number of times.

For instance in my applicaiton Hanoi, I call IsTrial() one time on startup, and one time on resume.  That’s it, the rest of the time I am reading a cached value and I have found this to be extremely useful.  Here is how I have implemented my version of a Cached version IsTrial().

Here is the following code snippet for how to set it up in your App.cs:

public partial class App : Application    {
public static bool IsTrial = true;

private static void LoadIsTrial()
{
IsTrial = new LicenseInformation().IsTrial();

#if DEBUG_TRIAL
IsTrial = true;
#endif
}

private void Application_Launching(object sender, LaunchingEventArgs e)
{
LoadIsTrial();
}

private void Application_Activated(object sender, ActivatedEventArgs e)
{
LoadIsTrial();
}
}

Now in my opinion, this is very elegant because to access the cached variable all you need to do is App.IsTrial and you are accessing the cached version of IsTrial instead of calling the method, and you are guaranteed to have an up to date value.  Next as you may have noticed is I have some #if #endif statements in their, which is what makes debugging this a breeze, also note that when this gets compiled in release mode anything inside those lines will get optimized out of the final code, so theres no chance it will ever run.  I also assumed the IsTrial cached version is equal to True, I do this to play it safe in the event that something does go wrong the user will get the benefit of the doubt.

Below is how to setup Visual Studio so you can easily switch between Trial and Paid:

Note: If you are walking through you may notice I have already setup mine called “Debug_Trial”, just ignore that and follow along with the screen shots.

The first thing you need to do is open up the Configuration Manager in Visual Studio, so click on the drop down where it says “Debug” or “Release” and click “Configuration Manager”

Next, in the configuration manager there is another drop down listing all of the Active Solution Configurations, click on “<New…>”

Next, change the “Copy settings from:” drop down to “Debug” or “Release” whichever one you are creating.  If you are creating a profile to test IsTrial in debug mode than select debug and vice versa, then give it a name. I chose Debug_Trial.

Last but least, since this probably the most important step.  Go to the properties of your project, click the “Configuration” drop down and select the configuration you just created.  Then paste into the “Conditional compilation symbols” box “DEBUG_TRIAL” as it appears above, make sure there is a space between SILVERLIGHT and no leading space.

Now when you need to test your Trial mode, just go to the configuration menu select the “Debug_Trial” and then hit F5 or click Run.  If you want to test the paid, just change it to “Debug” and do the same.  This is the easiest way to implement this that I have found.  Requires nearly zero code, and once you have this setup you never have to touch it again!

Hanoi for WP7 Final Release

Tuesday, October 12th, 2010

After a lot of work, and still more work work down the road the final release of Towers of Hanoi is nearly complete!  A ton of new features have been added and I have a lot of features planned for future releases, I was going to try and submit early into the early access program that Microsoft is offering but I recently decided to go ahead and add the next wave of features to it for final release!

So what will Hanoi have for its final release?

  • 50+ high definition professional backgrounds
  • Theme support for the backgrounds so you can display Winter or Summer or both types of imagery
  • Rich settings support so you can control exactly how you want the game to work, you can turn off the toolbar, adjust how often the background rotates, disable sounds, etc.
  • High definition ambient background music (can be disabled in settings)
  • Speed Hanoi which can be enabled in settings (disabled by default), which allows you to tap the disc and then tap the destination instead of having to drag it.  This is for those who are trying to get the quickest times possible!
  • Time Trials with count down timer for each level so you can best your previous times
  • Local High Scores
  • Ability to select which level you want to play

It will be available for $0.99 USD and will have a Trial Mode, the trial version will be limited to basics.

Trial Version

  • 7 Levels (7 discs)
  • 7 high definition backgrounds (will not rotate during levels, only 1 per level)
  • Local high scores
  • Can not select level to play, must progress from each level

Future Versions

  • Worldwide High Scores so you can compete with other people from around the world
  • Profiles so you can setup different game styles such as “Relaxing” and “Competitive”
  • Different styles and colors of discs and shelves to choose such as marble or metal materials
  • Import your own photos to use as background images, and import your own sounds to use for background music

I will be posting a new video, and screen shots of everything very soon as these new additions progress so keep in touch!

Quick preview of Tic-Tac-Toe for WP7

Tuesday, August 3rd, 2010

So I have been working on lots of Windows Phone 7 games and applications, and so far all of them I plan to sell, albeit cheaply like .99 cents or something around there, but I wanted to make a free one as well just to kind of give something to the community.  So I decided to write a Tic-Tac-Toe game, but I wanted to spruce it up a bit so I put my Photoshop skills to work and I have come up with the following.  This is a quick preview, the game is near completion actually I just need to start putting the bits and pieces together.  If you are curious its play against the computer only right now, the AI is done using MiniMax with some tweaks to make it slightly dumb so you can can actually win a game or two and the computer seems very intelligent at decision making.

I’ll probably add multiple chalk colors and such to make it more fun, this game is obviously aimed at the younger crowd but adults can still have fun with it as well!

Take a look at one my other Windows Phone 7 Games I posted called Towers of Hanoi!

Towers of Hanoi for Windows Phone 7

Saturday, June 26th, 2010

So I have been developing a couple Windows Phone 7 Applications in Silverlight in anticipation for the October release of the phone, below is a preview of the first game I have written that is a Towers of Hanoi game.  It was relatively easy to do, only took me total of 2 weeks development time and that was with 2 full time clients at the same time.  I could have easily pulled this off in 3-4 days time, which just goes to show you the sheer amount of power that Silverlight is offering up here on this platform!

So what do you think?  I am going to slowly add features to it overtime but this is the final version of this game.  I have 3 other applications that I am working on for Windows Phone 7 with the goal of release 4 fully fledged apps by October.  Not all of them are games, but most of them will end up probably being games for the time being.

Update: I forgot to mention that I borrowed a bunch of concepts for this game from one of my favorite iPhone Towers of Hanoi games by NimbleBit. If you have an iPhone I seriously recommend getting that version as its awesome!

Expression Blend 4 RTM Issue w/Windows Phone 7

Saturday, June 19th, 2010

If you are doing Windows Phone 7 development and have the Blend Add-in for Windows Phone 7 Preview 2, Blend SDK for Windows Phone 7 Preview 2 and Windows Phone 7 Tools SDK installed, and are trying to use Expression Blend 4 RTM it will not work.  When you open Expression Blend 4 it will throw an error saying it can not load the extension, and if you view the results tab it will show the following error:

Could not load file or assembly ‘Microsoft.Expression.Framework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35′ or one of its dependencies.

I tried everything to get this to work, but in the end I was forced to uninstall the RTM version of Expression Blend 4 and install the Expression Blend 4 RC version instead and it works like a charm?  This seems odd, and it also seems pretty messed up, I think Microsoft should make this issue very clear on their Windows Phone 7 Developer site otherwise it is extremely misleading, especially since the only version of Expression Blend 4 available through MSDN is the RTM version!

AgileDash Business Plan

Friday, May 28th, 2010

AgileDash, our flagship product which is an Agile project management tool which we be capable of running in multiple platforms.  The first platform AgileDash will be available on is Microsoft SharePoint, which we are naming AgileDash SP.  AgileDash SP was originally planned to be released for the new and powerful Microsoft SharePoint 2010 platform.  However, as much as I want to develop against SharePoint 2010, most people and potential customers are still using 2007 and they will be for the near future.  There are several reasons for this, the main reason is that SharePoint 2010 is 64 bit only.  This is a good thing since it gives 2010 the ability to be more powerful by being able to scale vertically as well as horizontally.  This also comes with a price to pay that a lot of customers are running 32 bit hardware still, they have heavy investments in this hardware and it will take time for them to convert over.

Now with all of that said, this was not a light decision on our part.  SharePoint 2010 offered a rich client API for us to develop against with Silverlight and jQuery.  SharePoint 2007 however does not offer this, and its extremely difficult to develop against when it comes to client side applications, in particular rich interface applications such as Silverlight.  I ran across something that changed my decision drastically, Marc D Anderson has been working on a jQuery framework called SPServices that acts as a proxy to the SharePoint 2007 web services that lets you easily and naturally program against.  He is actively developing this framework and it supports a large degree of functionality.  I plan on working closely with Marc to develop and get this framework working in Silverlight.

I plan to start testing several scenarios in Silverlight calling out to the SPService jQuery library immediately.   I will be posting about my findings on how this is working, what the performance is like, etc.

Silverlight or JQuery

Thursday, February 25th, 2010

Establishing the criteria for a new application is a hard thing, if you choose poorly you may not contend well against your competition.  However, if you choose right, or choose something that will let you be unique you may stand a chance.  That is the decision I had to make, do I want to use Silverlight 3 which is completely new to me, or do I use JQuery which I have substantially more experience using.  I want to offer a rich user experience, but I also do not want to slow the user down.  I have already looked at adoption rates for Silverlight worldwide we are looking at 41% as of January 2010.  That is pretty substantial but no where near 100%, or 90% which is where Flash/Flex is currently.

Normally the choice between Silverlight and JQuery won’t be as ubiquitous as it is here, they server different purposes, but their feature set does overlap in several areas.  Silverlight offers a very rich user experience, and a very powerful subsystem, being able to utilize the .NET Framework.  You do not get the full framework, but you do get a pretty substantial subset of it.

The difficult choice I have is can I accept the fact that users have to download a plugin?  Can I also accept the fact that in some rare instances Silverlight can be sluggish from my experience, since it relies on the client to render.  While both rely on the client, in most cases I have never found JQuery to be that bad, additionally there is a pretty big upfront cost for choosing Silverlight.  The Silverlight package must be downloaded to the client, there are some techniques out there to optimize this by only loading what you need to up front and then loading the rest later when its needed, etc.  Lastly there is the problem that Silverlight does not support Linux, and has some hacked support for Google Chrome which I have found mixed results with, but the majority of the time it works.

I think ultimately my decision is going to be to rely on the JQuery Framework and its rich UI plugins.  I have experience with this, and the ASP.NET MVC stuff works well with it.  Also since I am going to rely on Windows Azure as the hosting platform, if I chose Silverlight I would have to build a messaging system using WCF so that Silverlight could talk to the Azure Platform API’s since they do not at this time have an API set that works with Silverlight.  I feel like I am limited a bit using JQuery and HTML however, so I may use a mix of the two for certain situations when the need arises.