This page is a mirror of Tepples' nesdev forum mirror (URL TBD).
Last updated on Oct-18-2019 Download

A 3D Maze Engine

A 3D Maze Engine
by on (#44502)
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!

by on (#44503)
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.

by on (#44504)
I'm not a big fan of 3d maze but for the technical aspect of it, the demo is great.

Good job :)

by on (#44505)
cool.. but is it just me or are the controls not right? it seemed like pressing left moved me forward..

by on (#44506)
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.

by on (#44507)
ah, I guess it was a case of tl;dr lol

it's tough to hold the keyboard sideways though ;)

by on (#44517)
Very cool! I second Celius's suggestion about drawing intermediate steps so that it looks like you are moving.

by on (#44520)
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:

by on (#44532)
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.

by on (#44541)
Go ahead, reinvent Phantasy Star on a system not designed to run such a game.

by on (#44590)
This is something I'm very excited to see done. Very good Roth.

by on (#44594)
- Quite confuse. I barely know the controls... :(

by on (#44595)
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.

by on (#44596)
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... ;)

by on (#44597)
Fx3 wrote:
OK, so I must add a "Wiimote controller friendly" next time in my emulator... ;)

Or call it "Smash TViimote" mode.

by on (#44598)
Fx3 wrote:
OK, so I must add a "Wiimote controller friendly" next time in my emulator... ;)


Or you could allow for the user to select a controller/change the button configuration accordingly... ;)

by on (#44621)
But you still need to let the user configure multiple modes in case the player wants to switch between A. the standard sideways config and B. the config for this maze game or Smash TV, or between A. the config for Power Pad side A and B. the config for Power Pad side B, etc.

by on (#44623)
- With respect, but bah - this Wii-friendly idea is sucks. For a NES controller? :(

by on (#44624)
Fx3: How would you have implemented Robotron style controls (one D-pad to move, one D-pad to fire) on an NES, other than through Smash TV's solution (two NES pads held like Wii Remotes)? The Robotron style games for Super NES (Super Smash TV, Total Carnage, Williams Arcade Classics) used the A, B, X, and Y buttons for shooting in various directions (A: east; B+Y: southwest), but the NES controller doesn't have that luxury.

by on (#44626)
For the past couple of days I've been busy at band practice, so I haven't had much time to work on this. I'm probably going to work out the status bar next, however. Oh, and the palette refreshing code in the NMI has been fixed. Someone informed me that if you are setting bit 2 of $2000, then it not only increments by 32 in the nametables, but in everything you do to $2007. The more you know hehe So that is all worked out now! I'll try and keep this post non-tl;dr, but no promises ; )


Fx3 wrote:
- With respect, but bah - this Wii-friendly idea is sucks. For a NES controller? :(

No disrespect taken ; )

Well, the main reason I did that was for the sake of comfort. Take Gotcha! The Sport, for instance. You use the controller to move left and right, while holding the zapper in the other hand. Now, it doesn't feel too bad with that game, but if the up and down buttons were included, then things would tend to not feel comfortable over time. With the controller sideways, it fits nicely in your palm, and you don't have to worry about cramping up as easily since your other hand isn't there to balance out the controller.


Dwedit wrote:
Go ahead, reinvent Phantasy Star on a system not designed to run such a game.


I still haven't had a chance to play that game, so I YouTubed it up to see what they do in their mazes. Pretty impressive haha No way would I even _think_ to try to make it something like that, though. I do like the way they look, however!


marvelus10 wrote:
This is something I'm very excited to see done. Very good Roth.


Thank you marvelus : )


tepples wrote:
Smash TViimote


That is entirely too clever to be left unquoted hehe

by on (#44630)
I like the maze demo, that's cool. And using the zapper with it is even better.

My friends and I used to joke about making a COPS game, which would require a powerpad, controller, zapper, perhaps the powerglove too.

About Phantasy Star, the SMS does flipping of the BG tiles instead of sprites, that must have been helpful.

by on (#44632)
- OK, I really hate to spray cold water in fire... but playing this demo with a NES controller and a zapper!? Less than 1% of guys will do that, but surely around 10% will do with an emulator. The reason is quite obvious, no powerpack (or a devkit) means no enjoyment.

by on (#44633)
Fx3 wrote:
but playing this demo with a NES controller and a zapper!?


I'm thinking Roth intends to use this concept to make more than just a demo. A game that requires the controller and zapper isn't insane or crazy; it's actually an idea that a lot of people have had, I'm pretty sure (I once thought of it myself). Seeing it finally applied would be cool.

by on (#45069)
I dusted off some old games last night and found "Dungeon Magic".. it has a pretty quick 3d maze engine.. I was impressed actually

http://www.youtube.com/watch?v=IPN76k5eN6Q

by on (#45070)
I think youtube should be avoided since it uses proprietary flash and does not work everywhere. I do not have flash, its mostly used for adds anyway. Screenshots or links to video with open codecs would be better I think. Sorry for the rant, I hate youtube (low quality and proprietary flash).

matt

by on (#45079)
i didn't upload the video.. i just linked to it as an example. :)

by on (#45093)
mattmatteh wrote:
I think youtube should be avoided since it uses proprietary flash

"I believe PCs should be avoided because they use proprietary BIOS." Point: there are some proprietary things we can't easily avoid.

Quote:
and does not work everywhere.

Nor does Theora video.

Quote:
Screenshots or links to video with open codecs would be better I think.

I'd bet an order of magnitude more people have an FLV or SWF player installed than a Theora player installed. If it bothers you, use keepvid.com to download the FLV or MP4 and then an libavcodec based player.

by on (#45105)
Sorry for the rant and off topic post. I replied in a new topic if anyone is interested.

matt

[Corrected URL of new topic --MOD]
Love the demo
by on (#45179)
The demo looks pretty nice. There are a lot of possibilities for an engine like this. I'm somewhat a fan of the old Bard's Tale series (it's like Dungeon Magic: Sword of the Elements), and this type of engine would be appropriate for that too. Shadow of Yserbius (for PC/DOS) was also this style of 3D, but it also had a nice map display and a slick party system (it was multiplayer). 1 or 2 player like this could be extremely fun, with side-by-side views or a cooperative play to help manage a large party (maybe each player could manage 4 characters in combat?)

Your idea of mixing zapper and maze crawling is interesting too, I would wonder if it could be just as fun to let it automatically guide you through the maze or to select the direction you wish to go with the zapper instead (like have some arrows in the corners/edges of the screen?)