• Shawn Hargreaves Blog

    Understanding GameTime

    • 21 Comments
    Time can be a surprisingly slippery concept to get to grips with. Back when I was working on Allegro it caused the most common question from new programmers , and even though XNA does more than Allegro to handle time for you, it appears some people are...
  • Shawn Hargreaves Blog

    XNA Unleashed

    • 5 Comments
    Every few years I find myself hankering to write a book, but whenever I start seriously thinking about the idea I realize how much work it would be and get scared off. The next best thing to writing a book of my own, though, is reviewing one by somebody...
  • Shawn Hargreaves Blog

    GameFest

    • 9 Comments
    Looks like the talk abstracts for the upcoming GameFest conference have been published, and yours truly somehow got signed up to give a talk and a half. I only actually volunteered for one, but then Mitch suckered me into helping out with his :-) This...
  • Shawn Hargreaves Blog

    What should I blog about?

    • 20 Comments
    My todo list of future blog topics seems to be growing faster than I'm having time to write them! (maybe something to do with my being busy working on new framework features instead? :-) It occurred to me I should find out which areas people would be...
  • Shawn Hargreaves Blog

    Delegates, events, and garbage

    • 6 Comments
    Some commenters on my previous post asked for more information about the situations where delegates allocate memory. Here's the scoop. There are actually three reasons why careless use of delegates or events can cause memory allocations: Allocating delegate...
  • Shawn Hargreaves Blog

    Twin paths to garbage collector nirvana

    • 10 Comments
    In my previous post I described how to tell if your Xbox garbage collection is taking too long. We saw how the total amount of time spent on garbage collection is the product of the number of collections with the collection latency. This suggests two...
  • Shawn Hargreaves Blog

    How to tell if your Xbox garbage collection is too slow

    • 4 Comments
    I noticed several threads about garbage collection on forums.xna.com this week. Is it just me or is everyone suddenly starting to worry about performance as they approach the end of the DreamBuildPlay competition? The crucial first step in any performance...
  • Shawn Hargreaves Blog

    Embedding content as resources

    • 13 Comments
    Reusable XNA components often contain content as well as code. For instance the bloom sample on the creators.xna.com site uses several custom effects, and the framerate component I described in my previous post needs a font to display the output. If you...
  • Shawn Hargreaves Blog

    Displaying the framerate

    • 29 Comments
    I was about to write a different article, but then I thought about what would make a good example for my planned topic, and decided a framerate component would be a perfect testbed for it. So before I get started on my next real subject, I'm going to...
  • Shawn Hargreaves Blog

    Loading content from zip archives

    • 2 Comments
    Nick Gravelyn has posted some code for embedding XNA content in zip archives . Not only does this provide compression for your asset data, but it also reduces clutter, replacing many .xnb files with a single .zip. He uses a custom MSBuild task (in a similar...
  • Shawn Hargreaves Blog

    Wildcard content using MSBuild

    • 2 Comments
    One of my favorite things about the C# project system in Visual Studio is the way it is implemented on top of MSBuild . Visual Studio provides a nice user interface for editing your project, but when you hit F5 it just calls through into MSBuild to do...
  • Shawn Hargreaves Blog

    Loading content from subfolders

    • 6 Comments
    A common pattern in XNA games is to nest a "Content" folder inside the main game project, to keep things organized. We do this in all the samples available on the creators.xna.com site, for instance. When you come to load a piece of content, you have...
  • Shawn Hargreaves Blog

    Transitions concluded: "there is no spoon"

    • 4 Comments
    Transitions, much like bent spoons in martial arts sci-fi movies, are a figment of your imagination. Or at least they ought to be. Sometimes people program their games like this: Fade in menu screen (2 seconds) Wait for input selection...
  • Shawn Hargreaves Blog

    Transitions part four: rendertargets

    • 5 Comments
    For the ultimate in crazy transition effects, render-to-texture is your friend. Setting this up is pretty easy. First you need to add a custom rendertarget field to the top of your Game class: public RenderTarget2D renderTarget; Second, initialize...
  • Shawn Hargreaves Blog

    Transitions part three: stencil swipes

    • 10 Comments
    Remember the original Star Wars films? (not the more recent episodes: I refuse to talk about those :-) Remember how they transition from one scene to another, using a circular swipe where one image gradually zooms up over the top of another? That style...
  • Shawn Hargreaves Blog

    Transitions part two: let's get physical

    • 0 Comments
    In my previous post I talked about how you can control complex transitions by animating a single control value at a constant speed from 0 to 1, and then applying various curves to derive more complex transition behaviors from that single source value...
  • Shawn Hargreaves Blog

    Transitions part one: the importance of curves

    • 4 Comments
    Now that the Game State Management sample is released, I'm going to rewind time and follow through on my promise to talk about transition effects . In the sample, the GameScreen base class keeps track of the transition position as a float ranging from...
  • Shawn Hargreaves Blog

    Evolved bitmap fonts

    • 1 Comments
    Within days of releasing our bitmap font maker utility , people are finding ways to improve it. Patrick created a Codeplex project that adds automatic outlining and shadowing filters. Ziggyware posted an article showing how to support more output formats...
  • Shawn Hargreaves Blog

    Bitmap fonts in XNA

    • 13 Comments
    The XNA font system is most commonly used to extract data from TrueType fonts described in XML files, but it is also capable of grabbing character images directly from hand drawn bitmaps. TrueType fonts are convenient, but you may sometimes find yourself...
  • Shawn Hargreaves Blog

    Unicode fonts in XNA

    • 3 Comments
    The XNA font system supports full Unicode character sets. The default XML font description includes only characters 0x20 to 0x7E, which corresponds to the "Basic Latin" Unicode range, but you can easily add other character regions by modifying the XML...
  • Shawn Hargreaves Blog

    Hysteresis

    • 10 Comments
    Games often have to make discrete decisions based on continuously varying analog input values. This happens a lot when making animation systems respond to controller inputs: if (speed > 0.7) ShowRunAnimation(); else if (speed > 0.1) ShowWalkAnimation...
  • Shawn Hargreaves Blog

    Profiling Thursday

    • 0 Comments
    Everyone is writing about how to use profiling tools today. Must be something in the water... SwampThingTom explains how to measure CPU performance to make sure you don't waste time optimizing parts of your program that weren't slow in the first place...
  • Shawn Hargreaves Blog

    BasicEffect.PreferPerPixelLighting

    • 1 Comments
    One of the new features in the next release of the XNA Framework is the addition of per-pixel lighting support in BasicEffect. In the original version of the framework, BasicEffect always evaluated its lighting per-vertex. That means for every vertex...
  • Shawn Hargreaves Blog

    Equalizing artwork

    • 1 Comments
    Great albums depend on more than just the individual notes. After the musicians finish recording their parts the producer takes over, adjusting volume levels and equalization settings, or maybe adding a bit of reverb to make everything sit well in the...
  • Shawn Hargreaves Blog

    Specularity

    • 3 Comments
    BasicEffect uses the standard Blinn-Phong shading model, which combines both diffuse and specular light. Tweaking the diffuse part is pretty easy. Just set the BasicEffect.DiffuseColor property to the color of your object, or to white if your model is...
Page 15 of 18 (440 items) «1314151617»