Sgt. Conker We are "absolutely fine"

3Dec/104

Articles: MVC in games

by Roy Triesscheijn

MVC Primer

MVC stands for "Model View Controller" and has been an architectural pattern in software engineering for quite some time now. MVC allows decoupling between what 'the program is supposed to do' and how this is made visible and controlled.

In MVC the three main responsibilities of the application are handled by three separate parts:

  • The model houses the actual business logic. The model is totally decoupled from the controller and view.
  • The view observes the information from the model, and if needed request an update of the information. Data from the model is lightly massaged, formatted and then presented.
  • The controller controls the application by mapping different kinds of input to public methods available on the model. The model itself always has the final responsibility of doing something with the request made by the controller. In many form-based applications the view and controller are hard to distinguish from each other.

Using MVC will allow you to reuse your complex model in different scenarios. Want to prepare your program for a different kind of input? Just write a new controller. Want to visualize your data in another way, just write a new viewer. In a good application controllers and viewers can even be changed while the application is running.

21Sep/100

Article: Shaders – Texturing

by Daniel Greenheck

A simple box with a stone black texture

This tutorial will cover attaching an image (I'll be using the word texture from now on) to a model to give it a much more detailed look. Texturing is an essential of creating a realistic scene because it allows us to give objects very fine detail. Without textures, everything in the scene would basically be one color, look very flat and just be generally boring. The right textures can even give an object the illusion of depth, further increasing the realism. The stone box above looks like it has deep cracks in it between the blocks, but that's just an illusion. The entire box is defined using eight vertices. To geometrically represent those cracks, it would take thousands of vertices, something that definitely isn't feasible.

21Sep/100

Article: Shaders – Specular Lighting

by Daniel Greenheck

What should I be familiar with before I go through this tutorial?
- The content discussed in the introduction, ambient and diffuse tutorials.

One Thing Before I Begin...

To keep things succinct, I will no longer explain or comment things explained in previous tutorials. Throughout these series of tutorials, I'm going to expect you've gone through the previous tutorials. No sense in beating a dead horse. So if you look at the variables section and only see the Specular variables, rest assured the others are still in the actual program. I just think it will be easier for you as a reader if I only present you with new information. That aside, let's begin!

What is Specular Lighting?

Specular lighting in one word: shiny. The world specular in itself means a mirror-like surface, so you can imagine that anything that has specular lighting is very reflective, causing it to have shiny highlights. If you place a polished chrome ball under a direct light source, you'll probably see a big shiny spot blinding you; this is the specular highlight. Specular reflections are caused by the reflection of the actual light source itself. If the surface isn't flat however, it will warp the light and you'll usually see it as a small dot of bright light or curved lines of light. When you're out on a sunny day, look around at smooth, metallic objects and notice their specular highlights. Try and determine how the light is coming in and being reflected off the surface to your eye. The more you understand about real-world lighting, the better you'll understand what we're trying to replicate in our shaders.


The perfect example of specular lighting. Notice the highlight is really the reflection of the sun.

21Sep/100

Article: Shaders – Diffuse Lighting

by Daniel Greenheck

What should I be familiar with before I go through this tutorial?
- The content discussed in the introduction and ambient shader tutorials.
- A simple knowledge of vectors, matrices and dot products (click on the links for Wiki articles) will REALLY help you understand some of the light calculations going on. although I'll do my best to explain those topics in this tutorial.

What is Diffuse Lighting?

Diffuse lighting can best be described as directional light. There are three types of diffuse lighting: directional, point light and spotlight. I have a picture of each below in respective order. Directional light comes down at the same angle no matter where you are standing; the light has no position, just direction. Point light is like a light bulb, it all emanates  from a single point equally in all directions. A spot light is like an oriented floodlight or a flashlight. Diffuse light also creates shadows, but that's a much more advanced topic we won't dive in to until later.

20Sep/100

Article: Shaders – Ambient Lighting

by Daniel Greenheck

Since these are shader tutorials and not XNA tutorials, I'm guessing you already have a basic understanding of these topic
- How to draw a simple model or some vertices in XNA.
- How to add files to the Content Pipeline.
- The content in my Shader Introduction.

A few words to start...

Before someone makes the wise-crack that ambient lighting is already taken care of in the BasicEffect class in XNA, I'm going to tell you: ambient lighting is already taken care of in the BasicEffect class in XNA. The reason I'm giving this tutorial is because these basic shaders lay the foundation for more advanced and complex shaders. If you can understand how simple shaders work, it will help you out profoundly when dealing with complex topics like bump mapping and projective texturing later on. I highly recommend avoiding the BasicEffect class if you are completely new to shaders. Instead focusing on building your foundation of shader knowledge; it's completely necessary if you ever plan on making anything beyond a game that looks like Mario 64.
If you don't plan on using advanced shaders or you already know the basics of HLSL, here’s a tutorial on how to use the BasicEffect class (which is also on my links page).

Now, for those of you who are still with me! Ambient lighting is about as simple as it gets, so this will be a good place to start if you are completely unfamiliar with HLSL. A scene with only ambient lighting by itself looks like a polar bear in a snow storm, so if you want a little more detailed effect, I would skip to the diffuse lighting tutorial. However, in later tutorials, I'll be focusing mainly on the actual code inside the vertex and pixel shaders; I'm going to assume you've already read this tutorial and have a basic understanding of shaders. So consider yourself warned!

18Sep/102

Article: Vacant Skies – Action RPG Tutorial Series

by Aaron T Foley

Welcome to the Vacant Skies – Action RPG Tutorial Series. My name is Aaron Foley and I’ll be your host throughout this series. The primary purpose of the series is to document a route on how to make a complete action RPG using XNA and various resources throughout the internet. There are so many amazing resources out there now for XNA that it is pointless to keep reinventing the wheel when writing a game. So I’m going to collect various tutorials, code, and libraries and utilize them all to create a game. So let’s get this show on the road.

6Sep/100

Article: Character Movement

by David Kendall

When development started on The Casino, a lot of things were implemented quickly to get the game to a playable state as soon as possible with the intention of coming back to these parts at a later point. In order to achieve character movement quickly, character movement that can be found in most XNA tutorials were added. This involved the character strafing and moving based upon the left thumbstick and rotation of the character based upon the right thumbstick.

This control scheme may seem familiar to some of you, and it should as it is reminiscent of the controls for a First Person Shooter (FPS). However, The Casino is in no way a FPS. In fact I don't know what you would classify it as. I also had an aim when designing the controls...to keep it simple. This was so players of all ages and skills could pick up and play the game as quickly as possible. This meant that the FPS control scheme had to go.

5Sep/105

Article: I Can Has Platformer? (Part 5)

by Casey Young

I Can Has Platformer Part 5 Final ImageWelcome back to the fifth part of my series on how to create a simple platformer game. In this article, we give our hero something to collect.

3Sep/100

Article: Multiple columns with game state management

by Jeff Brown

This tutorial is based on the Game State Management (singleplayer games) from the xna website but the Network Game State Management (multiplayer games) can also be used based on your needs. There's no better place to start and I believe every game should incorporate one of the two. For this tutorial I'll be using the game state management but both should be nearly identical except for some multiplayer menus but those don't apply here.

This tutorial focuses on adding left and right movement to your menus so you can have multiple columns of menus.
NOTE: I have debug code in to modify the number of columns and number of menu entries in-game just to show how you can scale it very easily. You can download the project here to play with it. Left/right triggers add/remove menu entries and left/right shoulder buttons increase/decrease the number of columns.

3Sep/100

Article: WCF on the Windows Phone 7–The How to Guide

by Simon Jackson

Well at the behest of Michael B McLaughlin (@MikeBMCL on Twitter), here's a run down of what you need to know to get WCF working on the Windows Phone 7, both for Silverlight and XNA.  This is just going to be a brief overview and the full detail will be included in the LeaderBoard sample for Silverlight and XNA coming soon.

Many thanks to @MikeBMCL pointing me to this post by Michael Cummings who details one approach to getting WCF working for XNA.  It does work, but it’s a long way round.  It did however point me in the right direction to solve the problem and now I’ve got WCF working the way I Like it.  As in Working.