A new book on Game Studio 4.0

It has been about five years since my last book came out.  During that time, a lot has happened.  Heck, that book was about Managed DirectX, and at the time it came out XNA Game Studio didn’t even exist as an idea, much less a product.  Since then, it’s not only been released, but we’ve announced the *fourth* version of the product!  We’ve added support for Windows, Xbox, Zune, and soon, Windows Phone 7.

So much has changed, so much time has passed, it was time to do a new book.  This new book will cover Game Studio 4.0 in its entirety, including Windows Phone 7, the new features, Xbox, everything.  While we haven’t announced any release dates for Game Studio, I’m spending my spare time (what little I have) to make sure the book will come out as close as possible to the release of the product.

I’m also having some help with this one, and will have a co-author, so that is a bit exciting too!  Writing has begun so if you have suggestions, now is the time!

XNA Game Studio 3.1 Zune HD Extensions

If you were already developing games for your Zune using XNA Game Studio, you’ll be happy to know that moving that game over to the new Zune HD will be remarkably easy.  Today we’ve released the XNA Game Studio 3.1 Zune HD Extensions that will allow you to deploy to your new device and includes a few new API’s as well.

There is also a thread on the XNA Creators Club forums for any questions or discussions.

My blog is a constant source of new and exciting information…

It’s been over a year since my last post, and despite my many promises to myself (and anyone who still reads this thing), I never seem to find time to post here.  Well, other than right now, since I obviously am doing it now.

A lot has happened since my last post.  We shipped Game Studio 3.0 and opened up the Indie Games on Xbox Live, although it was so long ago, it wasn’t even *called* Indie Games back then, it was called Community Games.  I’m sure everyone has heard about it by now, and I still think it’s awesome that you can sell games you’ve created.  Then again, we also shipped a completely new version since then as well in Game Studio 3.1!  Wow, I really am behind aren’t I?  We added cool new stuff like Avatar support in that version.

I even completely forgot about my annual Aprils Fools post!  Of course, I didn’t really come up with a cool topic for that anyway.  I’d make up something outlandish now, but that wouldn’t be nearly as effective since it’s September.

Speaking of Indie Games though, I think I’ve finally decided the game I’m going to write to ship there.  Of course, my idea is way too ambitious for my artistic talent (read; zero), and I have no idea where I’m going to find the time to actually write it, but no matter.  I will finish it and ship it and suffer the ridicule of the masses!

Maybe that will even give me the impetus for writing more here.  We can hope…  If not, lets hope I’ll remember to write something sooner than the next two versions of Game Studio.

Make money from your amazing game creations!

Today we announced the Xbox LIVE Community Games.  You can read more information about it (including a FAQ) here.

What is the big thing in the announcements that could be considered exciting?  You’ll be able to make money from your creations.

As an XNA Creator Club premium member you’ll be able to submit your games to the service, set a price point for your games (between 200 and 800 Microsoft Points), and after a peer review your game will be available to download by millions of game players on Xbox LIVE.  Every quarter, you’ll receive a payment for up to 70% of all money your game has earned.  People will be able to play a trial of your game before they buy it as well.

I remember what seems like forever ago now.  I was sitting in my office trying to convince people that you could use managed code to make games.  That it was feasible to run managed code and make a good game on a console as well as Windows.  I remember the reluctance people had in believing that.  Now look today.  Have you seen Schizoid?  A game that has been released and making money.  Now we have this announcement today.  Almost anyone has the potential to make money by writing a game and getting it on the service.  It couldn’t be simpler.

As for me, I’m celebrating this announcement by taking a trip to Vegas.  (Ok, that’s just coincidence, but still).

Community Games!

For those of you who don’t read the XNA Team Blog the Community Games on Xbox LIVE feature has gone into a beta release!

Plus, the web site looks much cooler now.

So, what does this mean?  It means that premium members can create a game, submit it for peer review, and then have it available on Xbox LIVE.  There’s also a new starter kit, a 2D RPG Game.  There is plenty of information and new cool stuff on the new web site, so go check it out!

I just tried to use four render targets on my Xbox 360 and it failed!!

Dear Mr Miller, you suck.  I’m running in 1080p resolution, and needed to have four simultaneous render targets, and a depth buffer, and I can’t do it.

Now, to be fair, I didn’t actually receive a message like that, but I could see it happening (and I’ve gotten some similar).  One of the features that we added this last release was the ability to use multiple simultaneous render targets on Xbox (up to four of them).  However, this isn’t without restriction.  All render targets that will be used on the device need to fit within the EDRAM (a 10MB chunk of memory). This includes the depth buffer if it exists.  EDRAM isn’t very big at all.

Let’s take a look at an example.  Your Xbox is rendering in wide screen 720p mode with a resolution of 1280×720.  You set your game to run at this exact same resolution with a surface format of Color (32bits) and a 32bit depth buffer as well.  You also turn on 2x multisampling because you hate jaggies like the rest of us.  All of this data needs to fit into EDRAM, so let’s see how big we are.  Each pixel in the back buffer will be 8 bytes (32bit for color, double it for multisampling).  There are 1280×720 pixels, so the back buffer will be taking up approximately 7.3MB of memory.  The depth buffer is the same size, so that’s another 7.3MB, and we’re looking at a total of almost 15MB of data we need to store in our 10MB chunk of memory.

As you can see, even this simple scenario we overstepped our bounds.  Luckily, we have a mechanism (called “tiling”) that allows us to work with this data anyway.  We essentially break our large 1280×720 set of pixels into a series of smaller sets of pixels that *do* fit within the memory constraints.  In the example above, the back buffer could be broken down into two separate “tiles” of size 640×720 with 2X multisampling, and things would work just fine.  With only two possible consumers of this chunk of memory in version one (the back buffer and the depth buffer), you could easily fit the largest possible back buffer sizes within this chunk of memory.

In version two though, we allow up to five consumers of this memory (four simultaneous render targets and the depth buffer).  The memory is broken up equally by all consumers, so in the maximum case, each render target and buffer has to fit within 2 MB of EDRAM.  You can imagine if I called 10MB small what I think about 2MB.  I’m sure you could just think “Well sure Miller, that’s fine, but we could just create hundreds of little tiles and make it all fit.”

There are two big issues with this.  First, performance would be horrible.  Each tile that is rendered actually will have your *entire* scene rendered on to it, then the results of the tiles glued together.  In a complex scene this could add up very very quickly.  Second (and more importantly) we only allow a maximum of 15 tiles to be created at one time.  If your render target or depth buffer cannot fit inside 2MB of memory with 15 tiles or less, you will fail.

Knowing that, what size of render targets can you make?  What if you have a 2048×2048 render target (surface format of Color) with no multisampling?  Would that fit if you had four of them at the same time?  A quick and dirty way of figuring it out would be this:

2048 * 2048 = 4MB * 4bytes (color) = 16MB (total amount of memory needed) / 2MB (maximum size) == 8

So, you’d need 8 tiles for this buffer to render correctly, 8 is less than 15 so you’d be safe.  What if you added 2x multisampling though?

2048 * 2048 == 4MB  * 8 bytes (color+ms) == 32 MB (total amount of memory needed) / 2MB (maximum size) == 16

Nope, 16 tiles is too many, this wouldn’t fit.  What if you didn’t have a depth buffer though?  Depth buffer counts as a buffer in the EDRAM so without it, you’d have 2.5MB per surface available:

2048 * 2048 == 4MB  * 8 bytes (color+ms) == 32 MB (total amount of memory needed) / 2.5MB (maximum size) == 13

13 tiles, you’d fit again!

It’s also important to point out that not all tiles are created equal.  Tiles aren’t calculated based on a memory size, but on a pixel size.  Odd shaped (ie, non-square) render targets will create odd shaped tiles, and the last tile may be larger than needed to account for that.  For example, if you have a 1280×720 surface and 3 tiles used in that, you can be assured that you don’t have 3 separate tiles each of size 426.67×720.  Each tile is rounded up to the next size it can be (normally a mutliple of 32).  In the case above, that 1280×720 surface would really be three tiles of size 448×720 with the third title having some “empty” space in it.  So if you do your little math above and it comes to exactly 15 tiles, you still may be too big if the tiles aren’t the size you’d expect.

Do I really expect someone to try to create and use four simultaneous 2048×2048 Color render targets with 4x multisampling and a 32bit depth buffer?  Well no, because as you’ve seen here, it would fail!  However, if it does fail, at least this hopefully explains why!

By the way, in reference to my fake first question.  You can actually do this just fine, so long as you aren’t using 4x multisampling, and even with 4x multisampling, it just barely doesn’t fit with a depth buffer (1900x1080x16bytes == 31.3 MB / 2MB == 15.6 tiles).  Four 2x multisampled render targets at 1080p would fit though.

Big Announcements!

Well, another conference has come and we have more announcements it seems.  Hard to believe I’ve neglected this blog for so long that it’s been since last August that I wrote anything.  This is probably because we have so many other team members who are doing such a great job with their own blogs, mine almost seems redundant!

Nevertheless, some great things annouced today that are quite exciting.  You can read all about them on the XNA Team Blog as well.

The first big announcement was Xbox LIVE community games coming this holiday season (with a special preview for a limited time right now).  Later this year you will be able to develop your own games using the XNA Creators Club subscription and upload your game to Xbox LIVE for the whole world to see and play for free (assuming it passes a peer review).  What’s more, if you believe your game is a money maker, you will actually be able to sell your game and make money.  Exciting times are coming indeed.

As part of this, there are seven community games available fore a very limited time right now.  If you want to try them out (and I heartily recommend you do), first go to the market place on your Xbox and go to the Game Store and navigate down to XNA Creators Club and download the new Game Launcher.  Once it’s downloaded, navigate back to the Games Library on the games tab, and under “My Games” navigate over to the “XNA Creators Club” twist and press Y to see the list of games to download.  They’ll appear under that twist to play once they’re downloaded as well.

While this was a huge announcement in and of itself, we actually made a second announcement today as well.  Starting with XNA Game Studio 3.0 you will not only be able to create games for Xbox and Windows, but you’ll also be able to create them for your Zune as well.  You’ll even be able to use the wireless capability of the Zune to play against other nearby Zune’s in multiplayer games!

As I’ve sometimes implied with my reflection posts and the like, annoucements like we made today are the reason I do what I do.  It’s been my stated goal for years now to bring managed code and gaming to the masses and we’re getting there, one game at a time.

Gamefest (or “I never seem to write blog posts anymore”)

Well, Gamefest started today, and with that our team blog posted a new announcement.  Exciting stuff!

I also realize I rarely update this blog.  I’d love to say that I’m working on improving that, but the truth is, aside from being busy, I have I guess what you’d call “writers block”.  Nothing interesting to really talk about work related that isn’t being covered by someone else.

I’ve considered switching to the Live Spaces thingy and writing more often, but it wouldn’t be anything like the things I write here, and I can imagine the few readers i have left aren’t overly interested in the ramblings of whatever i’m thinking about at the time.  Besides, i’m sure most of that stuff would simply get me in trouble anyway.