MotoGP: AI coordinate systems

I occasionally get requests to write about game AI, especially the AI from MotoGP. I have resisted this topic for the simple reason that I never worked directly on AI code, so I don’t really know much about it. But hey, this is the Internet, right? You don’t have to know anything about a subject…

8

Bug or feature?

Writing about randomness reminded me of an interesting bug in the first commercial game I ever released. Extreme G was a futuristic racer for the Nintendo 64. Each vehicle had a limited number of turbo boosts, which increased your speed as long as you drove cleanly, but cut out as soon as you clipped the…

23

The psychology of randomness

Due to some quirk of evolution, human beings are remarkably good at intuitively approximating solutions to complex calculus problems, but appallingly bad at estimating probability. Pretty much anyone is able to catch a ball, or judge when it is safe to pull out into traffic. These tasks require complex predictions at least up to the…

18

Algorithm versus implementation

When I first started making games, most things were written in C, with critical pieces optimized in assembly language. A skilled assembly programmer could beat the C compilers of the day by a factor of two or more, so this was an important optimization (for instance the blit routines in Allegro were all written in…

11

Premultiplied alpha content processor

As mentioned in my previous post, a Content Processor that converts textures into premultiplied alpha format: using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content.Pipeline; using Microsoft.Xna.Framework.Content.Pipeline.Graphics; using Microsoft.Xna.Framework.Content.Pipeline.Processors; namespace PremultipliedAlpha { [ContentProcessor] class PremultipliedAlphaTextureProcessor : TextureProcessor { public override TextureContent Process(TextureContent input, ContentProcessorContext context) { input.ConvertBitmapType(typeof(PixelBitmapContent<Color>)); foreach (MipmapChain mipChain in input.Faces) { foreach (PixelBitmapContent<Color> bitmap in mipChain) { for…

7

Premultiplied alpha in XNA Game Studio

It is possible to use premultiplied alpha with XNA Game Studio, but the bad news is we don’t do much to help you with it. Why not? Yeah.  Our bad.  In fact one of my biggest regrets about the design of the XNA Framework is that we didn’t do more to make this easier! To…

4

Premultiplied alpha and image composition

From Wikipedia: "Alpha compositing is the process of combining an image with a background to create the appearance of partial transparency. It is often useful to render image elements in separate passes, and then combine the resulting multiple 2D images into a single, final image in a process called compositing."   Example I am making…

8

Premultiplied alpha

Remember when you first figured out Santa Claus wasn’t real? The growing doubt, tempered by the fact that all your friends believed in him, and surely they can’t ALL be wrong, then the gradual realization that everybody was in fact wrong… Well, I’ve got another one for you: the way most people do alpha blending…

14

Texture filtering: alpha cutouts

Consider a cutout texture that contains a solid shape surrounded by transparency. Let’s say this is a tree, although it could equally well be a cat or an overweight Italian plumber. Our tree is opaque and colored green: tree  =  (0, 255, 0, 255) The surrounding pixels are transparent: border  =  (0, 0, 0, 0)…

2

New Game Studio samples

Hot off the press, this sample provides handy classes for generating cubes, spheres, and teapots (great for debug rendering!) while this one shows how to do various hopefully useful things with skinned character models. Notice how Skinned Model Extensions reuses code from the Primitives3D sample for drawing the collision spheres? You’d almost think Primitives3D was…

3