Gathering Storm - Animating Basic 3D Movement

December 01, 2011

So, in case it wasn't clear, I have my computer back. I thought for sure the overheating had something to do with the degradation of the thermal grease, but, nope, just a silly broken fan. Which makes me feel quite silly, as well, but it's not like I didn't notice a broken fan. I could hear it running. It ran at full blast all the time. It was just off its proper axis or something and wasn't blowing away the hot air efficiently. Which you couldn't notice either because if you stuck your hand next to the vent, you could still definitely feel hot air blowing. I don't know.

Anyway, within a week of when I started programming, I was able to get a working model for first-person exploration of a user-defined dungeon of any size, which I thought was a pretty cool accomplishment. At the time, the dungeon only had two elements - 1s and 0s, a 2d array of walls and empty spaces. And my program would read that array and animate the walls in the proper places based on the player's position and rotation.

And in my newly efficient coding scheme, there were only two animation sequences - turning and lateral movement, both of which could be reversed depending on whether you were turning left or right or whether you were moving forward or backward.

Some major issues:
- Each wall element, which was a 3D block, had to be turned on or off based on the current parameters. The code for writing this turned into kind of a monster based on countless conditionals about position, rotation, movement sequence and whether the walls were in view or would come into view during the movement.
- Tied to that was a decision about how far the player could see in the dungeon: 4 squares? 5 squares? 10 squares? Each additional square of sight added more and more block animations, which were extremely tedious and time-consuming
- Yes, the block animations. As I said, two animations for each: movement in the z direction and a rotation about the center point of perspective. You would think that wouldn't be too complicated. You could even just have the code run the animations for you, but it didn't turn out that way. Sure, the z-directional movement was easy, but rotation in Flash about random points is a hornswaggle of a mess. Every time I tried to just rotate things about a center perspective, their coordinates became that of the center perspective, so all walls everywhere collapsed upon a single point as you rotated, which, needless to say, didn't work very well. I ended up have to do a frame-by-frame animation of every wall (something like 60 in total), which was total bullshit. I'm still using the code, but I will probably overhaul it at some point now that I know enough coding to think of some better workarounds for the issues I was having. Basically, the way it is now does not lend itself well at all to changing the skin of the walls, which I would very much like to do so every dungeon doesn't look exactly the same, it doesn't lend itself well to adding extra elements to the dungeons, like pits, pressure plates, doors, stairs, treasure chests, etc., and it also looks kind of bad when the graphic of the walls, ceiling and floor suddenly turns into their mirror images because of the way I was forced to program the movement.

Anyway, that was a long ranty paragraph. Here's the video!
As before, I started with a 3x3 space, though this time it wasn't for the sake of convenience, just tradition. Here's a video of actual dungeon navigation.
The darkness effects were actually added a little later, but it wasn't really that momentous of thing programming-wise, though visually it made things way better than it looked initially.

Next up: Stairs (changing dungeon levels!) and treasure chests (dialogue boxes!)

Though, first I'll probably talk about D&D some more. We had a game almost two weeks ago that I still haven't talked about. Gotta do that before the Grand Finale next week.

Leave a comment

Comments will be approved before showing up.

Also in Blog


January 31, 2024

Today will be our last Frosthaven starter class spotlight, starring the Human Banner Spear. Banner Spears were warrior representatives of the Merchant’s Guild in Frosthaven.

Read More


January 30, 2024

In today's designer diary, Danielle talks about Skills and Ability Cards used in the Gloomhaven RPG, and how these cards differ from the board game. 

Read More

Frosthaven Class Spotlght: Drifter
Frosthaven Class Spotlght: Drifter

January 24, 2024

Today our Frosthaven class spotlight will be the Inox Drifter. The Drifter can be set up to be a melee damage-dealer, a ranged damage-dealer, a support, or a tank. 

Read More