Upcoming Events
Unite 2010
11/10 - 11/12 @ Montrιal, Canada

GDC China
12/5 - 12/7 @ Shanghai, China

Asia Game Show 2010
12/24 - 12/27  

GDC 2011
2/28 - 3/4 @ San Francisco, CA

More events...
Quick Stats
106 people currently visiting GDNet.
2406 articles in the reference section.

Help us fight cancer!
Join SETI Team GDNet!
Link to us Events 4 Gamers
Intel sponsors gamedev.net search:

How To Build a Game In A Week From Scratch With No Budget


The Development Diary of Hackenslash: A Game In A Week

Hour 1 – Wild Freeform Design and Base Classes

I spend this hour creating some basic classes for the game – and using these to help guide my design. The world is represented as a series of rooms, connected by portals. Everything in the world is room-relative, similar to how old Adventures and MUDs are designed. Most objects in the game are represented by a "GameObject," which has a position and contents (which include other objects – a map might contain rooms, a room contains a box, a box contains a sword… and I guess the sword could contain more rooms, but we won't go there.)

  • I create a "creature" and "player" object
  • I generate a set of "attributes" off the top of my head for creatures, and put this in a class. Apparently I'm a game geek who has played way too many RPGs. I don't know exactly how the game mechanics will work, yet. This really is seat-of-the-pants game development!
  • I make a "room" object, derived from GameObject. Rooms have width, height, and walls – and not much else right now.

I figure out how things will work and make corrections as I go. I don't even have PyGame linked in at this point – I don't even have anything other than a console for output. But I feel like I've made great progress!

Hour 2 – PyGame 101

The goal this hour is to initialize PyGame, and start putting things on the screen. Actually, I spend most of my time going through the PyGame documentation and figuring out how to do things, since I have almost no experience with PyGame or SDL.

I end the hour bringing up a blank screen filled with black. So far, it's not very impressive. Actually, there's quite a bit going on behind that black window – sort of like the Black Triangle story. There's a functional game-loop, page-flipping, the calling of several classes, and a lot of stubbed behavior.  But that doesn't make the black screen any more impressive.

Hour 3 – If the Walls had Ears, I'd be cussing at them.

This hour's goal is to get a room's walls displaying on that black screen. To make this happen, I need a room, and I need graphics. I spend a lot of time in GiMP touching up some textures downloaded from Mayang's Free Textures, so that they tile. I create a texture manager class. And I fill out a sample room structure. I also spend a bit more time looking through PyGame's docs to see if there's anything else I can use that might make the job easier.

At the end of the hour, I still don't have walls on the screen.

Hour 4 – The Inn Now Has Room

After fighting some syntax errors, I finally get the walls to appear on screen. Not displaying correctly – they are in the wrong positions, with gaps between segments. It's horrible. But with a little bit of tweaking and bug-fixing, I have something resembling a 10-square by 10-square room on the screen.

Without a really detailed project plan, it's really easy to get lost when you get to one of those points where you wonder, "What next?" It's very easy to get stuck chrome-plating what you've already done without moving on to the next task. I decide that if drawing one room is good, drawing two rooms is better, and move forward towards this goal.

  • I create a "minidungeon" file to handle the generation and storage of these rooms.
  • I start adding logic for "portals" – holes in the wall that lead to other rooms (and provide all the offset information necessary to draw the adjoining rooms).

Hour 5 – Hackenslash Gains More Rooms

  • I Change the title of the window to be "Hackenslash!" Just because it was cool.
  • I create a Map object to contain rooms, and a MapMaster class to hold multiple maps.
  • I add a second room connected to the first via a portal.
  • Neighboring rooms connected to the current room via portals are now displayed.
  • I fix some clipping bugs where the walls aren't displaying correctly when partially outside the viewport.

Hour 6 – Wherein We Practice Our Mad Drawing Skillz

  • I add a door class, and set up the maps to accommodate doors (since these need to be shared by two rooms). (Editorial Note: Too bad I never got to actually use these!)
  • I create 3 more wall tiles, combined them together into one "sheet"
  • Walls graphic changes based on type.
  • I make a simple top-down player-graphic.

Hour 7-8 – Rotations and Exclamations!

  • I figure out how to have PyGame rotate bitmaps.
  • I have the test-player spin slowly in a circle. Lots of tweaks are necessary to correct for size changes as he rotates.
  • I learn how to use fonts in PyGame, and I build some classes to  display and animate text.
  • I add a manager class to automatically handle all this animated text. Having them be "fire and forget" means they'll be much easier to maintain, and I'll be more likely to use them in the future.

Hour 9-11 – Feature-ific!

Once again, I face a troublesome "What next?" decision.

Rooms need more interesting features, so a "feature" element goes onto the list. I don't know what sort of behaviors features should have, so I decide to go from specific to general. I decide on three static features that could be found in a dungeon room: A rug (visual only), a pillar (blocks movement and line-of-sight, like a wall), and a staircase (blocks movement from some directions along some tiles, and "teleports" you to a new location at the end.)

I determine that features can be larger than a single square, and should be able to be rotated any ninety-degree step. (Editorial Note: In retrospect, a very dumb decision – I spent way too much time on this feature and derived very little benefit from it.)

I end up spending about three hours working on "features," between graphics and fighting some poorly designed code.

Hour 12 – 13 – We Want Loot!

I create art and code for items. It's amazing how much time can get sucked away doing artwork. It's particularly annoying when it still ends up looking like dumb programmer art no matter how hard you work on it.

I add a lot of details for items, including their value, size, equipment slot, graohics image data, and so forth. They aren't interactive yet, but at least they are being drawn in their correct locations in the room.

Hour 14 – Carpets

I'm clearly behind schedule, and what do I do? I decide that the black background is too ugly, and I put in floors.

After working on the floor graphics, I discover that I'd forgotten to put a transparent background on the player and item graphics. So I spend more time fixing them.

But the floors look cool. Cooler than black, at least.

Hour 15-16 – Click! Click!

  • I implement mouse control and event handling.
  • Add player responses and movement to mouse events. The movement is blocky, not yet smooth-scrolling.
  • The player isn't yet leaving the rooms or checking for collisions<
  • I fix several bugs
  • I create a prettier-looking staircase in GiMP.

By now, I've already crossed the threshold of Hour 17, so I start to get a little bit nervous. I should now be 2/5ths of the way done with this game – the second "working day" of development. While what I've got up and running is pretty impressive thus far, I recognize just how much I've got left to do. I now have 4 more working hours to finish up basic player interaction according to the schedule. It's going to be tight… but I still don't regret putting those floors in!

Hour 17 – Smooth Move, Until You Hit the Wall

  • More time is spent cleaning up graphics and fixing bugs.
  • Add collision detection and smooth-scrolling to player movement.
  • Player can now move multiple steps (turns) on a single mouse-clock.

Hour 18 – Crossing the Threshold

  • The player now goes through portals into other rooms.
  • This exposes a cosmetic bug with overlapping walls and floors between adjoining rooms that is really jarring.
  • More bug-fixing on rotated portals not allowing / prohibiting movement.

Hour 19 – Stairway to Heaven, Menu Hell

My brother volunteered to do some music for the game. He did the music for Void War, and is really good. This reminds me that I need to do sound (and now music) for the game. This looks pretty simple in PyGame, so it shouldn't take too long (Editorial Note: I never did get around to this, sadly. Hackenslash ended development as a silent game.)

My next goal is to handle interactions with creatures and items in Hackenslash. I'm really fond of how The Sims and Neverwinter Nights did context-sensitive pop-up menus that appeared when you wanted to interact with a game object. I'm thinking of doing something very similar here.

  • I get stairways to properly 'teleport' the player to a new room.
  • I do some research on the Internet and through PyGame docs to see if anyone already has some kind of menu system in PyGame already done with an open license that I can use. I don't find anything.
  • I start work on the menu system.

Hour 20 – 21 – What's On the Menu?

  • I continue work on menus. Menus can be associated easily with the object that spawned them, making it easy to 'call back' to the originating object with a callback to handle the player's selection.
  • I start work on item menus. They simply pop up and allow a selection at this point – clicking on an option does nothing but close down the menu.

Hour 22 – Falling Asleep at the Wheel

  • I continue work on items – trying to make them functional and have them respond to menu commands – this includes putting more contextual information about the menu in the player's "action" queue. Right now there's still not much that the item actually does, except create an animated 'bark' reflecting command information.
  • I improve how movement is calculated for performing an action, which allows more flexibility.

It's getting very late – I'm finding myself "zoning out" while working on this. If I wasn't paying attention to the total time – sure, I'd work through it. Since I'm on a limited number of "work-hours" for the development of this game, having a less-productive hour is really bad news. It's interesting how your priorities shift when you consider time a limited resource. So I go to bed.

Hour 23 – Stat Attack!

  • I modify (and actually start USING) some of the attributes class that I created in Hour 1.
  • I create a window in the upper-right corner to actually display those stats.
  • I optimize said window so that it is just a bitmap that quickly blits on screen, rather than writing out font instructions every frame. I update the bitmap only when I detect a change in the stats.

Hour 24 – Player Menus

  • I wrap up optimization on the stats window.
  • I create a pop-up menu that appears when the player clicks on his avatar.
  • I create sub-menus for potion usage, casting spells, etc.
  • I fix some bugs in the menu response handling.

Hour 25 – I Take A Saw To Floors and Walls

This morning I had an idea in the shower (why is it that the shower is such a great place to have ideas?) for eliminating the overlap problem for walls shared by rooms (see the Hour 18 entry). What if I only draw half of the exterior walls (walls 0-3) in a room – the half facing into the room? That way there'll be no overlap with walls of neighboring rooms, and I don't have to add some complicated logic to detect and resolve overlaps.

I begin work (yet more engine / foundation work) on this "quick fix." Unfortunately, it really complicates my room drawing routing (for floors as well), and turns out to not be as quick a fix as I had hoped. It takes about an hour to create and debug this system to make rooms more seamless.  But the results are much nicer.

While debugging the code, I discover a few more movement bugs related to crossing portal thresholds with negative offsets, and fix that.





The Development Diary of Hackenslash, Pt. 2


Contents
  Introduction
  The Development Diary of Hackenslash
  The Development Diary of Hackenslash, Pt. 2
  Aftermath: The Post-Mortem

  Printable version
  Discuss this article