Xna Screen Manager

I know there’s lot’s of this stuff over the internet but I keep bumping into people asking for this. A way to easily switch from a Game Screen to a Menu or Options without having tons of flags and “if” clauses on the class Game. I’ve made a small project with a Screen Manager. The ScreenManager is static and can contain Screens. Instead of having typical Draw Update functions drawing SpriteBatches on the Game class we should have something like this: ...

January 24, 2010 · 2 min · 314 words · David Amador

Basalt and Sapphire Updates

Lately all my free time has been spent adding new features to Basalt and developing Sapphire. Some months ago, I started building Sapphire, a 2D editor for helping me creating to create my maps. Unfortunately I made a bad choice and decided to integrate XNA with Windows Forms, although I managed to do it it was a real pain to add something simple and eventually I dropped it. Here’s a screenshot of the previous alpha version: ...

December 2, 2009 · 2 min · 245 words · David Amador

How to do a XNA fps counter

Frame rate or FPS, how it is most commonly known is a way for you to know how many images per second is you game drawing. The more the better. Less then 30 and you start to see hiccups. So how can you measure your frame rate in XNA? Inside your game1 class declare these vars: SpriteFont _spr_font; int _total_frames = 0; float _elapsed_time = 0.0f; int _fps = 0; On function LoadContent() do // Put the name of the font _spr_font = Content.Load("kootenay"); you have on your project On the update pump do: ...

November 23, 2009 · 2 min · 254 words · David Amador

How to do a Xna Log file

Although the title says XNA log file this is actually a C# log file, I’ve just thrown this title cause lot’s of people search for xna log instead of C# log file. Many have asked me why take time to do a log file when you can throw exceptions when something goes wrong. Well the answer is simple, to keep track of what’s happening, log steps, write to the file exactly what when wrong even if you are on Release mode, and more, if someone complains the game is crashing you simply ask for the log file and see what when wrong. ...

November 20, 2009 · 2 min · 350 words · David Amador

Using PerfHUD with XNA

I am definitely a fan of ATI cards. Had a few Geforces but didn’t liked them very much. I actually noticed image quality decrease when switching from an old Radeon 9800 to a Geforce 8k something. I’m very happy with my Radeon 4890, now for the downside, PerfHUD, a very handy tool for Game Developers is only available for NVIDIA chipsets and although ATI has it’s own GPUPerfStudio it’s not the same thing. Anyway for those who have one and are developing for XNA you may have noticed that it doesn’t run PerfHUD out of the box. You will get an error, something like: “This applications is not configured for using PerfHUD. Consult the User’s Guide for more information” ...

November 18, 2009 · 2 min · 293 words · David Amador

Unreal Engine 3 is now free

Epic decided to offer Unreal Engine 3 for free to non-commercial applications. Sounds kind of weird considering it’s one of the best and most licensed engine out there, but maybe the recent release of Unity 3d free for all uses made them consider this option. Named UDK (Unreal Development Kit) you can download it here and have access to all tools and features that the full commercial Engine contains, well, except for the source code of course. This opens a lot of doors to students and indie hobbyists as me. I just can’t wait to have the time to get my hands on this. ...

November 5, 2009 · 1 min · 104 words · David Amador

Prototype for xna7day competition

I decided to make a game for the xna7day competition, in which we have to make a game that only uses 2 keys, so absolutely no analog input and it has to be built on xna of course. This is a great opportunity to test my engine Basalt. I decided to make a puzzle game, basically the rules are the same of a 3 in line game. This is what I have so far. ...

October 29, 2009 · 1 min · 74 words · David Amador

Building an 2D Game Engine in XNA - Part 1

I decided to starting writing a series of tutorials for building an 2d XNA game engine. Keep in mind that while the main focus is 2d nothing prevents us from adding the 3d stuff later but for now we will stick to 2D. It’s not very original but I’ll call this the Bay Engine. If anyone else has a better idea let me know. Requirements: You must have some Object Oriented Programming background to full understand what we will do here. XNA 3.1 Visual C# Express or Professional 2008 This is it for the first part. It just covers the basic structure, next week I’ll talk about objects2d, scene and screens management. ...

October 16, 2009 · 1 min · 112 words · David Amador

XNA Camera 2d with zoom and rotation

07/01/2011 – By popular request updated to XNA 4.0, xna 3.1 code is still there too One of the things I keep finding is people asking how to do a simple camera 2d in XNA. Today I decided to contribute with my own solution. Most of the time the solution given is to have a class camera with a Vector2 position and when drawing the sprite batch to subtract the camera position to the sprite position itself. Although this work from my point of view it’s not elegant and you can’t have neat features like zooming and rotation. So for my tutorial I’ll do all transformations using a Matrix. Start off by creating the basic class Camera2d ...

October 12, 2009 · 3 min · 433 words · David Amador

Basalt gains a media player

So I’ve been working on a sort of media player in order to play movies on my 2d engine Basalt made on top of XNA. By extending my class Object2d I manage to get this pretty cool result. You can even apply shaders to it. Since I extended the class from Object2d I can rotate, scale and set a position to the video besides regular options like play/pause, fullscreen etc. For those who don’t know the video playing is a chunk of the series Naruto Shippuuden ...

October 4, 2009 · 1 min · 86 words · David Amador