XNA 3D Primer Published – Get a free copy!

XNA 3D Primer by Michael C. Neel In June of 2006 I officially became a professional author when ASP.NET Pro published my article “Google Can You Hear Me?”.  (So eager was I to be published I submitted my code in VB!).  Now I’m proud to announce Wrox has published “XNA 3D Primer” as a Wrox Blox (aka eBook).

Why did I write this book?  Truth be told, I’ve always admired technical book authors that can teach not only the how, but the why of a subject.  It’s no secret I’m a fan of Charles Petzold; ever since I read “Programming Windows 95” (my first Windows version that I wrote applications for) I’ve wanted to join the ranks of great technical authors.  I of course am not there yet – this is my first book and I kept it simple by writing a 40 page ebook.

Who did I write this book for?  A book is nothing without an audience.  This book is written for the line-of-business application developer who is curious about writing 3D games using XNA.  XNA is Microsoft’s platform for game development and includes a .Net based managed framework that can be run on Windows PCs and the Xbox 360.  You can even sell your games over Xbox Live Indie Games.  Some experience with XNA is expected, but not more than working though the getting started beginner’s guides.

What does this book cover?  The book is a surface tour of 3D programming.  When I first started 3D programming I felt like all the documentation was in Latin.  None of the lingo made sense, and I had trouble just figuring out what I needed to search on.  The book covers the basics of 3D space and the core math you’ll use over and over again.  It then moves on to handling the camera, working with 3D models, collision detection, and ends with methods to animate 3D models.  None of these topics are covered in great depth, but I found touching each one gives the “full picture” to the parts of a 3D game.  Think of this book more as a guided safari instead of a full expedition into the jungles of XNA 3D.

You said free copy? Yes, though this free copy isn’t without cost.

First, you can buy XNA 3D Primer from Wrox for $6.99 (this is cheaper than my “free” offer below).

Since this is my first published book I wanted to do something special.  Initially I was going to donate the money I earned from the book (which isn’t much – this was written for pleasure not profit) to Child’s Play.  What is Child’s Play?  In their own words:

Since 2003, over 100,000 gamers worldwide have banded together through Child’s Play, a community based charity grown and nurtured from the game culture and industry. Over 5 million dollars in donations of toys, games, books and cash for sick kids in children’s hospitals across North America and the world have been collected since our inception.

This year, we have continued expanding across the country and the globe. With almost 70 partner hospitals and more arriving every month, you can be sure to find one from the map above that needs your help! You can choose to purchase requested items from their online retailer wish lists, or make a cash donation that helps out Child’s Play hospitals everywhere. Any items purchased through Amazon will be shipped directly to your hospital of choice, so please be sure to select their shipping address rather than your own.

When gamers give back, it makes a difference!

Then I stole got an idea from Seth.  Instead of giving the money outright, I offer to anyone interested to make a $30.00 (or more) donation to Child’s Play.  Then email me the receipt and I’ll send you a free copy of XNA 3D Primer.  You’re making the donation, so you get to take the tax deduction and you get the good feeling that comes when giving a donation.

When I explained the idea to my publisher, Wrox, not only did they love it, they offered to pitch in.  On my own I would have been able to give away 50 copies of my book; Wrox has doubled this so I can give away 100!

So, the steps are:

  • Go to http://www.childsplaycharity.org/ and click the PayPal donate link (just under the map)
  • Donate $30 (or more)
  • Email the PayPal reciept to michael.neel+xna@gmail.com (yes, there is a plus sign in the email)
  • I will email you a (DRM-free) PDF of XNA 3D Primer (please give me a day or so, the process is manual)

Once these 100 copies are gone, that’s it – I’ll update this post with the remaining copies and the total raised for Child’s Play. 

Posted By Mike On Tuesday, January 26, 2010
Filed under book developer xna | No Comments

FuncWorks studio gets video

54950837 For an upcoming FuncWorks project I needed to see how feasible recording with a green screen would be and merging that video with output from an Xbox 360.

This turned out to be much easier and cheaper than I imagined, which is awesome for the project!

A green screen is nothing more than a green background that later in editing software is replaced with another image or video.  This has been used by everyone from your local weather man to the high end bullet time effect of The Matrix.  I only needed the weather man level of capability.

The hardware: a camcorder, a green surface that’s not very reflective, and a bunch of lights.  For the Xbox 360 I used a Hava Wireless HD which does good job capturing  Xbox 360.  Though it has a wireless option, I’m using a hard wire connection to cut down the risk of dropped frames.

Lighting the green screen is the crucial step.  The green screen needs to be 1) lit evenly 2) have no shadows cast on it from the subject and 3) not reflect green light back on the subject.  As you can see from the photo I was not going for perfect on these steps, I just need some workable footage for my main concern: affordable video editing software.

I’m happy to report the $80 Adobe Premiere Elements 8 (PE8) has everything needed to edit and encode video for even the advanced home studio.  There are two options in Elements for working with a green screen: Green Screen Effect and Chroma Key Effect.  The Green Screen Effect is really a simple version of the Chroma Key Effect and the one I went with to start.  It required no tweaking on my part, it just found and removed the green screen from the video.  Chroma Key has many more options and can be used with any color, and as I learn more of the tool I’ll probably switch to using it to get a better end result (my test project left me with a slight green halo – an artifact common when you are too close to the green screen).

The last part of the test was the upload.  I’ve tried Vimeo in the past, and I’m impressed with their quality over YouTube, plus YouTube limits HD videos to 10 minutes.  A quick search on Vimeo site and I found a list of recommended encoder settings for getting the best quality, and a user’s blog post on Vimeo and Elements.

The final result I uploaded to Vimeo and Youtube to compare.  We’ll probably upload to both, as YouTube has traffic and a social aspect Vimeo lacks, and use Vimeo for embedding high quality version on the project’s site.  I’ve embedded Vimeo’s result below, but since I’m still using a free account I can’t embed the HD version – You’ll need to click through to the site to see it.


Green Screen / Xbox Test

Posted By Mike On Tuesday, January 05, 2010
Filed under video xbox funcworks | Comments (1)

ASP.NET: Creating a UserControl with Child Content

square-peg-round-hole-21 by Yoel Ben-AvrahamI love ASP.NET User Controls, aka “ascx” files.  These little guys are great for reusable content and dividing up the components of a website.  The little brother of the more powerful Custom Server Control, they have some limitations, but I’ve found they are often sold short.  Once falsehood is that a User Control cannot contain content between the opening and closing tags, like such:

<MyControls:ContentBlock runat="server" Title="The Control has Content!">
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
    Donec ut nisi sed elit aliquam vulputate eu et lacus</p>
    <asp:HyperLink runat="server" NavigateUrl="~/">Home</asp:HyperLink>
</MyControls:ContentBlock>

If you attempt something like this with a stock User Control you’ll get “Type 'ASP.mycontent_contentblock_ascx' does not have a public property named 'p'.”  If we just want to have a simple control that formats the content, then we only need a few tweaks and we can keep the User Control (if you have more advanced needs, then it’s time to step up to a Custom Server Control).

The first tweak is to wrap the ascx template in a single control:

<%@ Control Language="C#" AutoEventWireup="true" 
    CodeFile="ContentBlock.ascx.cs" Inherits="MyControl_ContentBlock" %>
<asp:PlaceHolder ID="phContent" runat="server">
    <h1>
        <%= Title %>
    </h1>
    <div class="body">
        <%= Text %>
    </div>
</asp:PlaceHolder>

I choose a PlaceHolder control because it won’t emit any HTML.  Then in code-behind we need to make a few tweaks:

[ParseChildren(false)]
public partial class MyContent_ContentBlock : System.Web.UI.UserControl
{
    public String Title { get; set; }
    protected String Text { get; set; }

    protected override void AddParsedSubObject(object obj) {
        if (obj is LiteralControl) 
            this.Text += ((LiteralControl)obj).Text;

        else if (obj is PlaceHolder && !String.IsNullOrEmpty(((PlaceHolder)obj).ID) 
            && ((PlaceHolder)obj).ID.Equals("phContent")) 
            base.AddParsedSubObject(obj);

        else {
            StringBuilder sb = new StringBuilder();
            using (StringWriter sw = new StringWriter(sb)) {
                using (HtmlTextWriter w = new HtmlTextWriter(sw)) {
                    ((Control)obj).RenderControl(w);
                    this.Text += sb.ToString();
                }
            }
        }
    }
}

The class gets a new attribute, ParseChildren, set to false.  I’m stealing this attribute from the Custom Server Control which normally would use this attribute to map the child content to a property.  Setting it to false however on a User Control will stop the framework from throwing an error on the User Control.  If you stop here, the output of the control would look something like:

<h1>
    The Control has Content!
</h1>
<div class="body">
</div>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
Donec ut nisi sed elit aliquam vulputate eu et lacus</p>
<a href="/Default.aspx">Home</a>

The content was appended to the User Control template.  This can be fixed by overriding the AddParsedSubObject method.  This method is called for every control in the User Control – including the PlaceHolder that acts as our template.  Any HTML content is converted into a LiteralControl.  The logic checks the control being passed in, and if it’s a LiteralControl the text is added to the control’s Text property.  If the control is the PlaceHolder it is passed to the base method to let normal processing takeover.  The remaining controls are rendered, and the text appended to the control’s Text property.  Technically I don’t need the special case for LiteralControls, since the last case will handle it, but it’s the common case and worth saving the additional CPU cycles required to use the RenderControl method.

We now have the proper output:

<h1>
    The Control has Content!
</h1>
<div class="body">
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
    Donec ut nisi sed elit aliquam vulputate eu et lacus</p>
    <a href="/Default.aspx">Home</a>
</div>

There is a gotcha with this approach (beyond advanced data binding and postback issues you may encounter) – the following code will botch the output:

<MyControls:ContentBlock runat="server">
    <%= DateTime.Now %>
</MyControls:ContentBlock>

Simply put, Code Blocks change the way controls get processed.  Wrapping Code Blocks in another server control will work around this problem:

<MyControls:ContentBlock runat="server">
    <asp:PlaceHolder runat="server"><%= DateTime.Now %></asp:PlaceHolder>
</MyControls:ContentBlock>

Now that you have this new power, promise me you’ll only use it where proper and create a Custom Server Control when needed.

Promise?

Posted By Mike On Tuesday, December 08, 2009
Filed under asp.net usercontrol | No Comments

R.I.P. IncaBlocks: 10/14/2009 – 10/24/2009

IncaSalesThe depressing chart to the left represents our recently released game IncaBlocks.  The blue line is trial downloads, and the red line is purchases.  The game is currently #518 out of 557 on the bestselling list of Xbox Live Indie Games (XBLIG).  The best stat I can mention is we are 3 places behind one of the all time bestselling XBLIG titles “I MAED A GAM3 W1TH Z0MB1ES!!!1” if you sort alphabetically.  I believe I have the credit of releasing the worst game ever on the Xbox 360, a modern day E.T.!

Our conversion rate is a respectable 5%, but on 10/22 we were no longer on the XBLIG New Releases list, and you can see from the days following what not being on the list means for downloads.  Rating wise we are holding a 2.5/5 with 59 votes, and have two not bad / not great reviews at gaygamer.net and xblig.co.uk.

This was our first game, so the only way I’d call it a complete failure is if we didn’t learn from the experience.  I think the biggest lesson here is understanding there is no traffic in the XBLIG’s section.  It’s been said you only find the section when messing around drunk, and surprisingly relying upon drunks is a poor business plan.  Microsoft never makes mention of the section anywhere else on the Xbox, and while Major Nelson will blog about each new Rock Band song, there will only be a weekly footnote on top sales list for XBLIG.

Still, with a vortex of suckage to rival the Large Hadron Collider black hole generation, this can hardly account for a fraction of our non-existent sales.  I have a few guess why trial downloads are so low.  The best would be this is not the type of game that players who do visit the XBLIG section like to play, and that those who would like it aren’t aware of or looking at the XBLIG section.  To be blunt, no one is interested.  A second idea is the name, box art, and screenshots do not create interest.  (The game play video isn’t listed on the official site, just the creator webpage).

We also contacted the sites known to review XBLIG games after release.  Since you cannot predict when your game will pass review and be released (this can be anywhere from 1 to 4 weeks), this seemed like a good choice.  It wasn’t.  Most of the review sites have a back log of games to review, so you need to get on that list early for the chance of reviews timed with release.  It also wouldn’t hurt to send out teaser press releases and videos to review sites – they may not publish them, but your game will be in their minds come release.

This experience hasn’t changed our desire to create more games for XBLIG.  The view from the bottom might be a factor in our future titles.  When your below every screensaver, massage app, and geometry wars clone, ideas enter your mind that otherwise wouldn’t:

In honor of hitting rock bottom, here are 15 codes to save you the 80 Ballmer Bucks ($1 USD) and get a free copy of IncaBlocks.  They are one use only codes, so the first person to use the code will deactivate the code for anyone else.  Given how bad this game is, I’d say there is no rush on trying a code!

B93TV-QGK7Y-B9Q6M-WH9DB-QQDG3
D7H3Q-KY3C6-MD8R4-7KVVW-B24DG
Q3XPX-JDX2B-82343-2T4F9-6G3G8
DX9GH-2BX6G-XF36V-6JQR8-JJT7B
HQQ3D-FFKYF-WR7VT-G2HGV-BH8X3
VHTVY-HHGDQ-WFQ83-WXX39-DBWX6
XQJW7-WGJYJ-TYVH4-DJQYF-PT3HJ
HXCQ2-B3X9C-XFGWV-XK2M7-KMWYB
F7GYX-4WKJQ-GPQHM-DF8TF-TYWYD
PMP94-KKYYG-YRRHQ-3J7YH-H3YQ6
GMR4F-BGFCG-F3HQX-GVFVV-TDPMJ
PDJXT-DC2HH-YKV2D-HGJG6-XVMRB
DKVF7-VKQ62-MQMP7-F9PRJ-GYWYQ
P36QW-TRMQB-THV7M-MD99M-QQDH6
BMFG4-YJ7VW-6QK8V-46HW4-TYWYW

(I don’t know when a specific code has been used, so I won’t be able to cross them off – if you use one, leave a comment to let others  know which one it was).

Posted By Mike On Sunday, October 25, 2009
Filed under funcworks feelthefunc xna | Comments (12)

IncaBlocks Released, Thanks AgileZen and Kanban!

Box_coverFuncWorks, LLC’s first XNA game, IncaBlocks, is now available on Xbox Live Indie Games (XBLIG)!

This game represents the many hours and weekends Dylan, Cicelie and myself worked the past several months.  Looking back at SVN, I started this as a side project to ROCS around July 30th.  Shortly thereafter we decided to put ROCS on hold and make IncaBlocks the first game we would release.  Keeping with our belief in over delivering, we priced IncaBlocks at 80 Points ($1.00).

Game play is pretty simple – stack blocks following some rules, and the one with the most blocks on top at the end wins.  I recorded a short video of a game to help everyone check it out (there is also a free trial version on Xbox):

IncaBlocks was also the first project that we made heavy use of Kanban and AgileZen.  Kanban is an idea I’ve loved in theory for a while, but hadn’t had the chance to use it on a real project (meaning a project with a deadline).  We used both the online board at AgileZen, and a real board in my office.  Nate and Nicole have done an awesome job with AgileZen, and in my not-so-humble opinion have a better project management system than Basecamp.  As with Ninject, Nate has a knack for stripping away the excess and leaving only the good parts. 

That said, you cannot beat the feeling of a physical Kanban board.  Moving a work item physically through the project flow gives one a great sense of accomplishment.  We stuck to two basic rules of the board: first, you can only have one task in progress at a time, and second, you must take a task, once started, all the way to done.  I think at least 3 times I “reset” the board and moved tasks around in the ready columns to change priority.  This allowed us to keep a high velocity while reacting to change (considering this was our first XNA game to be release, we had many changes as a result of just learning XNA and XBLIG worked).  While we pruned the done items from AgileZen, we left them all up on the wall:

Don't you have a Fender Stat in your office too?

We already have ideas for our next games, though I will have to take a break from game development while I work on an ebook for Wrox.  The working title is “XNA 3D Primer”, and will be a crash course in 3D game programming.  I also plan to do some post mortem posts on IncaBlocks and the lessons we learned along the way.

Posted By Mike On Wednesday, October 14, 2009
Filed under agile xbox feelthefunc xna | No Comments

About Me

Michael C. Neel, born 1976 in Houston, TX and now live in Knoxvile, TN. Software developer, currently .Net focused. Board member and President of ETNUG, and organizes CodeStock, East Tennessee's annual developers conference. .Net speaker, a Microsoft ASP.NET MVP and ASPInsider. Founder of FuncWorks, LLC and Feel The Func podcast.

Proud father of two amazing girls, Rachel and Hannah.

 Subscribe to ViNull.com |  Comments

Follow me on Twitter | Contact Me

FeelTheFunc Podcast

CodeStock
Are you going?

ASPInsiders Member

ETNUG Member