September 12th, 2009
Hello again. It’s been 3 and a half hours since I started this project and damn do I have a lot done! The first important lesson is that code reuse is great! I don’t think I’d have as much done as I do now if I had to rewrite everything from scratch. However, there have been some nasty subtle bugs because of the reused code, so I ended up spending time debugging and rewriting entire sections. This is mainly due to how entities move in this game. In UGH, they moved one tile length at a time but “slid” from tile to tile. A lot of the old moving and entity updating code had to go.
So what have I complete so far?
- Loading tiles from a .png file (copied)
- Loading entities from xml (copied)
- Created the entity manager
- Draw the PC and the monsters on the screen
- Move the PC with the Xbox 360 controller
- Move the monsters via their own AI. There are two types “Aggressive” which will always follow the player trying to hurt him and Neutral. The neutral AI runs around aimlessly, but turns aggressive it gets hit the PC. (about 50% copied, 50% rewritten)
- Created the Monster Catalog. (copied)
- All entities do collision detection so that they won’t step over each other. It’s not 100% perfect and it can lead to weird gridlock issues, but it’s workable for now. I’ll probably look at it more later.
So, next I’m going to tackle combat. This will mean that a bad guy will try to seek out the player and “collide” with it. If that happens, the player takes damage. Then I will implement a way for the player to defend himself by lobbing fireballs at his enemies. This will new entities spawned and if they collide with any entity, the entity takes damage and the fireball “dies.” I’m expecting this to at least take a few more hours.
Here’s a screenshot, you’re the red wizard. There are around 100 entities on the screen and everything is running very smoothly:

Posted in 40-Hour Game, Game Programming | 1 Comment »
September 11th, 2009
Alright, I promised that I would update as I got stuff done and so, here we are.
I’ve set up the environment, I’ve got a nice black screen running at 1280×720. Now the clock starts for real. It seems that I will be able to borrow more than I expected from my UGH and Zune remake of UGH projects. This is good as any time saved is useful.
I do feel like a I’m cheating a bit, but then I look at the list of things that needs to be done and I don’t feel so bad any more
.
I’ll post the next update when I have something running around on the screen!
Posted in 40-Hour Game, Game Programming | No Comments »
September 11th, 2009
As I mentioned yesterday today I’m going to put up a schedule of what I need to do and how much time I have to do it. Since I’ve only 40 hours to do this, I need to lay out the work in the most efficient manner, but in order to keep my concentration and keep my excitement for this project up, I’m also trying to maximize my “instant gratification.” Nothing more monotonous that doing 16 hours of back end work not knowing if it’ll work.
Ok, let’s break down what I need to do and the order in which I need to do it in.
- Set up the XNA environment and create a basic “Hello World” application. As I mentioned before, this will not count against my 40 hours.
- Load tiles from a .png file. This should not take very long as I’ve got code that does this already. Remember, it’s ok to reuse code in this build
- Load the entities. These are the PC and the monsters. It’s not just the graphics, but also stat information on the lot. For the monster it’s just basic information like “name”, “hit points”, “attack power” and “defense”. For the player it’s going to be all those plus his level, xp, and inventory. This will take a little bit longer, but through the magic of XML serialization it should be a snap.
- Create an entity manager that will update all the entities every tick. This includes running the monster AI (such as it is) and updating the player’s position based on input. Note: Monster AI is not created yet.
- Draw the PC. On a nice black background, draw the PC.
- Create input scheme. Create the input scheme for player. At very minimum we need to track the player’s movement with the left-stick and orientation with the right-stick. The Start button will be a way to pause the game. Though we’re making a tile-based map, the player is not confined to tile-based movement.
- Create the Enemy AI. This should be simple enough. Wander around aimlessly unless the player is within range, then move to attack.
- Engage in Combat! Allow monsters to hurt the player if they touch him. This includes ending the game if the player reaches zero hit points.
- Draw the monsters. At this point we should have a bunch of monsters moving around in the blackness of the monitor trying to move toward the player.
- Create a Monster Catalog. The monster catalog will list all the bad guys by level. It will be used my the map generator to populate the level, and possibly to track the player kills and kill by player.
- Create a Treasure Catalog. Similar to the monster catalog, this will catalog all the treasure types so that level appropriate gear can be dropped either in the dungeon or by monsters. The items come in the following flavors:
- Instant use items: Touching them uses them instantly like a health bonus or damage bonus
- Inventory items: Touching them put stores the item in your inventory like a health potion that can be used later
- Spell upgrades: Each level will have a spell upgrade that increases the attack power of your spell.
- Armor upgrades: They’ll make the player more resilient to damage.
- Create treasure entities and display them in our black void. The player should be able to pick them up.
- Create a randomly generated tile-map of the dungeon. I have such an algorithm, but it needs to be modified or completely rewritten to allow for far larger rooms and far more monsters.
- Draw the map on the screen. Self evident!
- Implement collision detection against the walls of the dungeon. We don’t want the player or the monsters to walk through walls, do we?
- Implement a viewport. This will keep the player in the center of the map and scroll it smoothly as he walks around.
- Limit visibility! Only show the parts of the map that have been discovered by the player.
- Implement a way down to the next level and up to the previous one. We’ll keep the previous levels in memory so that the player can move back up to them. The entity manager will only update entities on the same level as the player.
- Implement 20 levels and the victory condition!
There it is. It looks like a lot of work, but I think it’s manageable in 40 hours. Of course, the end result is not going to be a super-polished game, but hopefully something that will be fun to play. I may dedicate a second 40 hours to add polish and other interesting elements. Multiplayer over Xbox LIVE would be nice… but let’s not get ahead of ourselves.
I’m going to post an update every time I complete one of these points, with screenshots where applicable. Of course these post do not count as toward my 40 hours.
Looking at my schedule, I think I’ll be able to start on this tomorrow. Let’s see how much I get done.
Posted in Personal | No Comments »
September 11th, 2009
… Alright, so years ago I tried to do a 40-Hour game project and failed miserably. Once again it was plagued by my inability to finish the game. Sad. Am I utterly incapable of finishing what I start? I like to think not. I recently started and finished a small humorous video I did on my spare time. This has invigorated me to finish some projects that I have started — and the one that has been a sore spot for a while now is the 40-Hour game.
There are three project that I want to finish: the 40-Hour game, my mechanical hand project, and my LED lamp project that I have not talked about on this blog but been trying to work on for a few years now.
Anyway, this post is about the 40-Hour project, its score and the deliverables. I’m going to use these 40-Hours to make a fantasy themed real-time monster-shooter… Here’s what I’ll be doing:
- Using the XNA framework. The emphasis is to get this working on the PC. Seeing it in action on an Xbox 360 is going to be the “prize” for finishing this project.
- 2D tile-based map. The map will be smooth scrolling, the player will always be in the middle. It will be randomly generated.
- Input scheme will be an Xbox 360 controller. The left thumbstick will move the player, while the right controls where the stream of magic goes.
- Random powerups are tossed around the level.
- Each level has an exit to deeper level.
- Sound effects for the zombies and weapons as well as a few one-liners for the PC.
- Background music to kill monsters by.
Now, that is a lot of work, and I’ll break down my schedule and what I’ll be doing in the next post. Regardless, this is going to be a lot of work so I’m going to cheat a bit. I’ll be utilizing these resources:
- Graphics and sound effects I find on the web
- Various bits of code I have developed over the years. I’m not sure how much it is, or how useful it will be be, but at the very least I’ll be using the same ideas
- Not going to count the time it will take me to set up a project with XNA or figuring out how that framework goes together. I worked with it several version ago on UGH and it has changed quite a bit since then.
As a matter of fact, to the keen reader, this should sounds very much like UGH. There are some differences, though I’ll probably maintain the same look. The biggest difference is that the game is real time instead of turn based. Combat and magic is very different. In UGH, you “bumped” into an enemy to attack them. In this one, you’re a wizard shooting fireballs like nobody’s business. You probably don’t want to be “bumped” by the bad guys. The randomly generated dungeon will have to be very different to allow for the more frenetic gameplay (bigger rooms). In the end, I’m taking a lot of ideas from UGH but very little of the code.
Let’s see if this time things go a little differently.
Posted in 40-Hour Game | 1 Comment »