• entries
101
122
• views
58243

XNA

Have some free time so I started learning C#, so far i'm really impressed, and coming from a C++ background am finding it easy to pick up. I don't see myself using it for projects in the immediate future, but as I grow more comfortable I wouldn't be surprised if a large amount of my coding is done in that language.

I've also been playing around with XNA - very neat stuff there. I was able to throw together a 3D "hello world" app amazingly fast (a simple heightmap).

Unfortunately there is one very big problem with it - distributing a game. As far as I can tell there are 3 ways of doing so:

1) Published on Xbox Live Arcade
This is pretty awesome and could potentially be a great revenue generator, but the process of getting it greenlighted by Microsoft seems pretty daunting for a independent game studio, or even worse a "hobbyist" programmer team or individual.

2) Xbox 360 via content creators club
Nice that you can play it on a 360, but your potential audience is rather small. Though I can understand why Microsoft wouldn't want wide distribution of these games to the general 360 population, and do not blame them at all for requiring a content creators subscription to be able to play them.

3) PC
Absolutely horrible, the end user has to have The .NET Framework 2.0 Redistributable, the XNA Framework Redistributable corresponding to the version your game was built against, and a number of files from the DirectX 9.0c Redistributable installed.

A few years from now when Vista has become more widespread the .Net Framework requirement shouldn't be as much of an issue, but expecting a user to have the other 2 installed is a bit much. If you're making a commercial game your customers are not going to be happy about having to download all that extra stuff - they just want a 1 click installer (and if you've made a casual game only a few megs in size the total amount potentially needed to download jumps in size exponentially). Chances are people will download a demo of the game, then when they realize everything else they have to do just to play it will probably not even bother with it.

As it stands now I can think of 3 good reasons to use XNA - Rapid prototyping of a game concept (which I think is an excellent use of it). Having a publishing deal for live arcade (which I would think twice about if I already had an established codebase in another language from previous projects, or didn't have anyone with extensive C# experience on the team). And finally, if you are just learning programming and want to make games. From what i've seen so far C# is a much better language for a beginner (compared to C++ anyways), and XNA seems fairly easy to use.

...

EDIT: since I originally wrote this the MSDN page has been updated to mention that its behavior does not conform to the C++ standard.

Here's a question, will this code compile? (assume someSet is a std::set, and that 512 is a key that exists in it)

This comes from a conversation on #gamedev where it worked with visual studio but was choking on gcc.

Initially I suggested that std::set might not have any erase members that returned anything - though that was wrong as it appears that there is almost definitely one that returns a size_type).

The consensus was that since MSDN's page suggests it returns an iterator or size_type, that is the standard behavior. The belief was that the erase functions listed at the SGI page for std::set, none of which return an iterator, was not standard. A further link to the GNU libstdc++ docs resulted in suspicion that gcc might be in the wrong here - and this was from people whose programming abilities I highly respect.

The beautiful thing is that since I don't have a copy of the standard nearby I have no idea which is correct. Google gave me this mailing list thread which suggests that the STL version of set had an erase member which returned an iterator, but standard C++ doesn't. Also, the freely available draft standard suggests in section 23.3.3 that it doesn't return an iterator.

Until I have a copy of the standard in front of me I can either trust what MSDN and some of the more competent members of gamedev have to say, or I can hope that some page I found on google and a draft version of the standard is correct, yuck.

Admittedly this might not seem like a big deal, and if you were only using Visual Studio as a build environment it wouldn't be a problem - but personally I think its symptomatic of some of the larger problems with C++.

Physics demo

I've been playing around with physics libraries a bit, here's an app I made using Newton (about 3 meg download - and if you don't have a version of VS C++ 2005 installed you might need to download this from Microsoft). I haven't tried to distribute a Windows app before, so it'd be awesome if anyone could download it and make sure it works on their computer (it worked for a couple people on #gamedev so hopefully no one will have a problem with it).

And here's a screenie

It needs a bit of work, i'm not calculating collision with the camera so you can walk through the balls and walls, and there are a number of things I could do to speed it up a bit, but I'm pretty happy with how easy it was to get started.

Console launch...

I hadn't planned on commenting on the PS3 or Wii console launches, but this blows me away.

The Bel Air, Maryland Bestbuy will not be launching either the PS3 or Wii on Friday and Sunday because of "safety concerns" (out of curiosity I actually called the number and a check at bestbuy.com shows that is the correct phone number for that location).

So my question to the manager of that store is this: considering that you will be the only store in North America to have a PS3 (and possibly the only one with a Wii) in stock on Monday, do you really think that from a "safety" standpoint this was a good idea?

Personally I think the guy/girl behind this idea is a moron.

New project

I've stopped working on my "engine". It was mostly for educational value, and I knew when I started that it was unlikely to get finished. All in all it was worth the time I spent on it, but i'd rather move on to actually making a game. I've got a basic app up and running (i'll try to get some screenshots posted in the near future) using the following:

OGRE for rendering
OIS for input
CEGUI for the GUI

I'm currently looking at physics libraries and will probably use one of the following:

ODE
Newton Game Dynamics
PhysX
Tokamak

I would like to use PhysX (especially now that it's free for commercial development on the PC), but as far as I can tell an end user of the game would need to download (about 20 megs) and install the Aegia system software to be able to run the game - which might be more trouble than it's worth. Right now i'm leaning towards Newton, but I would be a lot happier if it was either open source or the developer promised to release it under a BSD style license if development/support on it stopped.

I need to do some research into what I want to use for sound and possibly networking (initially i'll probably just be doing some small single player games and won't need it). I also need to figure out what type of game I want to be working on, right now i'm leaning in the direction of something like Super Monkey Ball - if only because it seems like a realistic goal.

As for actual gaming, i'm still slowly working my way through Okami (i've spent about 50 hours on it so far), I really like that game. I'm also playing Metal Gear Solid 3: Subsistence, and enjoying it a lot more than I thought I would.

b day

My birthday has arrived and i'm not very happy to report that while looking in the mirror today I found a few gray hairs. I've been under alot of stress over the last few months and i'm hoping that it's because of that. If not I might get to be one of the lucky people in their 20's with a headful of gray hair - if that happened I wonder if I would let it stay or dye it back to brown.

And in an update to my last post here's some thoughts
1) I'm very happy with Subversion, I suspect that if the choice is mine I won't be using CVS again.
2) Despite having a not particularly great first 5 or so hours, Okami is my current choice for game of the year.
3) I had thought about using boost::spirit for parsing the current form of my level data, but thought it might take too much time to learn how to use it. After seeing the post from MaulingMonkey in this thread, I might take the time to look at it (if only for educational value).

Source control

Got around to creating simple level format for my basic scene manager (used only for testing new features). It's nothing special, just XML loaded via TinyXml. I suspect i'll use XML as an intermediate format for the moment (if only because it's human readable and editable) and convert it to a binary format at a later date.

I also finally got around to setting up a source control server. I've used CVS in the past, but decided to try out Subversion this time. So far i'm rather happy with it, and TortoiseSVN is working great as a client.

On the gaming front, I've been playing lots of Okami on the Playstation 2. Awesome stuff, one of the more beautiful games i've played recently.

More on Inform 7

I've done some more playing around with Inform 7 and am finding it fascinating. Here's an example from the Inform wikipedia page of the source code to a very simple game.

"Hello Wikipedia" by A Wikipedia Contributor

The story headline is "An Interactive Example".

The Living Room is a room. "A comfortably furnished living room."
The Kitchen is north of the Living Room.
The Front Door is south of the Living Room.

The insurance salesman is a man in the Living Room.
The description is "An insurance salesman in a tacky polyester suit. He seems eager to speak to you."
Understand "man" as the insurance salesman.

A briefcase is carried by the insurance salesman.
The description is "A slightly worn, black briefcase."
Understand "case" as the briefcase.

The insurance paperwork is in the briefcase.
The description is "Page after page of small legalese."
Understand "papers" or "documents" or "forms" as the paperwork.

Instead of listening to the insurance salesman:
say "The salesman bores you with a discussion of life insurance policies.
From his briefcase he pulls some paperwork which he hands to you.";
now the player carries the insurance paperwork.

I'm serious, that is the actual source code you send to the Inform compiler.

Here's what it looks like when you play it.

I'm not yet sure how viable it would be for a large and complex game (for example Curses), but I haven't spent enough time with it to say either way. Regardless, after having worked with an older version of Inform, it seems a lot easier to get started with. This is what roughly equivalent source code looks like in Inform 6

Constant Story "Hello Wikipedia";

Include "Parser";
Include "VerbLib";

[ Initialise;
location = Living_Room;
"Hello World";
];

Object Kitchen "Kitchen";
Object Front_Door "Front Door";

Object Living_Room "Living Room"
with
description "A comfortably furnished living room.",
n_to Kitchen,
s_to Front_Door,
has light;

Object -> Salesman "insurance salesman"
with
name 'insurance' 'salesman' 'man',
description "An insurance salesman in a tacky polyester
suit. He seems eager to speak to you.",
before [;
Listen:
move Insurance_Paperwork to player;
"The salesman bores you with a discussion
of life insurance policies. From his
briefcase he pulls some paperwork which he
hands to you.";
],
has animate;

Object -> -> Briefcase "briefcase"
with
name 'briefcase' 'case',
description "A slightly worn, black briefcase.",
has container;

Object -> -> -> Insurance_Paperwork "insurance paperwork"
with
name 'paperwork' 'papers' 'insurance' 'documents' 'forms',
description "Page after page of small legalese.";

Include "Grammar";

Logging

Added support for Rich Text Format output in my logger. I'm not doing anything fancy with it but now my log files are in color, which makes navigating to a line with a warning or error a bit easier.

I started by looking at this tutorial on gamedev, but ended up just downloading the specification from Microsoft and reading through it. It's funny, I can remember when I would have preferred the tutorial, but these days i'd rather just RTFM.

Lines of code

I came across this statement today

I don't consider "lines of code" to be a particularly useful metric, but regardless, it always amazes me to be reminded how much COBOL is still in use.

In actual game dev news, i've been looking at Inform 7. A few years ago I wrote some small interactive fiction games with Inform 6, but the new version seems to be something completely different - a natural language approach to a programming. I don't have much motivation to work on an interactive fiction game these days but i'm going to play with it a bit.

I've also put over 40 hours into Disgaea 2 over the last 3 weeks. That's about 2 hours per day on average. I'm disgusted with myself, that's a lot of free time gone. The sad thing is that i'll probably stay at that pace for at least another week or two - i'm enjoying it too much.

Bugs, or the lack thereof

Ugh, I just spent the last 4 hours trying to track down a bug with scaling in my scene management system. What was really annoying was that translation and orientation was working as expected, and scaling was behaving correctly on everything except the root node. Turns out there was no bug, it was doing exactly what I was telling it to do (which was something other that what I was expecting it to do).

On the bright side, I now have a better understanding of scaling and how it applies to transformation matrices in a spatial hierarchy. Plus it forced me to implement some needed functionality in my logging system - which is what ended up giving me enough information to figure out what was going on.

Screenie

My project has gotten to be over 6000 lines of code, and this is what I currently have to show for it.

The good news is that most of what i've been working on so far has been the boring but essential work that needed to get done, and I can just about get started on some features that are a bit sexier. But first I need to clean up some of the rough edges and probably do some refactoring.

The crates in the scene are from noaktree (he was briefly giving them away to readers of his journal last month). He's got some nice work, take a look at his models for sale - maybe you'll see something you like.

I've also been listening to Microsoft's Gamefest 2006 presentations. Lots of great stuff there, if you have a fast net connection and plenty of hard drive space (the downloads are huge) I highly recommend taking at look at them.

Finally, here's some advice: don't forget to switch the DirectX runtime back to retail when you want to actually play games. Today I accidently discovered that using the debug runtime consistently crashes the Half Life 2 demo shortly after trying to start a new game.

...

The sky diving footage (first minute and a half) in this ">music video by Boards of Canada is insane - the guy is pretty much jumping from outer space. There's a more documentary style presentation of it here.

Apparently is was part of a series of experiments by the US Air Force in 1959 and 1960 called Project Excelsior - but seriously, wtf?

...

I had been planning on playing around with the particle system and trying geomipmapping for my terrain, but I ended up buying Disgaea 2 and have lost a lot of my productivity. I don't know why I keep buying Nippon Ichi games - they're too much of a timesink, but they really appeal to my obsessive compulsive side.

I was also digging around some old files and found a screenshot of my first game. So for nostalgic reasons here it is.

All I have to say is that programming for classic Mac OS was a pain in the ass - IIRC that game wasn't even written with the Carbon API.

I've also been watching the Battlestar Galactica "webisodes". The acting is a bit uneven, but it's a fun way to lead into season 3.

Particles

Put together a particle system using point sprites today. It still needs a lot of work, but in the mean time here's a screenie of using it to make some snow.

Virtual Desktops

I visited my parent this weekend and gave them my Mac. I'm going to miss it, but they had been using an old PC running Windows 98. It was time to get something a bit more recent.

The one thing I didn't like about OS X was the lack of virtual desktops (though they will apparently included in 10.5). Now that i'm mostly using Windows I was pleased to find out that XP supports them via Microsoft PowerToys for Windows XP - the implementation isn't as good as the ones found in a linux distro, but's it's still nice to have.

A couple things I learned from the trip: if you're driving south from San Francisco on highway 101, you will pass a billboard advertising Ubuntu - what has the world come to? And Steam sucks, I had downloaded the Half Life 2 demo awhile ago and thought i'd check it out this weekend, but my parents only have a dialup connection and I couldn't be bothered to find a phone cable and set it up. I really like the concept of steam and the potential for online distribution of games - but seriously, I need a net connection just to play a free demo of a game?

Also, I find ">this video combining a Dick Cheney speach with quotes from Scarface is well done, and pretty much sums up how I feel about the vice president.

max

Today I discovered that this code won't compile.

#include
#include

int foo = std::numeric_limits::max();

However I found a few ways to make it work:

// 1
#include
#include

int foo = (std::numeric_limitsint>::max)();

// 2
#define NOMINMAX
include
#include

int foo = std::numeric_limitsint>::max();

// 3
#include
#undef max
#include

int foo = std::numeric_limitsint>::max();

// 4
#include
#include

int foo = INT_MAX;

Yuck to C macros.

Terrain

I Bought Introduction to 3D Game Programming with Direct X 9.0c: A Shader Approach by Frank Luna a couple weeks ago and have to say it's excellent. It's making my transition from OpenGL to D3D very pleasant.

I've only got a few complaints about the book, and they are rather minor.
1) The author uses C style casts rather than C++ style casts.
2) The level of const correctness could be higher, Luna largely only uses it when passing references to a function (while I tend to make any function parameters that won't change const - I like the "design by contract" philosophy).
3) The use of global variables in all the example programs. Though considering that this is an introductory book showing you how to use DirectX, not how to make an actual game - this is perfectly acceptable (and the examples would be a bit more complex without them).

Other than that, I have to repeat that it's a great book. I had previously been exclusively using the fixed function pipeline with OpenGL. I thought shaders were intimidating so I hadn't spent much time with them, but it turns out they're actually easy to write/use. The book introduces them at about page 200, then continues with them for the next 400 pages, with a lot of practical demos.

Anyways, now that i've finished reading the book i've started working on a simple game. I've got a basic framework set up, and here's one of the first scenes i've made.

Just a simple heightmap with a sky cube for the background. When you load the heightmap it's split into a number of cells, each with a bounding box for frustum culling. Probably will use some sort of spatial data structure at some point to make culling more efficient, but for the time being there aren't enough terrain cells to give it much of a speedup. You can also walk around the terrain and the camera's altitude follows the terrains. I also haven't implemented the triangle/vertex count yet (probably do that soon).

IRC

Sometimes #gamedev is too much for me.

You can't make this stuff up.

Free stuff!

Everyone loves free stuff, so I thought i'd share this link with the denizens of journal land. Bryce 5.0 is free until September 6, 2006. You can also get a coupon to buy version 5.5 for $20 (regularly$120). I had been thinking about buying a copy of Terragen at some point, but i'm going to see if I can just use this for any terrain generation needs.

Here's the first image I made. Keep in mind that I don't know how to use the software and haven't looked at any tutorials yet - this is just a bit of tinkering around with it.

software suggestions

The transition to Windows is going rather smoothly. Having not extensively used it since Windows 98, I have to say i'm really impressed with XP. Anyways, i'm hoping some of the journal land readers can suggest some software, as i'm not that sure what's out there.

So far i've got Firefox, VS C++ 2005 Express, the August 2006 DirectX SDK (which i'm really impressed with), Paint.net, SharpReader (RSS reader), Microsoft's virtual desktop powertoy (the one thing I really missed in OS X), Open Office, Python, X-Chat 2, Blender, and VMware Player. What am I missing that you can't live without?

VMware is pretty amazing. This entry from Rob Loach inspired me to try it out. I had been thinking about dual booting, but so far VMware's performance is up to my needs. Something about being able to run Windows and Linux side by side makes me feel all warm and fuzzy inside. Here's a screenie:

Oblivion

So last night I was rereading the manual for Oblivion. At about 10PM I wanted to check out something I had learned from it, expecting it to take about 5 minutes. Next thing I knew I looked up and it was 5AM - wtf? My suspicions appear to have been correct, my productivity for the next couple of weeks will be close to 0.

laptop

So I went out and bought a laptop. I'm actually pretty happy with it considering I only spent \$900 on it (had been planning on spending more). For that price i'm happy to have gotten a Core Duo processor (1.66 GHz), 15.4 inch widescreen, 120 gig hard drive, Mobility Radeon X1400, and 2 gigs of RAM. Though it did come with XP home, which is a bit of a bummer - i'm trying to decide if I want to buy XP Pro.

Considering I haven't owned a copy of Windows for the last 5 years i've got some serious catching up to do with games. There's so much I want to play from that time period - gonna be hitting the bargain bins for the next few months looking for the games i've been missing out on.

It's definitely not a gaming rig, but it runs Oblivion at an acceptable level at 1024x600 with medium textures and most of the fancy effects turned off. Even with the lower settings that game is gorgeous and too addictive. I've basically given up any hope of being productive for at least the next couple weeks.

...

I'm planning on buying a new laptop sometime in the next couple of weeks. I'm hoping that Apple will announce something exciting at WWDC on Monday, but i'm not holding my breath. I want something that can run Windows and has a decent graphics card. The Macbooks are decent, but the integrated intel graphics card just doesn't cut it - and the Macbook Pros are just outside of my budget (especially when you add the cost of buying a copy of Windows). So i'll probably be buying a straight up "PC". It'll be interesting as the last version I owned was 98 (i've been using linux for the last 6 years and OS X for the last 2) - though I have used XP a bit during that time period.

Anyways, the real purpose of this entry was to share this: ">C-3PO thinks smoking isn't cool.

...

I'm somewhat embarrassed to admit this, but when I first learned C the following lines often appeared in my code

#define begin {
#define end }

It was a very bad thing to be doing, but i'll give some caek to the first person who guesses what language I had been previously using.