Gathering Storm - Stairs and treasure chests, the basic blocks of dungeon building
December 11, 2011
So we left off with a riveting foray into the third dimension (well, you could still only move in 2, but it kinda looked like 3D). From there I went about implementing what every good dungeon needs - stairs and treasure chests.
And I immediately ran into two separate problems. With the stairs, it was more of a time-consuming animation problem, whereas the treasure chests posed some very complicated programming problems.
For some reason, I decided that since the stairs were made entirely of planes connecting to other planes at 90 degrees, I would make my stairs fully 3 dimensional instead of 2D sprites, which resulted in me creating something like 20 different graphic files for both upstairs and downstairs that became all these aforementioned planes. I then had to go into Flash and basically assemble the staircases from their graphical counterparts. A basic exercise in 3D animation, I'm sure, and I took to it well enough. It ended up looking pretty good and it didn't take too much time.
Still using the same brute force method of animating movement, I then had to animated these new 3D objects in all possible movements from all possible positions. Actually, I took a small shortcut here and decided, both in the case of treasure and stairs, I would place them inset from any turn in the dungeon, so the player would really only be able to see them if they were directly in front them (or directly to the left or right in the case of turning). This cut the animation down by at least a half, which was a welcome relief, given the vast amounts of monotony that accompany animating all this movement by brute force.
Oh, right, then I also had to animate moving up and down the stairs, as well as program how it would work. Given my chops in basic 3D animation at this point, the animation sequence of rotating perspective, moving in x and y, then fading to black was pretty straightforward. As was the programming for that matter. A second floor just required a second 2D array and an extra variable that I could use to switch between the two.
Here is a video of some stair movement:
Adding treasure chests, on the other hand, posed one major problem I was unprepared to deal with: dialogue. Once a player opened a chest, they needed to know what was inside, what happened to what was inside, etc. I needed a dialogue box that would pop up and provide them with all the pertinent information.
So I set about tackling the dialogue box monster. I had very specific needs from my dialogue boxes and I was determined to get it straight the first time I dealt with them so I didn't have to do some messy overhaul later.
And maybe I am not communicating the gravity of the situation appropriately. Any old chump can make a box pop up with text in it supply some trivial information, but my dialogue needed to be more dynamic. There is going to be a lot of dialogue in this game. Characters are going to talk to each other a lot. I've got 10 personalities to fully flesh out and an infinite canvas to do it in. Okay, maybe infinite sounds too daunting, but anyway, I needed to pull out whatever tricks I could to keep players interested in the dialogue, and as far as the dialogue box is concerned, that means auto-typing text.
Auto-typing text is just when you see the text typed out in real time instead of seeing one big block all at once. I feel it makes the reading of the text a more active experience and would help to engage the player. So, not knowing how on Earth to do something like that, I went on the Internet and found some example programs and incorporated them in my code. But it was far from a cut-and-paste Internet adventure because I needed multiple dialogue boxes in succession and I also needed the ability to skip
You see, walls of text are all well and good (my love of text walls is demonstrated clearly in this blog), but it's not everyone's cup of tea. Some people play Flash games so they can get some quick action, and reading extended character-driven dialogue between two characters just might not be what they want to get out of my game, so I really wanted to minimize that pain for them. I remember myself trying to play "Shooter RPG: Starwish" a while back. I was into it because it was some good space shooter action combined with ship customization and experience levels, but there were literal chapters of dialogue in between every single mission that took as much time to read through as it did to play through the mission and I just couldn't handle it. I don't know if the writing was lackluster or I just wasn't looking for an in-depth story, but I never got close to finishing that game.
Also, what if you just read faster than the game is auto-typing? Clearly we need to be able to skip the auto-type, i.e., when you press Z, the auto-typer immediately fills in the whole text box. Once that's implemented, you can just hold down Z and skip through pages of dialogue in the blink of an eye.
So anyway, text skipping and multiple sets of dialogue prompts forced me to actually understand the code I was copying, which consisted almost entirely of commands and functions I had no clue about, but I eventually powered through and here is the result!
Note: That menu that pops up before the treasure is opened wasn't implemented at that point, of course. At that time, I just pressed Z and it immediately went to the dialogue box, which said something along the lines of "You got an item! Good Job!/Here's another box of text to make sure it's implemented correctly!"
I eventually was able to fully deconstruct that auto-write function so that it can take messages from multiple sources of code simultaneously and dole them out to the player one at a time, all without interrupting the flow of control, which I am happy about. I am definitely more proud of my dialogue boxes than I am of the broke-ass way I am animating movement at this point.
Up next: After a long stint of drawing up some character portraits (5 out of my cast of 10) and a single monster sprite, I set about working on an out-of-combat menu system for handling inventories, statistics and way too many other things.
Leave a comment
Comments will be approved before showing up.