jwatte's picture

Microsoft Connect issues

Microsoft has the Connect site, which works as a public feature request and bug report database for most of Microsofts products. At times, I do file bug reports on that site. The bugs have a "vote" feature, where the Microsoft groups apparently may pay more attention to a bug with higher votes.

jwatte's picture

Static reflection in C++ using minimal repetition

Don't Repeat Yourself.

That's a great rule for writing code. If you find that you repeat yourself in code, then you're probably doing something wrong. Writing code should be about expressing what's unique about something, not filling out standard forms of data. (Copy-and-Paste coding is the worst version of this)

Unfortunately, when it comes to providing serialization and editing information about classes in C++, the language falls down. In C#, and other .NET languages, and even in Java, reflection is rich and allows you to build nice, automated editors and serializers using minimal mark-up. Also, if you need mark-up, that mark-up can be done in-place where members are defined, typically using custom attributes.

jwatte's picture

The onward march of complexity (LRBni)

It used to be, a microprocessor was simple. It had instructions like "Load the accumulator from the address stored in the X register (LDA(X))." Or "Add register B to register A (ADD B, A)." And that was pretty much it. Time marched on, and we got more esoteric instructions, like "load effective address of scaled register indirect with offset" (LEA eax, [ebx*8+ecx]).

jwatte's picture

Procedural Planet models generated in XNA

Show how to generate a random planet based on midplace displacement noise and
a simple height map color ramp. Note that you typically want to add some cloud
cover for the best effect.

Press Space / A to generate a new planet.
Press Backspace / B to view the height map.
Press Y / Y to view the color map.

Released into the public domain by Jon Watte. You may freely use this in your

jwatte's picture

Mouse Picking in XNA Framework using Viewport.Unproject

When developing a PC program for the XNA framework, you usually find that you need to do mouse picking. This means taking the mouse coordinates, and turning them into a ray that you can then raycast in your world to see what, if anything, is being hit when the user clicks the mouse.

jwatte's picture

The Direct3D/XNA vertex transform pipeline -- how to go between model coordinates and screen coordinates, and back again!

1) WORLD matrix. This takes vertices from object-local space (0,0,0 in the middle of the object) to world space (position and orientation applied based on 0,0,0 at your "world origin" position). This is a convenient space to do normal mapped lighting and environmental reflection in.

jwatte's picture

Scheduling jitter measurement for UNIX

2009-03-12 latency2.txt README -- jwatte@forterrainc.com

This program measures scheduling latency/jitter for a CPU bound process on a UNIX system. It is intended to determine the suitability of various virtualization products to hosting real-time processes such as game servers. To compile it, use g++ (make sure it has been properly installed!):

$ g++ -o latency2 latency2.cpp

jwatte's picture

Ultimate Sleight of Hand (MMO FPS where everybody wins)

Thinking about how a MMO FPS like Planetside was most fun when you were in a good group, and you were winning, I started thinking about how you could set up a situation where each side can have the impression that it's winning. Playing FPS against NPCs is not as much fun as playing against other people, so it seems like a preposterous idea at the outset.

jwatte's picture

Evaluating paths in XNA games; how to run triggers and dynamically configure properties!

Inside an XNA game, you invariably start needing to wire things together. "When the player steps on this tile, run that action" or "when this timer expires, open that gate." For simple levels, you may be able to write this using code, but once your game reaches a dozen levels, each with hundreds of possible actions, hard-coding each and every one of them becomes a real nightmare!

jwatte's picture

.NET Reflection, Boxing, and Properties in XNA games

System.Reflection is great! You can find all public properties on an object, and manipulate them programmatically, without knowing the exact type of the object. You can also treat properties generically, by passing a PropertyInfo and object instance around. This allows you to build generic animation systems (similar to how the Windows Presentation Foundation dynamic animatable properties work).

Syndicate content