Jumps Background Race Background Turret Background


Moving from a scripting language like Lua and an engine that's meant for rapid prototyping like LÖVE over to Microsoft's C# and XNA is a challenging process. Here are the biggest differences (other than syntax) that I've found:

  • In LÖVE, sprites are referenced by their center, whereas in XNA it's their top left. (XNA seems to be doing the more standard approach here, and I think more recent versions of LÖVE have actually switched as well.)
  • Colors in LÖVE are represented in RGB by three integers ranging from 0 to 255. For XNA, they're three floats ranging from 0.0 to 1.0, but using an integer like 255 doesn't throw an error - it just evaluates as 1.0! This led to a lot of confusion and wrong colors on the screen before I figured it out.
  • LÖVE lacks a lot of the convenient math functions that XNA has. You have to keep track of X and Y components yourself, and make your own distance formula. XNA has these awesome pre-defined objects called Vectors, which already have an X and a Y component, as well as some nice convenience functions like Vector.Zero and Vector.Distance.
  • While XNA may be better for quick math, it's much worse at 2D drawing. For instance, there are no functions for drawing 2D primitives like lines or rectangles! You have to come up with those all on your own! And there's no built in way to animate! While there are some tutorials to walk you through through the basic stuff, I found that I had to write most of this code myself. These are things that I feel have to be included in any game engine, but Microsoft totally skimped on them. If you're having trouble while reinventing the wheel, I found that this post and the included code on drawing lines gave me the tools to figure things out.

Well, I hope that helps somebody in the future avoid the same trouble areas that I had with starting on XNA. Sound is one topic in particular I didn't cover here, because XNA handles it so differently from other game engines I've worked with that it deserves its own post. I guess that comes from having to work with a content pipeline instead of just files.

Webmention Endpoint


Stay Connected