Samples

Shows how to implement the user interface for a multiplayer networked game.

Use prediction and smoothing algorithms to compensate for network lag.

Shows how to import arbitrary 3D models at run time with the XNA Content Pipeline.

Aiming Sample

This sample shows how to turn one object to face another. This can be useful for aiming, for example...

Audio 3D Sample

This sample shows how to position sounds in 3D space, implementing panning, Doppler, and distance attenuation effects...

Billboard Sample

This sample shows how to efficiently render large numbers of billboard sprites, using a vertex shader to perform the billboard computations entirely on the GPU...

Bloom Postprocess Sample

This sample shows how to use bloom post-processing filters to add a glow effect over the top of an existing scene...

Chase Camera Sample

This sample demonstrates how to create a simple chase camera with spring physics...

Chasing and Evading Sample

Featuring a cat, a mouse, and a tank, this sample demonstrates how to implement several simple behaviors for AI, including chasing, evading, and wandering...

Collision Series 4: Collision with a Heightmap Sample

This sample demonstrates how to move objects along a heightmap, useful when creating a game that requires interaction between moving objects and terrain. It is based on the Generated Geometry sample, which creates a landscape from a bitmap...

Collision Series 5: Heightmap Collision with Normals Sample

This sample demonstrates how to use information about a heightmap's vertex normals to follow the contour of the terrain...

Color Replacement Sample

This sample demonstrates how to render parts of an object with a user-defined color...

Custom Model Class Sample

This sample shows how to go beyond the limits of the Model class that comes built in to the XNA Framework, loading geometry data into an entirely custom class that can be extended more easily to cope with specialized requirements...

Custom Model Effect Sample

This sample shows how custom effects can be applied to a model using the XNA Framework Content Pipeline...

Custom Model Importer Sample

This sample shows how to implement a custom model importer for the XNA Content Pipeline...

Distortion Sample

This sample demonstrates how to implement a variety of screen-space distortion effects with a general post-processing technique...

Fuzzy Logic Sample

This sample shows how an AI can use fuzzy logic to make decisions. It also demonstrates a method for organizing different AI behaviors, similar to a state machine...

Game State Management Sample

This sample shows how to manage the transitions between different menus and gameplay states...

Generated Geometry Sample

This sample shows how 3D models can be generated by code during the XNA Framework Content Pipeline build process...

Lens Flare Sample

This sample shows you how to implement a lens flare effect by using occlusion queries to detect when the sun is hidden behind the landscape...

Mesh Instancing Sample

This sample shows how to efficiently render many copies of the same model, using GPU instancing techniques to reduce the cost of repeated draw calls...

Network Architectures: Client/Server Sample

This sample implements a simple multiplayer network session, using a client/server network topology where each computer sends its player input to the server, which updates the state of everyone in the session and sends results back to the clients....

Network Architectures: Peer-to-Peer Sample

This sample implements a simple multiplayer network session, using a peer-to-peer network topology where each computer is responsible for updating the state of its locally controlled players....

Network Game State Management Sample

This sample shows how to implement the user interface for a multiplayer networked game. It provide menus for creating, finding, and joining sessions, a lobby screen, and robust network error handling....

Network Prediction Sample

This sample shows how to use prediction and smoothing algorithms to compensate for network lag, making remotely controlled objects appear to move smoothly even when there is a significant delay in packets being delivered over the network...

Non-Realistic Rendering Sample

This sample shows how to implement stylized, non-photorealistic rendering techniques, such as cartoon shading, edge detection, and a pencil sketch effect...

Normal Mapping Effect Sample

This sample builds on the concepts illustrated in the Custom Model Effect sample, and applies a normal mapping effect to a mesh. The sample also uses a custom content processor to demonstrate two additional concepts: adding and removing per vertex data...

Particle Sample

This sample introduces the concept of a particle system, and shows how to draw particle effects by using SpriteBatch. Two particle effects are demonstrated: an explosion and a rising plume of smoke...

Particle 3D Sample

This sample shows how to implement a 3D particle system using point sprites. The sample builds on the ideas introduced in the Particle sample, showing how those principles can be extended to work in 3D and optimized through the use of shaders....

Picking Sample

This sample shows how to determine whether a player's cursor is over an object, and how to find out where on the screen an object is...

Picking with Triangle-Accuracy Sample

This sample extends the Picking sample with a more accurate picking algorithm, which tests against individual triangles that make up a mesh...

Primitives Sample

This sample shows how to extend the Spacewar VectorShape code to create PrimitiveBatch, which can be used to easily draw points, lines, and triangles on the screen...

Shader Series 1: Vertex Lighting Sample

This sample shows one of the most basic uses of shader effects—vertex lighting...

Shader Series 2: Textures and Colors Sample

This sample shows how to combine texture operations with mathematical color operations to blend colors and achieve interesting lighting effects...

Shader Series 3: Per-Pixel Lighting Sample

This sample shows how to use a pixel shader to perform per-pixel lighting with specular highlights that shift depending on the viewer's orientation...

Shader Series 4: Materials and Multiple Light Sources Sample

This sample is an example of how a developer might combine the techniques leading up to this sample into a usable system for composing a 3D scene...

Shatter Sample

This sample shows how you can apply an effect on any model in your game to shatter it apart...

Simple Animation Sample

This sample shows how to apply simple program controlled rigid body animation to a model rendered using the XNA Framework...

Skinned Model Sample

This sample shows how to process and render a skinned character model using the XNA Framework Content Pipeline...

Sprite Effects Sample

This sample shows how shaders can be used to implement special effects when drawing 2D graphics with SpriteBatch. It uses two custom content pipeline processors to prepare the sprite textures in special ways...

Sprite Sheet Sample

This sample shows how to implement sprite sheets, combining many separate sprite images into a single larger texture that will be more efficient for the graphics card...

Tiled Sprites Sample

This sample shows how to manage data for tiling, animation, visibility determination, and virtualization of a 2D camera...

WinForms Series 1: Graphics Device Sample

This sample shows you how to use an XNA Framework GraphicsDevice object to display 3D graphics inside a WinForms application...

WinForms Series 2: Content Loading Sample

This sample shows you how to import arbitrary 3D models at run time by running the Content Pipeline importers and processors dynamically on the fly as opposed to building all the content ahead of time in the usual way...

License

All source code downloaded from this page is bound to the Microsoft Permissive License (Ms-PL) found here.

©2007 Microsoft Corporation. All rights reserved. Privacy Statement Terms of Use Code of Conduct Feedback