A 3D Maze Engine

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems.

Moderator: Moderators

Roth
Posts: 400
Joined: Wed Aug 03, 2005 3:15 pm
Contact:

A 3D Maze Engine

Post by Roth »

I've always been really fond of 3D mazes, like those found in the Golgo games, Ultima, etc. Well, I finally figured out a decent way to do them, and so far, it's pretty efficient, I think. I've been messing with this for the past... 6 or 7 days, so about a week.

What I was looking to do was take the speed of Golgo 13 - Top Secret Episode mazes, and combine that with the smoothness of the Mafat Conspiracy mazes. I opted to use the same kind of screen layout from Mafat, with the big status bar at the bottom. In this way, I have less tiles to load. My initial build was good, because I got the actual maze loading and you were able to navigate around. The problem was with the screen loading, though. You could move VERY fast, but the screen flashed too much, kinda like Top Secret Episode. I believe this build is that one:

http://robertlbryant.com/temp/maze.nes

What I really wanted to incorporate was how Mafat Conspiracy loaded in one nametable, then switched to the other nametable to have a seemless transition. After alot of time debugging, going through my code, and some folks on #nesdev testing it out via different emus and a powerpak, I believe I've finally found the right balance I was looking for. Please note that if you try this in a powerpak, the currently blank status bar may have some garbage data in it, as I don't do anything to initialize how that area should look; my main focus right now has been the engine itself.

In the NMI right now, I am doing the sprite DMA (OAM, whatever it's called), loading 40 background tiles vertically, strobing the controller, and running some music. I also had a RAM palette loading with success and no lag, but for one reason or another the palette was getting screwed up when I did it, so I left it out for now. I'll get to that bit some other time though hehe The music that is in this build is from another game, but I just threw it in here to test for any dragging during background loading in the NMI.

If you download this and test it out, hold the controller like a Wiimote. The reason for this is because I would like to make this a zapper game, where the other hand holds the zapper. Anyway, this means have the left directional button pointed towards the screen. This is the UP button. Pressing backwards turns you around in the maze 180 degrees, and pressing to the sides rotates you in those directions.

http://robertlbryant.com/temp/maze4.nes

Here is a map for anyone that would like to see it:

http://robertlbryant.com/gaming/images/maze1.jpg

With this engine, maps are only allowed to be one page of RAM big, but then again, 3D mazes are a bit of a pain if they are too big, IMO. Also, if anyone wants to see any code snippets, I will paste them. Once I get the game done, the full source will be available. I just wanted to post and get some thoughts on how it runs right now: Speed of loading vs. How it looks while playing.

Thanks for your time!
Celius
Posts: 2159
Joined: Sun Jun 05, 2005 2:04 pm
Location: Minneapolis, Minnesota, United States
Contact:

Post by Celius »

Hey, this is pretty cool!

I was actually thinking of making something similar a while back. I wanted to make like a first person type ray caster or something where you could have a gun along with the controller. But this idea hasn't really gone anywhere with me. Oh, and I was thinking of making the main character a wizard that shot "rays" at enemies, and the game would be called "ray caster", haha.

One thing I would recommend (though it could be difficult to implement) would be a half-step graphic so that any action you'd do would display 2 frames of motion. So if you go forward, it would show you move forward half a step, and then the next half. Or if you turn, it will show you turn 45 degrees and then the next 45. It might get a little disorienting if you don't do something like that.
User avatar
Banshaku
Posts: 2404
Joined: Tue Jun 24, 2008 8:38 pm
Location: Japan
Contact:

Post by Banshaku »

I'm not a big fan of 3d maze but for the technical aspect of it, the demo is great.

Good job :)
frantik
Posts: 370
Joined: Tue Mar 03, 2009 3:56 pm

Post by frantik »

cool.. but is it just me or are the controls not right? it seemed like pressing left moved me forward..
User avatar
Banshaku
Posts: 2404
Joined: Tue Jun 24, 2008 8:38 pm
Location: Japan
Contact:

Post by Banshaku »

frantik wrote:cool.. but is it just me or are the controls not right? it seemed like pressing left moved me forward..
It's not you. Roth mentioned that he made the controls for using it like a WiiMote so you can use one gamepad for controls and the phaser for shooting.
frantik
Posts: 370
Joined: Tue Mar 03, 2009 3:56 pm

Post by frantik »

ah, I guess it was a case of tl;dr lol

it's tough to hold the keyboard sideways though ;)
User avatar
MetalSlime
Posts: 186
Joined: Tue Aug 19, 2008 11:01 pm
Location: Japan

Post by MetalSlime »

Very cool! I second Celius's suggestion about drawing intermediate steps so that it looks like you are moving.
MetalSlime runs away.
WedNESday
Posts: 1231
Joined: Thu Sep 15, 2005 9:23 am
Location: Berlin, Germany
Contact:

Post by WedNESday »

frantik wrote:cool.. but is it just me or are the controls not right? it seemed like pressing left moved me forward..
So WedNESday's controller emulation is not screwed up then... :lol:
Roth
Posts: 400
Joined: Wed Aug 03, 2005 3:15 pm
Contact:

Post by Roth »

Hey guys, thanks for the comments : )

About the moving thing! There are different things that I considered when making the engine, and one of them was giving the appearance of movement. The main way I was thinking was having a few different ways of doing things. Like if you move forward, have the screen start from the middle, and load it from the middle out, left and right. When turning, have it so the nametable scrolls onto the screen depending on which way you are going, and when doing a 180, something like a fill from top to bottom. When I started thinking about it though, I figured this might ending up taking longer than I would like for the pacing I want for this game, or even take away from the overall pacing of it.

I am thinking about making another engine sometime though that does these things, but I think it would be more suited for a dungeon crawler, myself.
User avatar
Dwedit
Posts: 4470
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Post by Dwedit »

Go ahead, reinvent Phantasy Star on a system not designed to run such a game.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
User avatar
marvelus10
Posts: 243
Joined: Fri Feb 09, 2007 5:01 pm
Location: Nanaimo, BC Canada

Post by marvelus10 »

This is something I'm very excited to see done. Very good Roth.
User avatar
Zepper
Formerly Fx3
Posts: 3264
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Post by Zepper »

- Quite confuse. I barely know the controls... :(
Celius
Posts: 2159
Joined: Sun Jun 05, 2005 2:04 pm
Location: Minneapolis, Minnesota, United States
Contact:

Post by Celius »

Fx3 wrote:- Quite confuse. I barely know the controls... :(
Left - Move forward
Down - Turn Left
Up - Turn Right
Right - Turn 180 degrees

It's designed so you hold the NES controller vertically instead of horizontally like the Wii controller.
User avatar
Zepper
Formerly Fx3
Posts: 3264
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Post by Zepper »

Celius wrote:
Fx3 wrote:- Quite confuse. I barely know the controls... :(
Left - Move forward
Down - Turn Left
Up - Turn Right
Right - Turn 180 degrees

It's designed so you hold the NES controller vertically instead of horizontally like the Wii controller.
OK, so I must add a "Wiimote controller friendly" next time in my emulator... ;)
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

Fx3 wrote:OK, so I must add a "Wiimote controller friendly" next time in my emulator... ;)
Or call it "Smash TViimote" mode.
Post Reply