A XNA experience article

March 3, 2009

I came around one article about someone learning XNA in one day. His goal was to create a full game in one day even if he had never used XNA before… and even.. rarely even used C#.  While I don’t think it’s a good thing to do (you will get more frustrated than anything), I guess it’s always good to compare someone else code to yours and think of how YOU would have done something.

Read the article


Design Patterns

March 3, 2009

Another thing I’d like to share with the community is some basic tutorials on some design pattern that could be used in designing games.  The more basic ones that I can see being useful:

- Composite (obviously.. could be used to chain animations and such.)
- Strategy/Bridge (one of the first pattern you’ll ever learn)
- State (I will tackle this on in my AI tutorial. I think those are also used in GameState (menus and other tings))
- Command (I think this one is fundamental. Could be used for Undo/Redo in an editor)
- Memento (Could be used to make save-game)

Those things are “advanced” programming concept aimed to solve age old problems. Design pattern aren’t specific solution to one problem but more like a general solution to multiple problems. I’ve tackled  them in my first year at university in Software Engineering and I think it changed my life. You can get basic information on them on Wikipedia. However, If you’re interested in one of them, I suggest buying these 2 books (They’re invaluable resources).

- Head First Design Patterns [Amazon]

The Head First books are really the best book to start to learn something. They make everything funny with funny exercises and ridiculous examples that will print in your head forever. Worth every penny.

- Design Patterns: Elements of Reusable Object-Oriented Software [Amazon]

This one is essential. While tough to read (it’s impossible…), it’s THE dictionnary of Design Pattern. They invented most of them and since then, they’re widely used in the programming world. You can use it as a reference when you forgot how something should be implemented.

But you will never regret any of these books.

Have a nice reading!


Progress update

February 26, 2009

Hello everyone!

I’m proud to announce I’m now on Tutorial 6c. I haven’t post guides for the other tutorials because I felt it was not really needed. You spend most of Episode  5 correcting bugs and fixing annnoying stuff. I didn’t like them very much.. but I guess it’s necessary progress. I have a few comments though about the tutorials.

Problems scaling

The main problem I see is that we’re waiting a bit too much before switching to a Tile-Map instead of the individual layers.  This should have been done much sooner. What will happen to all our maps when all the layers are splits in single files? Don’t forget that the characters events, the cutscenes and dialogues should also be stored in it. Using layers individually was easy at first but, we should really think about migrating.

I peeked on the few last episode and saw they were coding some map files using the Content Pipeline… so I guess we’ll get it done one day. I just hope it’ll be easily scalable to add scripted tiles and things like that…

TileSize

Another comment I have is the tile-size. Currently, the tile-size is hard-coded in the tile-engine. I find this quite sad because it require you to only use 1 tile size for all your layers. What if you want to add layers of different size? The collision layer for example. Soon, we will have to code a collision layer that will block our character’s movement. It will also be our main resource for a path-finding algorithm (if we want our character to walk from one place to another without going through walls). If we use tiles of the same dimension for it, this mean we won’t be able to add tiles that could be partially blocked. You don’t want your character to be blocked 10 feet away of a signpost right? Or even.. a fence. A way to do that would be to have, for example, 16 (4×4) square per tile for the collision layer.  It would make it a lot more precise. Right now, you would have to hardcode everything.

If you want a 3D effect, you could also make tiles that are closer (up in a mountain) bigger than the tiles down in the bottom of a ravine. But still use the same tile-engine and the same tiles. Right now, that would have to be hardcoded.

I’ll continue the tutorials and see how it goes. As soon as I’m done with them, be sure I’ll look into these topics.

Some articles planned

I plan on making an article on how to use a Finite-State-Machine to do some AI in our game. It will also use a Path-Finding algorithm. It will take some time to do though since I have school and work right now, adding to everything.

For now, if you need help on any of these topics, just drop a comment and I’ll gladly help you out.


Smooth scrolling problems and Content Folder shortcut

February 19, 2009

Hello everyone! I’m now done with Episode 4.  I must say I’m impressed at how well everything is going wrong ;) .

Mouse scrolling problems

Implementing my Smooth Scrolling brang me some problems.  I corrected them right now.. but my code just need some serious refactoring if I want to keep track of everything.

The first problem I encontered was that when scrolling, I wasn’t getting the right cell highlighted. I realized later that Nick correct that problem in Episode 5. However.. his method don’t work for us. 

Once I’m done refactoring everything, I will post the solution here.

Content folder shortcut

Ok, the one most stupid thing I saw from Nick’s tutorial was the Content Folder. I know it’s required and all but going to select a Content Folder at every test is rather…. time consuming.

The solution I found is to use a configuration file to store the content path. If the content path is empty, the user must select one. If he did one time, it’ll be saved and will be considered as default when we execute the application again. I suggest you read the article about Configuration files on MSDN. 

http://msdn.microsoft.com/en-us/library/aa730869(VS.80).aspx

Don’t forget to put your scope to “user” if you want to modify it.


New tutorial descriptions added (Episode 03a and b)

February 13, 2009

I added more tutorial description now for Episode 03a and b. They’re not really in depth because I had already made them before I decided to write this blog. Starting at Episode 4, they should start to become more interesting.


The first expanded tutorial

February 12, 2009

Hello everyone!

I wanted to announce the first expanded tutorial. It expends the Video 03b with some new functionality. It might helps some people understand my goals!

Tile-Map Editor – Smooth Scrolling

If you have an idea for an expanded tutorial or if you want to submit me a tutorial to add, I’ll be happy to hear ya!


Introduction

February 12, 2009

I’ve wanted to learn game programming for many years. I did not have any background however. All I knew was C#. In my recent year in University, I have gathered enough knowledge to dive into this. I don’t really plan in working in this industry but I have some serious interest in doing this as a hobby.

I have followed the progression of XNA since the start. I am a fan of the idea of migrating game development from C++ to C#. It may be because I found C++ too overly complicated for me. I like to think large about my design, not think about memory allocation and leaks.

XNA provide us with a great wrapper around the DirectX API. It helps us develop game for Microsoft’s systems. It’s innovative and don’t worry, it’s only the beginning. I think Microsoft goal is to make game porting from PC to X-Box to Zune seamless. Right now, there’s still some things to remember to make things work on either platform. However, I’m pretty sure that in a (not too far) future, we might see a 100% compliant wrapper.

I have a lot more experience doing graphics with the OpenGL platform. It is not my choice however. I plan to experience XNA from ground up now. Learning with experience, testing and some projects. It might be a long road but I’m ready now.

I had this idea when I saw the RPG Starter kit for XNA 3.0. I wanted to see what 3.0 could offer and this start up kit looked great. I downloaded everything and then I tested it. I was terribly disapointed with it. I know it’s not supposed to be a complete game but I felt weird. It is maybe because of the cartoonish graphics that were too big to make the game enjoyable, I don’t know. I decided to look around for better alternative. That’s where I saw Nick Gravelyn blog and his Tile Engine Tutorials.

All his projects are for XNA Game Studio 2.0 but right now, I didn’t see any problem in using XNA Game Studio 3.0 and VS 2008 Express edition. These tutorials are fantastic. He program everything in front of you. You can’t just copy and paste the code, you have to write it down yourself. It really helps understanding what you do. Every video seems to end well with something new in your application. I really think everybody should do these. If you’re not interested in tile game, it’s ok.. but you still should do them. Why? You can also learn some neat game design rules and some really interesting tricks in it. It’s almost like some home teaching. I really encourage people to do these tutorials and between them, implment some bonus features in it. This way, you’ll still have the base idea from his video but you’ll end up with a even better product.

Not that his product is not great but think about it.. this guy had to spent hours filming for that thing, he didn’t have the time to implement every cool things he thought about. That’s where you can innovate. You will actually learn a lot more over time because you will experience the engine in greater depth and doing the later videos, you’ll have to adapt his code to yours… not only copy and pasting it.

I plan on sharing my experience here and maybe even sharing my own ideas about what you could add by yourself. Nick’s tutorials are also presented in a really concise manner so I will also provide a basic description of what is done in that tutorial. I’ll be more like a bonus read than anything.


Follow

Get every new post delivered to your Inbox.