XNA on the Second Day
by dwarfsoft on Mar.05, 2009, under Game Development, XNA
The reason for this was that no matter how bad the game ended up, it would do mostly what it was told, and in the process I would have completed the project and have gained some valuable insight into both my own programming methodology, and into the XNA framework from start to finish.
I have decided not to paste all the code into this page, as it got quite hacky, even moreso than last time. I haven’t included the code also due to the fact that it can be considered a way NOT to make a game. There are things in the game that really should have been designed in order to work effectively. Anyway, to run the game you will need XNA 3.0 and the .NET Framework.
Breakout Game Binary
Breakout game Project Files
Also: I do understand that the game is not exactly polished. There is no backing music, there is only the sound effect for collisions, and the Vector of the ball from restart is not increased. There is, however, some level progression. For each “level” increased, the Maximum Vector of the Ball and Paddle increases by 1 in X and Y (obviously the paddle doesn’t increase in Y though ๐ ).
Things I Learned, which I posted over at A XNA Experience
- A SpriteManager class would be very useful (instead of relying on the Collision class)
- The Different Sprites should have their own Class Inherited from Sprite, so that Movement is not so Hacked
- Collisions should Callback to the Game class so that appropriate scoring need not be Hacked.
- Offscreening all the Block Sprites in one location really does make the Collision Detection System Workโฆ. badly (as none of the Blocks ever move because of their collision, its a waste of resources) ๐
- Collisions should only be checked on the Moving object, not all objects, so as to save some of those precious cycles.
- For some reason when the ball and paddle head toward each other and collide on a diagonal, the ball gets stuck. I still haven’t figured this out, but it should be fixed by having a Class for the Paddle and a Class for the Ball with their own unique Move()/Collision detection functions.
At some point in the future I would like to attempt to remake the game, with the above elements taken on board, and see how long it takes to finish a polished game from that basis point. Effectively this game is like a prototype so that important design decisions can be extracted for the real thing.
I will consider what my next project will be and what time frame I expect to be able to complete it in.
Cheers, Chris.
Goog article. Looking forward on hearing on the final polished version. Have you thought about trying to do the same with SDL.NET? A .NET bindings for the SDL gaming library and it works with mono too. (http://cs-sdl.sourceforge.net)
I hadn’t thought about specifically doing SDL.NET, although I had thought about getting to a point of writing portable games. I will definitely look into it though. I also do not wish to get bogged down creating only different platform versions of Breakout, as you can imagine how tedious that would become very quickly :). Still deciding what game will be next if I want to do a different game before the Polished Breakout.
True. All Breakout might get a bit boring. I have been thinking of making a small game tutorial on sdl.net, but haven’t decided on what kind of game yet; Breakout clone has been one choise. Either that or a Snake -clone.
Options I am considering are:
Breakout
Pong
Frogger
Pacman
Falling Block
Tetris
Space Invaders
I might as well do the revised Breakout in the interim while I am deciding whether to tackle Pacman with its Ghost AI sooner rather than later, or if I should simply stick to random block games where user input is key. Space Invaders should be pretty easy, and it could branch out into many of those space fighter games with the waves of enemy attacks. Requires pretty much no AI as they follow pre-programmed paths.
Eventually I hope to head into doing a Tile Engine with a small world. I will have to take some time out to check out SDL.NET though.
“A SpriteManager class would be very useful (instead of relying on the Collision class)”
I read this, and this engine came to my mind: http://www.flatredball.com/frb/
check it out (especially the wiki), you’d be even more surprised.
I’ve recently been working on a Breakout clone in Java for a university assignment. Unfortunately I can’t share the code yet as it hasn’t been graded (and its not finished!).
Our situation is similar because we both had to get to grips with an environment we didn’t have previous experience with. I blogged about my progress:
http://james.blogs.lincoln.ac.uk/2009/03/09/codename-ballbreaker/
http://james.blogs.lincoln.ac.uk/2009/02/22/game-development-with-java-and-midp-20/
James