Freestyle Coding

Programming in the Real World

  Home  |   Contact  |   Syndication    |   Login
  22 Posts | 0 Stories | 8 Comments | 0 Trackbacks

News

Twitter












Tag Cloud


Archives

Post Categories

Charity

Conferences

Professional

Projects

Social Networks

Tuesday, March 13, 2012 #

I will begin this in the traditional, blunt fashion that you've come to expect from me.

I am an idiot.
There. I said it. I'm not a proud man. I can admit when I invoke my inner moron.

Now, ask you, why all this build up? Simple, remember that impression of the Visual Studio 11 Beta from last week? You see, it turns out, I didn't install the Visual Studio 11 Beta that was released a few weeks ago. I installed the Visual Studio 11 Developer's Preview from last September.

It was a simple mistake. A fine mix of fatigue, multitasking, and Google auto-complete managed to put something that looked reasonable in the result list. However, this led me to give the Beta an unfair shake.

When I installed the actual Beta, the install happened fine. My simple little "Hello, World" program ran with incident.

I will say that I hate the new interface. I mean, i really hate the new interface. I hate the new interface so much, that, if they still existed, I would use the blink and marquee on the word hate. That's a lot of hate.

My beef with the new interface is the complete lack of definition. I can deal with a lack of color. Expression's interface does suck, it's just bland. However, the various components of the 11 Beta lack any discernible definition. You are simply assaulted by a constant barrage of either light grey or dark grey.

Now, these are merely first impressions. I still need to go through all the settings with a fine tooth comb. However, I still have to finish preparing for Code PaLOUsa this week. When I get the time, I will report back to you.

Speaking of which, there are a few more tickets left for Code PaLOUsa. This weekend in downtown Louisville. Come the the XNA, stay for the NCAA tournament. OR, if you're like me, Come for the XNA, stay to see the Mythbusters at the Louisville Palace on Sunday evening. Tickets are still available...


Tuesday, March 06, 2012 #

I decided to download and install the Windows 8 and Visual Studio 11 previews. I figured I had an Acer Inspire One netbook that BARELY met min specs that was holding down paper (as on does with an Acer netbook....)

I will not tell you about the installation of Win8. This is because I had my brother download and install it. I will say that he had already downloaded and created the install package on a USB drive. I gave him the netbook at 1PM. He sent me a text saying it was done at 5PM. To me, that's pretty good.

I booted the machine and watched as it booted extremely quickly. I waited a reasonable period of time while my mouse driver downloaded and installed. I clicked the "Store" icon that was top left in the WinRT start menu. In response, I was immediately informed "This app can't open. The screen resolution is too low for this app to run." Apparently, WinRT requires a minimum screen resolution of 1024x768. The max screen resolution of the netbook is 1024x600.

A little more clicking confirms that 1024x768 is the minimum screen resolution for every WinRT application. IE would not open. I eventually click to "Desktop" box and get to the old school desktop. The old school desktop has a shortcut for IE. This shortcut opens, and IE works are expected.

Before moving on, I want to address one thing. This concludes my discussion of WinRT. Besides the resolution issues, there is something else I wish to address. I found using WinRT useless without a touch screen. The entire interface was very annoying to my when using a traditional pointing device. I could see the advantages if I had a touch screen device. To this effect, I have been looking for an ultrabook with a touch screen for about 6 months now. Let this be a warning to hardware manufacturers. You might want to get some of those out ready for release.

With my Win7 desktop and IE, I proceed to download and install the Visual Studio 11 Beta. The download and install was seamless. I started that process at about 9AM this morning, and it completed at about 11AM. This includes a full install on VS11 and a full download and install of all the documentation.

After tweaking a few settings, I open a new C# Command Line project. I add the following code:

Console.WriteLine( "Hello, World" );
Console.ReadKey();

I pressed f5, and I was greeted with roughly the following error: "You need .NET 4.5. Click to download and install." I click to download and install, only to be greeted with a message telling me .NET 4.5 was installed.

No amount or combination of rebooting, configuring, or profanity seemed to solved this issue.

Sorry, Microsoft. It was a great try. You get a C for effort. See you in the next update.

UPDATE:It appears the I gave Visual Studio an unfair shake. I installed the wrong version. However, I refuse to edit my impressions; They were my honest impressions. The actual Beta works. You can see my impressions of the Beta, and not the 6 months old Developer's Preview, here.


Saturday, February 18, 2012 #

I had a few minutes of free time at the Windows Phone Garage. During that time, I created the Statistics object for Card Roulette.

Of course, all it does is count the types of cards in a deck. With this I can create the statistics on a draw. It is a little bit of a brute force approach. However, it's also somethign that can be cleaned later if I need some inprovements.

Filed under: something is better than nothing.


Friday, February 17, 2012 #

I made some tweaks to Card Roulette. I added some quick interface code so I could make sure the Decks and Cards were working as expected. This lead to the addition of the ability of to add a card to a deck. Otherwise, you can't put a card in a discard pile. I also added a ToString for a PlayingCard.

I would pound through some more code, but I need to prepare for tomorrow. What's tomorrow, you ask? Well, remember yesterday when I mentioned the Windows Phone Garage in Birmingham, Alabama? That is tomorrow.

There is still time to join us for a day of WP7 goodness. I'll be helping people put XNA in tiny places.

good times ... good times.


Thursday, February 16, 2012 #

Well, hello there. I have returned after 5 months of radio silence. Those of you that follow me on Twitter or G+ know that my wife and I welcomed a new child in mid-December, which explains most of my disappearance. I wanted to return with some global blog news, speaking updates, etc. Thus, without further ado...

Let us begin with Card Roulette. No, I have not forgotten about it. I haven't posted about it in awhile, but I have been playing with the requirements. If you have been following the actual CodePlex project, you'd see that I do tweak things on there from time to time. Expect full fledged progress on that soon.

The reason Card Roulette development got pushed back some is two-fold. The first is that my main PC at home died, which has now been replaced with a new "desktop-replacement" laptop and 23" 3D monitor. This directly leads to the second reason. I've been playing around with creating XNA games with Stereoscopic 3D graphics. I am pleased to say that my proof of concept tests have been successful. I will some be posting content from these tests. I've also proposed some sessions about Stereoscopic 3D to a few conferences, most notably CodeStock and DevLink. If you'd like to see this content, let the organizers know.

Speaking of speaking, I do have a few upcoming engagements. I will be at the Windows Phone Garage in Birmingham, AL this weekend. I should be at the Alabama Code Camp on March 10th in Troy, Alabama. I have it on good faith that I'll be presenting there, but official session lists have not been announced. The weekend after that, I will be at Code PaLOUsa in Louisville, KY. I have sessions submitted for the aforementioned CodeStock and DevLink. If you want me to speak at your user's group, hit me up at the Ineta link in the sidebar.

I have been selected to be a GeeksWithBlogs Influencer. Hopefully, this will help draw some new eyes to my little slice of the internet. If this is true, then you may be a new reader. If THAT is true, then I will supply extra greetings to you ... Greetings. If you are an existing reader, then I want to thank you for reading. The collective collection of eyeballs that grace this place is what made that little honor possible.

On a final note, my day job has tasked me with formalizing our development process. This is made me VERY philosophical about project management. I'm sure you'll get a few rambles on this in the coming months.

With that, I'll let you people get back you your lives. As always, if there is something you'd like me to address, just leave a comment or email me. I'm just as happy rambling about your topic as I am rambling about mine.


Friday, October 14, 2011 #

Ok, people it's crunch time.  In less than 24 hours, I begin my epic journey towards enlightenment.

I know what you're saying.  Big deal, you're just playing games for 24 hours. To which I say, yes.  For 24 hours, straight...

I don't know how many of you have actually tried to do something for 24 hours straight, but let me tell you. ANYTHING for 24 hours straight becomes obstacle. I may just be playing Kinect Adventures at 4AM just to stay awake.

And nobody wants that...

So please, think of the children. I know if anything happened to my daughter, I'd wish for a miracle. Why not pad those odds now? Think of it like an indulgence, without the fall of the Catholic Church...

So please, find a little something and donate.

Tell your friends.
Tell your mama.
Tell your friend's mama.

Do the right thing.

www.extra-life.org/index.cfm


Tuesday, October 04, 2011 #

Before I begin with the Milestone 1 recap, I have a few things I need to announce. To begin with, we need to help some kids!

Every year, I participate in Extra Life. It's a charity that raises money for hospitals that are members of the Children's Miracle Network. I'm looking for sponsors. You can visit my donation page at http://www.extra-life.org/index.cfm?fuseaction=donorDrive.participant&eventID=501&participantID=4554. If you feel funny about not giving to your local CMN hospital, then I won't be mad if you want to search for someone raising money for your local hospital. All donations are 100% tax-deductable, and all 100% of the money goes to the hospital. So, let's do some good. I'll keep a link to the donations page in the Link section of the site.

Next, I have a few speaking engagements. As of right now, I'm booked for Tuesday, October 11 at the Huntsville, AL User's Group. Then, I have a little tour developing for the beginning of November. Right now, I have New Orleans on the 8th of November and Mobile, AL, on the 10th of November. A few other groups are talking about adding in. All of these will be some sort of XNA talk, so show up, support, and learn.

Now, on to the good stuff. I cranked out Milestone 1 last night. The primary goal of Milestone 1 was to create a set of objects and interfaces that could replicate a deck of cards. I tried to do a combination of intelligent design that covers all the bases and just programming what I need.

First, let's get the quickies out of the way. The Ranks and Suits enumerations are very straight forward. The only thing strange about them was the inclusion of a Joker as a rank. If you do a little research on cards, you'll see there is some historical basis for this. I did a little forethought, and calling a Joker a Spade and Heart can make my life a little easier later. It is worth noting that a generic library would have to abstract the Ranks and Suits enumerations. However, those are the only ones I needed for now.

The ICard and IDeck were made generic to help with future ideas. The only thing every "card" has is something on the front and something on the back. Think of a Flash Card, and you'll get the idea. That's why I put one layer between the ICard and the IPlayingCard. Likewise, I went pretty minimal with an IDeck. There are a lot of things you could do with a deck of cards. I thought about the things I needed for this project and only included those. I did base it on IEnumerable. Simple fact is that you might want to just look through the deck.

Now, let's get to the heavy issues. I want to start with the PokerCard. It is a concrete implementation of the IPlayingCard. I decided to make it an internal object. The idea was that a PokerCard comes from a PokerDeck. You have to get a deck of cards to get an official card. This did not come without consequence. I originally wanted to make an implicit cast from PokerCard to PokerDeck. The idea was that a card is a deck with one item. However, you can't create a cast from PokerCard to PokerDeck because the output object is more accessible than the input object. Then, you can't create a cast from IPlayingCard to PokerDeck because the input of an implicit cast can't be an interface. That's is why the PokerDeck includes a version of Merge that takes an IPlayingCard.

This brings us to the PokerDeck. My hope was to keep the entire implementation internal. That's why I do some strange things, such as have Draw( int ) call Draw() "int" times. I also decided to make the PokerDeck a class. Usually, XNA begs for something like this to be a struct. However, most of the time, we want to pass these things around and treat them like the reference they are. That is why merge drains one deck when it creates the other. Because of this, I need to be careful when I let these things go out of scope.

The final remark is back to the way the PokerDeck creates the PokerCards. I don't have the artwork right now, so I faked the Texture2Ds for the time being. Art is not my strong suit. Since I can defer the art for now, I decided to do it. This will come back up later, but not until I'm ready to actually start rendering cards.

This should make a pretty good port-mortem on this section. Please, question away. I'm sure I forgot something.


Wednesday, September 28, 2011 #

The time has come to begin the project. I am pleased to announce Card Roulette. All posts on the topic will include the tag "Card Roulette".

The concept is fairly simple. One day, I was watching a biography of the man that invented the theory of card counting in Black Jack. While I was impressed with the math, I always felt that it was misleading. You're not really counting card, just keeping a few simple statistics. This nagged on me for a few weeks until I came up with the concept of playing Roulette with a deck of cards. If you can count every card in the deck, you can place the exact high bet for the final card.

I have always thought this was a great idea. This is your first rule of an indie game. Come up with a single, great idea. You won't have the time or resources for War and Peace. When I was getting my philosophy degree, we had a saying that floated around the liberal arts building. If you want to have your work accepted, you can either do something old in a new way, or something new in an old way. People need some thread of familiarity to be comfortable with something. My idea borrows a few other concepts that people recognize. Furthermore, it exercises an ability that people might find a value.

I chose to host the project at CodePlex. The reason was simple. It integrated with Visual Studio. I don't get every feature of Team Foundation Server, but I get enough to manage the project. I figure anyone programming with XNA has to use Visual Studio. As such, it will be helpful to anyone that wants to follow the project. The link to the project is http://cardroulette.codeplex.com. There is also a link to the project page in the links section of the blog.

I am licensing the project with a GPLv2 license. My original intent was to find a license that prohibited commercial uses of the code. However, that license doesn't exist. This lead me to the GPL. If you're going to steal the idea or code, you have to give it back. I fully intend to re-license everything to a completely open license when everything is finished. I just want to maintain the integrity of the idea for now.

The design document is checked-in with the source code. It's a fairly simple Word document. It wasn't meant to be complete at this point. It is a living document that will get refined as the project progresses. For example, I mention that there needs be a few levels of AI players. However, there are no details. When I get there, I can add the specifics. However, I did add enough information to list the intentions of the design. This should help limit scope creep. I can refine the features in the document, but I shouldn't add new features.

The design document lists a dozen milestones. I have created a TFS task for each milestone. As I list the specific features of the task, I can make them dependent on the Task. When I complete all the features and fix all the bugs, I can close the Task. When I close the task, I've reached the milestone. When all 12 milestones are close, the game will be released to the Xbox Live Indie Games Marketplace.

This is a major project for one guy. Keep in mind that I have a day job, (growing) family, and graduate school. As such, progress may be a little slow. Much like recursion, we are going to eat the elephant by taking a bite and then eating the rest of the elephant. Not only to I want to teach you guys how to use XNA, I want to show how a little planning and forethought can make the task manageable.


Tuesday, September 20, 2011 #

Hey guys. I need to take a moment, break the fourth wall, and address the readers. First, I have another speaking engagement. I will be giving a full 2 hour workshop on XNA at the Huntsville New Technology User's Group meeting on October 11 at 6PM. We'll take a little break at 7 and pizza will be provided. Full details and directions can be found at huntug.org.

I have not forgotten about "the project." The design document is done. It got tied up with the corporate lawyer, who wanted to make sure we didn't give away an idea that will allow other people to profit before we can. Basically, he's making me look for an open source license to put on the project that says other people can't take the idea for profit until I finish the project. Once I get that done, I'm going to post it with a stub for the project on CodePlex. I decided on CodePlex because of the TFS integration. Hey, we have to use Visual Studio, anyway...

We should have the URL up soon. I registered freestylecoding.com quite some time ago. However, our DNS provider is being extremely goofy right now. Soon, the blog will be available as blog.freestylecoding.com. Then, we'll get other extensions as necessary.

I believe that does it. I should have the design doc and project stub up soon. Until then, happy coding.


Thursday, September 15, 2011 #

This had me pulling my hair out for a couple days:

byte[] _A = new byte[64];
// Fill _A with some meaningful, valid data.

byte[] _B = new byte[_A.Length];
_A.CopyTo( _B, 0 );

if( !_A.Equals( _B ) ) {
throw new WtfException(
"It appears object.Equals doesn't work on arrays of value types..."
);
}

Yes, that throws the WtfException. It took me a few days to notice. byte is a ValueType. However, byte[] is a System.Array, which is a reference type. As per the .NET documenation:

The default implementation of Equals supports reference equality for reference types, and bitwise equality for value types. Reference equality means the object references that are compared refer to the same object. Bitwise equality means the objects that are compared have the same binary representation.

_A and _B are not references to the same array. Thus, they are not equal. You need to make something like this:

private static bool ValueTypeArraysAreEqual( Array p_lhs, Array p_rhs ) {
if( p_lhs == null ) {
return p_rhs == null;
}

if( p_rhs == null ) {
return false;
}

if( p_lhs.Length != p_rhs.Length ) {
return false;
}

return Parallel.For( 0, p_lhs.Length, ( _lcv, loopState ) => {
if( !p_lhs.GetValue( _lcv ).Equals( p_rhs.GetValue( _lcv ) ) ) {
loopState.Break();
}
} ).IsCompleted;
}

I use object.Equal in the loops because I'm compairing the ValueTypes that the Loop contains. The use of System.Threading.Tasks.Parallel helps me move things along a little quicker. Parallel.For returns an struct that tells you whether the loop was halted. If I never halted the loop with loopState.Break, then they all matched. If, for some reason, you can't use Parallel.For, just do a for loop that returns false;