XNA vs Silverlight vs Native Code

The Microsoft XNA logo, just the letter xna with the downward slash of the X colored orange

If you write a game in Flash, you will have to accept some performance limitations and make some compromises in terms of available technology (eg. no Ageia PhysX or hardware shaders for you). But nearly everybody can play the game right in his browser, dramatically expanding the number of people that see your game.

Now Microsoft is hurling a competitor to Flash at the market: Microsoft Silverlight. It is based on the .NET Compact Framework 3.5 and WPF, which makes it about 1000 times more powerful than Flash. WPF also includes 3D graphics and is way faster than flash, allowing for full-screen animations where flash would slow down to a crawl. It’s being ported to Mono/Linux as well, with the help if none other than Microsoft!

Continue Reading →

XNA Vector Font Renderer

I’ve been fiddling around with font rendering again this weekend. For my upcoming game, I wanted a cool intro effect like in some movies, where the displayed text is very very slowly expanding. But I couldn’t quite replicate that effect with the XNA SpriteFont class. Even with antialiasing turned on, the borders of the text were flickering. Using very large font sizes resulted in hopelessly oversized .xnb files with only a slight improvement for the unsteady borders.

So my new solution was to write a component that renders vector-based text instead of bitmaps. Extracting the vector data from a font was a bit harder than I had expected because fonts consist mostly of complicated second and third order bezier curves. I managed to break these down into plain straight line segments and am now in the possession of a content pipeline importer that converts .ttf fonts into arrays of line segments. Behold:

Screenshot of vector fonts rendered as outlines in 3D

Continue Reading →

Installing Visual C++ 2005 Express

Notice

This article is outdated!
Instead of following the steps in this article, just download and install the newer Visual C++ Express editions which already include the Windows SDK (previously known as the Platform SDK).

This article will explain how you can install the freely available Visual C++ 2005 Express Edition together with the Windows SDK required to create Windows applications and use most of the code available on the ‘net.

If you’re interested in doing Windows game development in C++, Visual C++ 2005 Express is a great choice because it combines a world class IDE with the optimizing version of the Microsoft C/C++ Compiler. If you’re concerned with standards compliance, rest assured that Microsoft’s compiler is among the best.

More Information

History Lesson: Microsoft and the C++ Standard

The idea that Microsoft compilers have poor standards compliance is rooted in Visual C++ 6.0, which was shipped before the C++ ’98 Standard had been completed but lived well into the C++ ’98 era. Visual C++ 2005 doesn’t have such problems at all and is actually one of the best – if not the best – compiler in terms of ISO/ANSI C++ standards compliance. With Herb Sutter, Microsoft has also won a famous member of the C++ standards committee for its own development team (see ISO/ANSI C++ Standards Committee Secretary Herb Sutter Joins Microsoft’s Developer Division).

The only obstacle for game programmers is that the Express Edition of Visual C++ 2005 doesn’t include the Platform SDK, Microsoft’s collection of headers and libraries for windows development, including the all-time famous Windows.h. This article will guide you through the entire process of installing Visual C++ 2005 Express, setting up the Platform SDK and configuring your build environment.

Continue Reading →

XNA Windows.Forms UserControl

Notice

This article is outdated!
This was a pretty cool achievement at the time, but XNA 1.0 is long gone. Microsoft now offers their own examples on how to do this:
WinForms Series 1: Graphics Device
WinForms Series 2: Content Loading

A topic that pops up every now and then is how to use XNA in a Windows.Forms application. This is rather difficult because the GraphicsDeviceManager provided by Microsoft creates its own window and will not cooperate with a normal Windows.Forms window, thus forcing the developer to roll his own GraphicsDevice initialization and management code (which is quite a bit of work!)

As can be seen in one of my recent news posts, I did just that while developing a world editor for my upcoming game Island War. Because of the great demand for such a component, I decided to release my XNA GameControl class to the public. You can download it here:

An XNA-based pong clone running inside a Windows.Forms application

How to use:

  1. Add a reference to Nuclex.GameControl.dll (or to the project if you integrated the project file into your solution)
  2. Create a new UserControl that inherits from Nuclex.GameControl. You can do this by adding a normal UserControl and replacing the : UserControl by : Nuclex.GameControl in the class definition.
  3. Override the LoadGraphicsContent(), UnloadGraphicsContent(), Update(), Draw() and so on methods as usual.

There’s one issue: Because the working directory will be set to the system’s temp folder when your control is shown in designer mode, you will not be able to view your game in the Visual Studio Forms Designer if it is loading content using the XNA content pipeline (well, unless you want to copy your project’s output folder into your temp directory whole). There will be no problems starting or debugging the project, though.

Island War Day 3

I decided to put some work into creating an editor that I can later use for building the levels and perhaps even include with my game. XNA gave me a hard time getting it to work inside a Windows.Forms application and I had to rewrite several of the XNA classes until I had a properly working XNA UserControl allowing me to render my game world inside the editor window.

Screenshot of a height map editor with dialog controls and a tool panel

Of course, the editor had to look modern and neat, with dockable panels and color gradients all over the place. As it turned out, there is no built-in solution for docking windows in the .NET Framework, so, given my plans to release the game’s source code, I had to find a solution that was both free and provided a decent user experience.

Continue Reading →

Island War Day 2

I know, as always, I’m a bit late with updates, but just in case you don’t know yet, the Microsoft guys finally opened www.xna.com. Finally, a complete website dedicated to XNA instead of the cramped MSDN section!

The developer area has been moved to http://creators.xna.com, including a wealth of tutorials and a revamped discussion area.

This weekend, I tried finally getting texture splatting to work for my Island War terrain renderer… and failed miserably :D. Look for yourself:

Screenshot of a height-mapped terrain with lighting and textures

There’s a lot of tuning to do until this crappy… something… looks like believable terrain. I’m not aiming for photorealism, but I’m not settling for a surreal landscape that stands out like a children’s painting would in an art gallery, either 🙂

Island War Day 1

Alright, my next game is finally on its way. The game’s working title will be “Island War”, which describes the setting of this game pretty well: small islands at war with each other.

And it won’t be like any other strategy title you might have played. I’m planning to remove the tediousness from the RTS genre by getting rid of micro management and unit placement.

I decided to try a different approach to the design of this game than I did with Ball Race. Instead of creating several GameComponents (like SceneGraph, EffectManager and GameStateManager) and spreading the game’s logic between them, I’ll try to model the game world in an object model designed for convenient use, so I can later set up my levels and launch the game with just a few lines of code.

Screenshot of a shaded height-mapped terrain without textures

The code so far incorporates an asset management system, the entire world expressed in an object model with load/save capability and can render dynamic height-mapped terrain allowing for real-time terrain deformation by explosions and other influences. I haven’t written the actual shaders yet, so this will look much better once I can get the shaders going.

Hurricane in my Area

Originally, my plan was to put together a new release of Nuclex.Fonts this evening, but there was a small hurricane in the area near the end of the week that uprooted lots of trees, creating a great obstacle course in the local forests. My favorite jogging route was totally buried. Well, I couldn’t help but go out there every day since the past week. Today, I took my camera with me, here are some shots from the forest trail I used to jog on:

Images of a forest road filled with fallen trees in stacks up to 2 meters high Images of a forest road filled with fallen trees in stacks up to 2 meters high Images of a forest road filled with fallen trees in stacks up to 2 meters high

I haven’t had such an intense workout with so diversified movements (due to the constant jumping and climbing) in a long time. Normally I can do the 10 km (~ 6.2 mi) in about 55 minutes (it’s rough terrain!). Now, after 55 minutes, I barely managed to pave my way through about half of the trail. My heart rate often got close to 200 bpm, making it quite difficult to jump from tree to tree. Here’s an image I tried to take of my watch’s recording after the run:

Photo of a Polar AXN 700 showing 196 beats per minute average for 55 minutes

196 beats per minute average(!) heart rate for 55 minutes. I’m not getting old quite yet 🙂

This shouldn’t stall my projects for long, but it was immense fun!

CeGui#

If your game needs advanced GUI capabilities, CeGui# might just hit the nail on the head for you. Marketese aside, this is a seriously good GUI library with Buttons, ListBoxes, Scrollbars, ProgressBars, Sliders, ComboBoxes and more.

Screenshot of CEGUI# rendering its GUI into an XNA window

Being a port of the well known CeGui C++ library, it is not bound to a single graphics API but can instead be easily extended to run on a multitude of environments. Out of the box, it already provides extensions to be used with: XNA Framework 1.0, Managed DirectX 1.0, SDL.NET and Tao.OpenGL.

The only real problem for XNA developers might be that it does not yet work on the Xbox 360 due to several restrictions in the functionality of the .NET Compact Framework 2.0 that XNA applications have to build against on the Xbox 360.

Sexy Beach 3 ;-)

Just in case you have never heard of this game, Sexy Beach 3 is an adult title sold exclusively in Japan. In the game, you take the role of some random guy who gets invited for a holiday on “Sexy Island”, a small vacation island populated with a handful of other guests, which, by mere chance, are all good-looking women. You can probably see where this is heading to now… 😀

Right, Sexy Beach 3 is basically just another sex simulation game, only that the Japanese are miles and miles ahead of the stuff churned out by western development studios. The game features beautiful anime girls, deforming clothing, real-time skin tanning and realistic boob physics. Yes, really.
Getting this game to install in Windows Vista is quite a headache, so I took the liberty to write down exactly what I did to make it work in a western Windows Vista system.

Continue Reading →