7. June 2008 by Mads

Finally Silverlight 2 beta 2 was released. It seems it includes alot of cool new features.

Read more on ScottGu's blog 

24. May 2008 by Mads

Today I came across an interesting website, Casual Game Design. I reading the article about coming up with game ideas right now at it's pretty good. Therefore I just thought I would post an little blog entry about this. I have also added the rss feed of the website to my blogroll.

12. May 2008 by Mads

In this sample you learn one way to capture keyboard inputs, react on them by applying force to an object and that way control the object in the game. Again this sample is a simplified version of the code from the original Farseer Physics Engine demo code.

You can download the source here.
And you can see the it running in your browser here.

Feel free to leave a comment if you got any questions.

Enjoy :) 

27. April 2008 by Mads

Today when I looked at my blog, I saw a blog post telling that the site was hacked!

The entry is now removed and passwords are changed. Let's hope it doesn't happen again! And if anybody out there has a "BlogEngine.NET" blog system, keep an eye on it.

If you use version 1.3.0.0 of BlogEngine get the patch to fix the security issue from here.

6. April 2008 by Mads

NOTE: I'm so sorry I don't have a code parser on my blog at the moment. This means that the code doesn't look very good. I'm working on an codeparser, but just can't find a working one at the moment. So I desided to do the post, and then clean up the source code in it later. 

In a comment to my blog post about PopTheBubble on silverlight.ne, Jason Schluter asked me for the code to the hi-score in the game. So here goes.

The hi-score actually works pretty simple. The game has a Service reference to a WebService, which lives on the web server ofcause (remember the game lives in the users browser). When the Hi-score UserControl is loaded in the Silverlight application (the game), calls a method called "GetScore" to retrieve the top-50 scores/players. When you type in your name and click submit, another method is called on the WebService to save your score. The score is persisted in an xml file on the server.

HiScore.xaml:

    public partial class HiScore : UserControl
    {
        private int score;
        private ServiceReference1.BubbleHiScoreSoapClient scoreClient;

        public HiScore()
        {
            InitializeComponent();
            score = 0;

            //Hook up with WebService
            scoreClient = new PopTheBubble.ServiceReference1.BubbleHiScoreSoapClient();
            scoreClient.GetScoresCompleted += new EventHandler<PopTheBubble.ServiceReference1.GetScoresCompletedEventArgs>(scoreClient_GetScoresCompleted);
            scoreClient.SaveScoreCompleted += new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(scoreClient_SaveScoreCompleted);
        }

        public void UpdateScore()
        {
            scoreClient.GetScoresAsync();
        }


        public int Score
        {
            get { return this.score; }
            set
            {
                hiScoreTextBlock.Text = "Your score: " + value;
                this.score = value;
            }
        }

        protected void scoreClient_SaveScoreCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
        {
            UpdateScore();
        }

        protected void scoreClient_GetScoresCompleted(object sender, PopTheBubble.ServiceReference1.GetScoresCompletedEventArgs e)
        {
            hiscoreDataGrid.ItemsSource = e.Result;
        }

        private void submitScoreButton_Click(object sender, RoutedEventArgs e)
        {
            if (!playerNameTextbox.Text.ToLower().Equals("type your name...") && playerNameTextbox.Text != "")
                scoreClient.SaveScoreAsync(playerNameTextbox.Text, score);
        }
    }

 

HiScore.asmx 

        [WebMethod]
        public void SaveScore(string name, int score)
        {
           //Saves the score into a xml file. Original code has been removed.
        }

        [WebMethod]
        public List<HiScoreEntry> GetScores()
        {
            //Get the top-50 hiscores from the xml file. Original code has been removed.
        }

As you can see it's pretty simple, but not very secure. You don't need to be a state-of-the-art hacker to figure out how to cheat here, but this was not my focus with this game. The code in the WebService is just normal C# code reading/writing from an xml file. Please post a comment if you have any questions.

1. April 2008 by Mads

UPDATE: Please note that there is a new release of this for Silverlight Beta 2: Check it out here.

When you are doing game development you sometimes wants to spice up the game with some physics. To do this from scratch, you need to be pretty good at math and have a lot of spare time. Lucky for us Silverlight Game Developers, Jeff Weber from Farseer Games, created a little engine to help us out. It's called the Farseer Physics Engine.

Currently the latest release is 1.0.0.5 which supports Silverlight 2 beta 1. This is the release used in this sample.

Getting started 

I am new to the Farseer engine myself, and have been looking on the internet for a, "Getting started with Farseer" tutorial, with out any luck. Therefore I desided to create my own. The release of the engine comes with some pretty nice demos, that shows you how to use the engine. The only problem is, that the code is pretty complex at first sight, which could make some people give up. 

Therefore I have created this tiny project to show you how to make the engine run in the simplest form possible. The code should be pretty self-explaining. If you want to know alittle more about why the diffent things are done, you can read on Andy Beaulieu blog, which has a starting tutorial too. The only problem is thats it's for Silverlight 1.1 Alpha and therefore alittle outdated, but the basic things are the same as far as I can see. 

(As I said, I'm new to the engine also, so this can maybe be done even more simpler. If you  have some changes, please let me know. You can use the "Contact" here on the page and send me and email through that. Thanks in advance.)

You can download the source here.
And you can see the it running in your browser here. 

I hope you have a better idea of how to get the engine to work after looking through the source code.

Happy coding! 

Please note: The Silverlight 2 beta 1 currectly have a "region bug" when you position the elements. If you are running with US region settings, there should be no problem, but if you, like me, run with Danish Region settings, this sample will crash at first sight. So to be able to see/run this, you need to set your region settings to English (United States). This works for me.

28. March 2008 by Mads

Some days ago a submitted my "PopTheBubble" game to Silverlight.net. I thought it would be a great source of inspiration, as this game is the outcome of a hands-on-lab tutorial from silverlight.net.

At the moment you can see it in the Silverlight.net Gallery  

This has been my first "learning" project, both for learning Silverlight 2 but also learning alittle about game development in Silverlight 2. Learning/getting started projects like this normally doesn't have the most sweet code and structure, which is why I haven't published the source code for it.

24. March 2008 by Mads

I got my first "game" finished today. I added a WebService to the project, to save scores in an XML file. As this is my first Silverlight project, it is very bad/ugly coded and structured, which is why I won't publish the source code for this.

 

Gameplay 

The gameplay is very simple. You need to pop (by moving the needle into the bubble) as many bubbles as you can within 30 seconds. You don't need to click to pop the bubble, just move the mouse(needle) over it. 

Play! 

23. March 2008 by Mads

To run silverlight applications on your host, you need to setup two MIME-Types:

Extension: .xap
Content Type: application/x-silverlight-app

Extension: .xaml
Content Type: application/xaml+xml

- Enjoy!

22. March 2008 by Mads

Due to some issues at my host, some of my websites, including Laumania.net has been down for some days. Laumania.net seems to be up and running again now, but there is still some issues with some of my other sites.

During my down time, I were investegating the possiblities of hosting my sites from home. I have a ok connection and computer to run as a server, no problem there. My biggest problem is email hosting. I don't want to run my own email server, as I can't be sure to have a 100 % uptime here at home. This is accepable for a website, if it's down a little while from time to time. But email can't be down, as I will loose emails then. 

A solution to this could be Google Apps. I tryed it out yesterday, and it seems to work great! I used laumania.net as my first test domain, and it runs nicely!

First you have to create an account with a domain. Then you have to verify that you own the domain. After that you have to do some DNS changes for your domain, and then you are running. So all emails to my laumania.net domain now is recieved by google and put into my "semi" gmail account. 

Read more about how it's working on the link above.