XMLpitstop.com   |  VBnetexpert.com   |  Community Credit  
 
 
Pitstop Search:  
in
 
Sign in | Join | Help
 
 
  Blog
    Home  
 
  Entries By Date
 
<May 2008>
SunMonTueWedThuFriSat
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567
 
 
  Blog Categories
   
 
  Archives
    August 2008 (1)  
    June 2008 (4)  
    May 2008 (2)  
    April 2008 (3)  
    March 2008 (3)  
    February 2008 (5)  
    December 2007 (4)  
    November 2007 (1)  
    October 2007 (3)  
 
  Syndication
    RSS  
    Atom  
    Comments RSS  

May 2008 - Posts

  .NET Flea Market  
 

A new fun project

As most everyone should know, the Zune is doing games now.  XNA games, that is.  Well, I'm no XNA person, but I suspect I should be able to write a DLL in .NET for someone who does write XNA to implement.

So I kicked around that idea for a while and wondered, what should I write?  Today it just kind of came to me: a Wizardry clone - a generic adventure game.  I'd written text based adventures many years ago in BASIC, so the concepts and program structure were pretty familiar to me.  So I sat down with a piece of paper and sketched out some objects.

I didn't want to get overwhelmed in the design phase and end up discovering I couldn't do what I wanted and wind up discouraged, so I started with the map concept.  I decided every location would be an object.  It needed to know what direction the exits were and the position of the location on the map.  To keep size to a minimum, I compressed these to two integers (or shorts if I get really desperate).  I added an extra integer for special flags, like dark or pit or poison.

Then I map a map object which is just a collection of map locations.  Actually a dictionary, so I can look up map locations quickly using the position value.

So I sketched out on grid paper a couple of corridors.  I manually calculated the exit and position values and put them in the code.  Then I wrote a quick test app to move from location to location using buttons.  It worked on the first try!

Feeling good about that, I made a quick form where I could draw a map on a panel and generate the map values, then immediately "walk through" the map.  That worked without a hitch too!

So I'm pretty thrilled that I've been able to get this far in only a couple of hours.  Anymore it seems like I spend forever on design, or start something only to find that it's just way too big to tackle, or just lose interest midway through.

Yay, me.

 
 
 
 

Testing Windows Live Writer

This is going to be a test of how Windows Live Writer works with my blog on SOAPitStop.  So far, most of seems pretty good.  The web layout function doesn't really honor line wrapping, so I'll just compose in normal view.

I also downloaded a plugin to format code.  Let's test that out.  Here's a bit of code that posts an NNTP message to an Exchange newsgroup server (config is a custom class I wrote.  It should be easy to figure out what it does and what's in it):

    Sub SendNNTP(ByVal newsgroup As String, ByVal from As String, ByVal subject As String, ByVal body As String)
        Dim c As CDO.Configuration
        Dim m As CDO.Message

        c = New CDO.Configuration
        With c

            .Fields(CDO.CdoConfiguration.cdoPostUsingMethod).Value = CDO.CdoPostUsing.cdoPostUsingPort
            .Fields(CDO.CdoConfiguration.cdoNNTPServer).Value = config.destinationServer.NewsgroupServer
            Select Case config.destinationServer.AuthMethod
                Case ServerConfig.AuthMethods.Basic
                    .Fields(CDO.CdoConfiguration.cdoNNTPAuthenticate).Value = CDO.CdoProtocolsAuthentication.cdoBasic
                    .Fields(CDO.CdoConfiguration.cdoPostUserName).Value = config.destinationServer.UserName
                    .Fields(CDO.CdoConfiguration.cdoPostPassword).Value = config.destinationServer.Password

                Case ServerConfig.AuthMethods.NTLM
                    .Fields(CDO.CdoConfiguration.cdoNNTPAuthenticate).Value = CDO.CdoProtocolsAuthentication.cdoNTLM

                Case ServerConfig.AuthMethods.None
                    ' Nothing

            End Select
            .Fields.Update()
        End With

        Try
            m = New CDO.Message
            With m
                .Configuration = c
                .Newsgroups = newsgroup
                .From = from
                .Subject = subject
                .TextBody = body
                .Post()
            End With

        Catch ex As System.runtime.InteropServices.COMException
            If ex.Message.IndexOf("Article Rejected -- No such groups") > -1 Then
                Console.WriteLine("Error sending mesage: No such group on destination server")
                Exit Try
            End If

            Console.WriteLine("Error sending message: " & ex.Message)

        End Try

    End Sub

That's not too bad, I guess.  Now maybe I can blog a little bit easier since I don't have to log in, write my post, manually reformat it to HTML, then post it.

 
 
 

 
Copyright © . All Rights Reserved.
Powered by Community Server (Commercial Edition), by Telligent Systems