Welcome to Dream.In.Code
Become an Expert!

Join 149,507 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,333 people online right now. Registration is fast and FREE... Join Now!




"3d" dungeon map game

 
Reply to this topicStart new topic

"3d" dungeon map game

destroysound
29 Jul, 2007 - 09:32 AM
Post #1

New D.I.C Head
*

Joined: 29 Jul, 2007
Posts: 2


My Contributions
Hi everybody:

Hoping that someone has an article, a tutorial, or something similar that can help me out.

I'm trying to write a 3d dungeon rendering application similar to many 80s computer RPGs: the Bard's Tale, Ultima Underworld, Eye of the Beholder, Alternate Reality: The City/Dungeon, Mordor: Depths of Dejenol, etc, etc, etc. Eventually I hope to use the view as an interface for an online game.

I have a working renderer up and running, but I'm having some problems with perspective. I'd really like to see other people's solutions to this problem, but it seems that invariably everyone makes different design decisions. For example, I found someone who was using DOM/CSS to draw the "3d" view, but the dungeon map uses grid squares that can be either "on" or "off", whereas my implementation allows each wall to be turned on and off individually.

My game will allow for large open spaces as well as small corridors and the view should render correctly regardless of the amount of open space between the wall and the point of view.

Anyone have any experience with this?

Attached Image
User is offlineProfile CardPM
+Quote Post

destroysound
RE: "3d" Dungeon Map Game
29 Jul, 2007 - 09:46 AM
Post #2

New D.I.C Head
*

Joined: 29 Jul, 2007
Posts: 2


My Contributions
I should add that any examples are helpful regardless of the language as I am more or less interested in the drawing procedure being used, not the underlying technology.
User is offlineProfile CardPM
+Quote Post

WolfCoder
RE: "3d" Dungeon Map Game
29 Jul, 2007 - 01:19 PM
Post #3

ギュウ~
Group Icon

Joined: 5 May, 2005
Posts: 3,711



Thanked: 8 times
Dream Kudos: 1450
My Contributions
I've written something like that before. I wrote a software 3D polygon drawing program and I decided to write something like that. I decided how many spaces ahead the player can see and then wrote a runtime compiler that would generate the triangles that make up the scene.

Here's how it kinda went:

I had a map, each element of the map array held a number for the kind of piece it was (corners, straight, stairs, ect...).

Whenever the player moved, the program would generate everything in a 7 by 7 square around the player, and the square the player is immediately on. It would create a list of polygons to send to the sorter/drawing part of the program (creates the 3D scene) and then you would see where you are.

At the BEGINNING of the move, the polygon list would have transformations applied to it to give transitions (walking forward, turning ECT.). Don't be afraid to make the walls and stuff a little more detailed as well as adding special shaped square objects like statues and pillars and the like to break monotony and make it feel somewhat unique for each floor of the area/town/dungeon.

I can't give any specific code since it won't help you, but here's my design (i was just playing around but i always make some design documents anyway):

Full Map List Array
|
|
V
Triangle Compiler
|
|
V
Temporary Transformed copy of the triangle list --> 3D TRIANGLE RENDER (in my case it was software instead of DirectX)

It was compiled from the map, transformed if in the middle of movement transition, and the transformed copy of the compiled triangle list was sent to the graphics library to be shown. At the END of the movement transition the triangle list was re-compiled at the new location. The wider viewing range you set it to, it exponentially increases in the time it takes to be compiled.

This post has been edited by WolfCoder: 29 Jul, 2007 - 01:29 PM
User is offlineProfile CardPM
+Quote Post

Trogdor
RE: "3d" Dungeon Map Game
30 Jul, 2007 - 01:51 AM
Post #4

D.I.C Addict
Group Icon

Joined: 6 Oct, 2006
Posts: 549



Thanked: 4 times
Dream Kudos: 125
My Contributions
The first choice to make is whether you want it to be truly 3d or with a 'prefab' approach.

The games in the 80's often used sprites (or similar) for objects/walls, and the only thing they did was select some sprites (close / far / very far, left wall right wall front wall) and put them in the right places.

On the other side there is the technique that wolfcoder described, but that is more of a real 3d way to do it.
User is offlineProfile CardPM
+Quote Post

TheFlipside
RE: "3d" Dungeon Map Game
17 Aug, 2007 - 11:22 PM
Post #5

New D.I.C Head
*

Joined: 9 Aug, 2007
Posts: 9


My Contributions
Maybe an idea is to use raycasting (like wolf3d and doom). Since your movement is static (I suppose) you can render high quality screen with this method. The method is also very easy to code. Search for raytracing tuts on the web. Good ones are those from PXD. These are in Turbo Pascal, but are very easy to understand. can be found on www.programmersheaven.com somewhere in the graphics section.

Greetz
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 07:12PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month