This will probably be the last post in this series, at least for now. In part one I looked at the basics on how to create my own custom writer/reader. If you’re unfamiliar with the process, you might want read that to begin with. In the second part I showed how to load lists of classes by referring to other XML files. In the third part I showed how you can easily use this technique to load textures and other classes. In this fourth and final part, I’m going to show how you can make life a little easier for yourself when you are loading derived classes. Continue reading
Archives
XNA custom content writer/reader part 3: Loading textures and other classes from XML files
My last post talked about how to easily read XML files with lists of other classes in them. Now the neat thing about this is that you can very easily modify the code to read any kind of class, including textures and sounds. One of the things I find slightly annoying is that you can’t just include a filename in your XML file and have the content pipeline pick up the texture or sound automatically. However, if you’re already writing your own custom writer/reader pair, there’s no reason why we can’t include that functionality ourself. Continue reading
XNA custom content writer/reader part 2: Reading XML files that have classes within classes
In the last post of this series I showed how to write a simple content writer/reader pair. That basic example didn’t give you any benefits compared to the automated way of doing it, however it was a simple introduction on how to write a content writer/reader pair. In this post I’m going to take a look at how to create XML files that reference other classes inside of them. This is an alternate way of doing it from my post back in August. Continue reading
XNA custom content writer/reader part 1: Introduction
I did a post on automatic xnb serialization of classes within classes a while back. Now while the method works decently enough, I’ve realized it’s probably not the best way of going about doing it. I’m now using a different method. It’s a little bit trickier, as it involves using custom content writers and readers, but I think the overall result is neater code. There’s a lot of stuff to cover here, so I’m going to try and split the content into four parts. This part will just be about how to setup a simple content writer/read pair, in case you’re not familiar with how to do it. Continue reading
Automatic XNB serialization of classes contained within classes
I’ve been playing around with XNA for a few months now, although I have nearly nothing to show for it so far, but I figured I should probably start writing down my thoughts so I can remember them for later.
Right now I’m in the early stages of creating a Tower Defense game. Yes I know, very original. But I figure it’s a very good game type for a learning experience. There’s a wide range of things you need to figure out, but the scope of the game itself is not too big that it becomes overwhelming. Continue reading