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

How To Speed Up Firefox 3

I decided to try Google Chrome today and was pleasantly surprised with it’s speed on loading pages. And I started seeing how slow my Firefox was. At first I thought that it might have something to do with the plugins I have, but then again they are very few, just Echofon, Firebug and Xmarks. So after a little digging I came up with a way to speed up Firefox 3, turn out it was all in the options =) ...

October 12, 2009 · 1 min · 178 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

Cloning Objects in C#

After trying to manually clone some classes, but making a sort of copy constructor I was always ending up with lot’s of code and worse, if I add another variable to my class I would sometimes forgot to also clone it. Luckily and after a search I discovered that C# has a cool thing, Reflection. So you can do something like this: using System.Reflection; class MyClass { public int a; public float x; MyClass() { // default constructor } MyClass (MyClass my) { FieldInfo[] fields = typeof(MyClass).GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); foreach(FieldInfo f in fields) { f.SetValue(this,f.GetValue(oth)); } } } MyClass obj1 = new MyClass(); obj1.a = 1; obj1.x = 2.0f; MyClass obj2 = new MyClass(obj1); // Obj2 will have same values as obj1 and you // can now use them independently. I hope this is helpful. Let me know if you know a better way ...

October 12, 2009 · 1 min · 146 words · David Amador

Programmers are tiny gods

I’ve found this picture on the internet and also an interesting and funny article regarding Programmers/Designers relation on work. I’ve already talked about designers and how their critique training makes them impossible to work with. Luckily the designer I work with knows me well and knows how to make me want to fix that, but not pointing the obvious, issuing orders… This doesn’t work. Fix it. A good tactic is to have parameters, request help ...

October 10, 2009 · 1 min · 181 words · David Amador

The amazing lands of C++

I’m sure every programmer will like this

October 5, 2009 · 1 min · 7 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

Master Web Developer

I decided to take a course on Master Web Developer. It’s a 6 months course covering PHP, actionscrip, HTML, JavaScript, Ajax and more. Hopefully I’m going to fill all my gaps on web development and possibly get more and better works in this area. Also this way I can give better credibility to Different Pixel.

September 25, 2009 · 1 min · 55 words · David Amador

Game Competition

Some time ago I decided to launch a new website with a 48h Game Competition. We are now 2 days away from the Compo#1. This is for every indie game developer wannabe =) [Edit] The first competition is now over. Check the results here One of the games made in the competition.

September 17, 2009 · 1 min · 52 words · David Amador

Stargate

Ok so I got addicted to Stargate Atlantis as well. After watching all 10 seasons from SG-1 I decided to give it a try to Atlantis. I was not convinced that it would be a good show, but the it’s awesome. Atlantis starts around season 8 of SG-1 when Daniel Jackson figures the location of the lost city of Atlantis. Atlantis follows the adventures of a team that goes to Atlantis and being on another galaxy they only have power for one trip so it’s a one way trip only. The characters are great, and the show is very funny, mostly because of Rodney McKay. The new main enemy are the Wraith and the show is years ahead of SG-1 in special effects. I’m already on season 4 so I’m almost finishing. I recomend both show to everyone who gets a chance of viewing them. Since both have been canceled there’s a good chance your find packs containg the whole series. I found SG-1 complete on amazon last weekend. ...

September 15, 2009 · 1 min · 169 words · David Amador