Saturday, February 21, 2009

Hey ya, next week I have planned to add the Log method, so you can keep a historical log of the runtime. Plus, i'll fix some minor bugs.
Another thing I should begin to care is "threadsafeness", because sometimes calling methods from different threads can cause consistency problems.


Friday, February 20, 2009

Not much people have downloaded the console, so I decided I'll post the things you'll get by using it. Probably some of you are wondering, why use this crappy component if I have my old school .NET's Console.WriteLine(debugThis) that hasn't ever let me down?. I'll explain the neat features:

The main feature is the Show method. It receives two parameters: a string identifying what you are showing, and a value. For example: Console.Show("Player1.Position", pos); you can write this call inside the Update of your main character and a new variable will be added to the Console's TreeView, and everytime this gets called the value in the TreeView gets updated. Let me show you a screenshot.

So, as you can see you will get live coverage of some variables of interest, and they will stay right there, visible everytime you need them. Another thing to note is that the console creates a hierarchy of values, if you need some other variables from Player1 you will get them grouped under the same node so you can quickly check the state of some component of your game. I'm planning to use the reflection API to add variables from the console itself, for example you could write "Game.Player1.Position" at runtime and you will see the value being added and updated every frame, I'm not sure if the .NET reflection API is available on the XBOX.

Wednesday, February 18, 2009

Update: rewritten to be more clear.
I forgot to mention how to use the console. Here's what I do to add it to a new project:
  1. Add the DebugConsole.dll as a reference to your project.
  2. Create a new public class file, call it GameInfo.cs
  3. Make your new GameInfo class implement the DebugConsole.IContainGameInfo interface. (i.e change the line "public class GameInfo" for "public class GameInfo : DebugConsole.IContainGameInfo"
  4. Add the 4 public properties mentioned later to your GameInfo class
  5. Create a static instance of the DebugConsole somewhere you can reach easily, something like Game1.Console (just add a DebugConsole variable in your Game1.cs file)
  6. Construct the console with a new GameInfo instance (i.e add new DebugConsole.DebugConsole(new GameInfo());to your initialize method)
  7. Add the console as a GameComponent (Game1.Components.Add(Game1.Console);)
  8. That's it. Start using the console (i.e Game1.Console.Show("My var", myLocalVar);)
This are the properties you need to add to GameInfo, just copy and paste and replace the comments:
  • public Game Game { get { /* return your Game class here */ } }
  • public Matrix WorldMatrix { get { return Matrix.Identity; } }
  • public Matrix ViewMatrix { get { /* return your view matrix here */ } }
  • public Matrix ProjectionMatrix { get { /* return your projection matrix here */ }
If you have a 2D project, you can return Matrix.Identity in the View and Projection properties, but you won't be able to use marks.

I will upload an example project soon.


Tuesday, February 17, 2009

Let me introduce you to the Debug Console for XNA. It is designed to be an handy set of runtime tools you can use to debug your game. Right now it does not have too many features but it does have some that you may like.

Current Features
  • Show. Live! watch of variables.
  • Alert. A text that pops out to indicate when an event happens.
  • ShowMark. Put some marks on the 3D space.
  • ShowLine. Draw lines on the space.
  • ShowBox. Draw a box on the space (this is not currently in the DebugConsole, but in a matters of days will be).
  • ShowSphere. self explained.
  • Improve performance by making smarter use of the video card calls.
  • Improve the way matrices are passed to the console, to make it more flexible and comfortable.
If you're interested you can download the source code.
I definitely want to get feedback from you, so leave a comment/bug report/feature request/anything else, whenever you want.

UPDATE: Instructions on next post.

Until next post,

Monday, February 09, 2009


Are you reading this?

Thursday, February 05, 2009

Hey there, I haven't posted anything about XNA tools yet, that's right, and I feel bad about it. I'm going to be posting sometime soon. In the meantime check out the game we made for the Global Game Jam, here in Caracas.

The Game Jam is a 48 hours event where you and your team create a small game. This year the first global Game Jam took place and 1600 participants around the globe worked to create more than 300 games.

You can check out the games made here at Universidad Simón Bolívar here.

Our game was Gnaka-Gnaka (pronunced in Spanish ñaka-ñaka) written on XNA by these 8 persons

Jose Alberto Gomez / Artist
Alex Perez / Sound Designer
Henry Quintero / Programmer
Alejandro Martinez / Graphics Programmer
Andres Barrera / Programmer
Luis Miguel Blanco / Programmer
Jose Dunia / Programmer
and me, also programming

We might be releasing it on the Xbox LIVE Community Games, in the meantime you can download it from the link above.
The game includes the Debug Console which I talked about before. You can use it if you like, later next week I'll be posting about it and offering a direct link to the code.

See ya then.