Page 1 of 2

Help on programing a DM game

Posted: Tue Oct 11, 2011 12:52 pm
by Ubermann
Hi there.

I am interested in programming a game using the flip3D game projection found in DM-like games.
I found almost nothing in google so i come here to ask for some tutorials or wevpages where i can find information about this kind of game perspective.

Thanks in advance

P.S: i dont want or need a DM engine, only the info on how to implement the flip3d part.

Re: Help on programing a DM game

Posted: Tue Oct 11, 2011 5:22 pm
by linflas
i don't know if i understand you well but... do you want to make "fake 3d", i.e. only 2d sprites like original DM ? or do you plan to use a real 3d engine ?

Re: Help on programing a DM game

Posted: Tue Oct 11, 2011 8:35 pm
by Sophia
Searching for "Flip3D" produces pages about some feature in Windows Vista, which is probably not what you were talking about.
So... what are you talking about?

Re: Help on programing a DM game

Posted: Tue Oct 11, 2011 8:40 pm
by Ubermann
I'm talking about the fake 3D used by Dungeon Master and similar. This is, using 2D sprites on a simulated 2D environment. Basically what Linflas says.

Or take a look here:

http://blog.hexagonstar.com/rpg-design- ... projection <---- Around the middle of the webpage there is an article about Flip3D.

Re: Help on programing a DM game

Posted: Wed Oct 12, 2011 12:17 pm
by Ubermann
Finally I found how to simulate a 3D environment.

Simply use 3D perspective formulae to scale down the objects to simulate distance, and make them appear higher or lower on the screen.

For walls' perspective, lets suppose we got a texture that will be a wall, like this, from front view:

Code: Select all

   A-----------------B
   |                 |
  /|                 |
<O |=================|======> Viewing this direction
  \|                 |
   |                 |
   C-----------------D
(the symbol to the left is the player's eye/camera from it's side)

Vertexes A and C will be at the normal corresponding coordinates, while B and C will be "moved" towards the center of the screen.
To do this, we have to know the distance between the player (located near the vertexes A & C) to the next game map cell, where B & D vertexes end.
Using some simple perspective formulae we can find how much we have to scale the texture in the side B-D.

Look this image:
Image

Vertexes near the player/camera are just in the border of the screen, while the vertexes far away are closest to the center of the screen.
In any case, we start drawing the objects and walls from the farthest one to the closest one, so objects and walls that lead left or right (intersections) are overlapped by closest walls or objects.

For objects like monsters or items it's pretty similar: the farther the item is, the smaller and closer to the center of the screen is:
Image

The same happens with items: they are drawn from the far to the closer, so the closer ones overlaps the farthest ones.


In this case, we first draw walls in the far distance, then walls closest to the player. Next the farthest monster and finally the closest one.


Right now, lets suppose we got a corridor with a length of one map cell, and after this, we got an intersection leading left and right.
Here, we draw first the walls that are just in front of the player which form the intersection itself. We draw then with the appropriate size and centered to the screen, to simulate they are far away. Next, we draw the objects (if any) in the intersection.
Next we draw the walls to the left and right in the corridor. In this way, those last walls will overlap some of the intersection walls and some of the items in the intersection.
Finally, we draw the monsters in the corridor cell using the same technique (first far, then close).

Also, most of the games uses some kind of distance darkening, so the farthest objects and walls are darker than the closest ones. Of course this is not realistic at all since in real life, objects in the distance are not darker but blurred. Anyway, for a game of this kind, using this darkening technique helps to offer a depth feeling.


That's basically how it works.
Hope you understand. If not, don't be afraid of asking any question.

Enjoy.

Re: Help on programing a DM game

Posted: Wed Oct 12, 2011 1:31 pm
by linflas
err.. thanks a lot but we already know all this as it is the very basics of Dungeon Master engine :)

Re: Help on programing a DM game

Posted: Wed Oct 12, 2011 2:03 pm
by beowuuf
I think the confusion was the term 'Flip3D', which the author of the page you linked to admitted was his own term for it, since he didn't know an actual term for it.

But keep posting your own findings, as I'm sure the more artistically or techincally inclined can add extra comments. There is technicaly documentation on the encycloaedia, but I;m not sure if perspective is covered.

There is also source code available for at least CSBwin, which might also help if you can spot the drawing routines in the code

Re: Help on programing a DM game

Posted: Thu Oct 13, 2011 11:01 am
by Ubermann
No, i read somewhere else the term Flip3D (not being that Windows thing).


I finally decided to use Unity3D engine (http://unity3d.com/unity), so I don't lose time creating the graphical output engine, and also I got a good engine pretty powerful, multiplatform capable, and easy to use.

Re: Help on programing a DM game

Posted: Mon Oct 17, 2011 1:55 pm
by Adamo
"flip3d" term is used in Wikipedia/Dungeon Master discussion by Doug Bell himself http://en.wikipedia.org/wiki/Talk:Dunge ... eo_game%29 :
I got a question about the playfield style of Dungeon Master. Is there a common term which the pseudo 3D 90degree flip graphic style is called? I would call it just flip3D but maybe there's a better word how this style is called? --sys2074 03:59, 28 January 2007 (UTC)

I don't know if it has a formal name, but flip3D is pretty similar to how we referred to it. There's even a function in the code with that name. The algorithm for drawing it is a painter's algorithm, although generalized for 2D. (The painter's algorithm as described in Wikipedia is not the generalized one.) —Doug Bell talk 12:44, 7 February 2007 (UTC)
Ubermann, as far as I understand, you want to write a dm-like engine from scratch for your game. But instead you could use already existing engines that simulates Dungeon Master game.

Re: Help on programing a DM game

Posted: Tue Oct 18, 2011 4:10 pm
by Ubermann
Adamo wrote:[...]

Ubermann, as far as I understand, you want to write a dm-like engine from scratch for your game. But instead you could use already existing engines that simulates Dungeon Master game.
I already took a look at such pre-made engines. The problem is they don't offer me every feature I want, such as slopes or sectors with different heights, or even rooms with non-regular shapes, but also some other features about game mechanics.
Because I don't want to try to understand other's source code, I find doing my own engine the better option.

Right now, I already have the basic perspective procedures. Buggy, but working.
I will release some screenshots in a near future.

Re: Help on programing a DM game

Posted: Tue Oct 18, 2011 4:59 pm
by linflas
well.. then if you can implement 5 squares-ahead view, your engine will be very interesting !

Re: Help on programing a DM game

Posted: Tue Oct 18, 2011 7:11 pm
by Adamo
I talked with Sophia about that and she said it is possible to rearrange the viewport - for example to implement 5 squares-ahead view. DSB is a very flexible custom engine. She could explain you all things that could be done with this engine.

Re: Help on programing a DM game

Posted: Wed Oct 19, 2011 12:02 pm
by Ubermann
linflas wrote:well.. then if you can implement 5 squares-ahead view, your engine will be very interesting !
I'm using Unity3D engine (http://unity3d.com/unity). It's a modern and powerful engine.
You can view up to infinite... if your computer can handle it.
I will implement a "fog" effect so you can make the fog to hide far objects to improve your framerate.

Adamo wrote:I talked with Sophia about that and she said it is possible to rearrange the viewport - for example to implement 5 squares-ahead view. DSB is a very flexible custom engine. She could explain you all things that could be done with this engine.
Unity3D is a full 3D engine. I find it more flexible and powerful than any other pseudo-3D engine, allowing to create complex room structures and effects, that would be impossible or very hard to achieve with classic-like engine.
Anyway, thanks for the offer.

Re: Help on programing a DM game

Posted: Wed Oct 19, 2011 1:23 pm
by linflas
do you plan to make all 3d ? i mean objects, monsters and so on, such as Grimrock or Entombed ?

Re: Help on programing a DM game

Posted: Thu Oct 20, 2011 10:39 am
by Ubermann
linflas wrote:do you plan to make all 3d ? i mean objects, monsters and so on, such as Grimrock or Entombed ?
Yes. And also realtime.
Graphics and general aspect will remember Oblivion.
Combat, inventory, gameplay and etc... will remember to Dungeon Master.

Although the game will be RealTime, the player will be able to pause the game to develop the combat strategy, something like Baldur's Gate or Icewind Dale. But it's not necessary.

Re: Help on programing a DM game

Posted: Fri Oct 21, 2011 10:42 pm
by Adamo
have you checked Rasmus custom engine? I think he`s making full 3d real time DM-like game. Check out his homepage:
http://www.rasmus-dev.com/

Re: Help on programing a DM game

Posted: Mon Oct 24, 2011 5:45 pm
by Ubermann
Adamo wrote:have you checked Rasmus custom engine? I think he`s making full 3d real time DM-like game. Check out his homepage:
http://www.rasmus-dev.com/
I have checked it out, but i don't like the controls.
I prefer a more classic HUD distribution and mouse/keyboard usage.

Even if i didn't mind that, that engine can't use advanced texturing effects, a realistic physics engine and post-processing graphics manipulation (bloom, motion blur, water waves, real time atmospheric lightning), among other, that pretty almost any moder game has.

Using an engine (like Unity3D, ShyVa, etc...) it's easy to implement all that stuff pretty easy.

I'm doing something that will look like "Legend of Grimrock", but instead of moving tile-by-tile, you can freely move.

P.D. If everything goes as planned, I will release a version for PC and Android, and maybe for MacOS and iPhones (I don't know if I can compile everything for MacOs/iPhone from a Windows PC platform from within the engine)

Re: Help on programing a DM game

Posted: Mon Oct 24, 2011 8:27 pm
by Gambit37
Pretty ambitious goals for a single man project! Good luck!

Re: Help on programing a DM game

Posted: Tue Oct 25, 2011 12:56 pm
by linflas
yep, maybe we have another rasmus here :)

Re: Help on programing a DM game

Posted: Wed Oct 26, 2011 10:22 am
by Ubermann
Gambit37 wrote:Pretty ambitious goals for a single man project! Good luck!
Not that ambitious. The only i have to develop is the gameplay logic and textures/models/sounds/music/mapping. Rendering and physics part is already done. That is one of the advantages of using a premade engine.

The hardest part for me is the modeling part, but i think there are some webpages around which offers free models.
Texturing, music and sound part is not much hard.
Mapping is pretty easy, but requires much time, since the mapping tool works with map chunks, similar to Quake map editors.

Currently, im in mapping and game logic stage. Then will do the modeling and finally the gfx and sfx part.

Another feature i have thought about was to implement a random dungeon generator (remenber Dungeon Hack?). Maybe on future versions...

Re: Help on programing a DM game

Posted: Wed Oct 26, 2011 10:49 am
by oh_brother
Gambit37 wrote:Pretty ambitious goals for a single man project!
But this is not just a man...this is ubermann. :wink:

BTW I really like the idea of a random dungeon generator, sometimes it is nice just to wander around hacking and slashing.

Re: Help on programing a DM game

Posted: Wed Oct 26, 2011 11:37 am
by Gambit37
@Ubermann, I can only assume you have unlimited free time. I wish I had enough free time to finish all the projects I've ever started, it just gets harder and harder as I get older with more responsibilities. I really need to win the lottery or something, then I could retire and just build stuff to my heart's content ;-)

Re: Help on programing a DM game

Posted: Wed Oct 26, 2011 6:45 pm
by Ubermann
Gambit37 wrote:@Ubermann, I can only assume you have unlimited free time. I wish I had enough free time to finish all the projects I've ever started, it just gets harder and harder as I get older with more responsibilities. I really need to win the lottery or something, then I could retire and just build stuff to my heart's content ;-)
Yeah, i have unlimited time... until busy time starts ^^

Actually i can only work on this something like 1 hour each day, maybe 2, and not every day.

But i never told this will be released tomorrow. Just "when it's done".

Image

Re: Help on programing a DM game

Posted: Wed Apr 25, 2012 8:56 am
by Babe Bridou
Using Unity you're going to meet a few tough problems, one of which being the items/monsters on other levels as objects/instances or as just data. If you want the game to be a single level (eg: where you can look down a pit and see where it goes) you'll have to "cheat" because no engine and no rig can sustain so many objects in memory interacting with each other.

In other words, you're going to have to design a bridge between the Unity engine and your Game engine, or else your levels will end up rather small and completely isolated from each other. The closest I've had it going (but true enough I haven't worked on Unity all that much) is to have only three levels active at a single given time. Fast movement or free falls in pits would then depend on the speed of the machine to instanciate the levels fast enough so you don't fall through the world.

What I'm saying is you can't just use Unity or any other modern engine to build a massive 10-stories tiled dungeon filled with walls, items and creatures on a single scene and expect it to just work as is - it requires the right ideas (which I lack) and possibly a lot of work :)

Re: Help on programing a DM game

Posted: Sat Mar 01, 2014 7:24 pm
by MadMunky
Sorry to drag up an old thread but does anyone know of any web sites which talk about the logic to create a 2d style dungeon master game. Someone told me there used to be a Amiga programming book which had a tutorial, im not worried about what language its written in more the concepts.

I'm currently trying to work out how is best to show the correct side of a wall based on the players position/direction

i.e. if you have a wall which has a banner on the south wall, I don't want to show it on the North/East/West Walls.

If anyone knows to guides about making a Dungeon Master style of game it would be most helpful, I'm trying to see what I can create with JavaScript/HTML Canvas if anyone is interested take a look at https://github.com/madmunky/Bloodwych
I've got the basics going reading the original bloodwych map in limited detail.

Re: Help on programing a DM game

Posted: Sun Mar 02, 2014 6:37 pm
by beowuuf
Can't help with the question I'm afrid, but good to still see you around!

Re: Help on programing a DM game

Posted: Mon Mar 03, 2014 9:05 am
by zoinkers
There is definitely an Amiga Shopper issue which had a thorough tutorial (and maybe implemented it with AMOS - not sure on that). It was what I based my version on. I think I've got a Python version somewhere if you want it. As all the issues are scanned and online, there's no reason you can't find it. I tried looking, but only have a certain number of issues local and am on mobile broadband so can't download them wantonly.

The Python version, and the assembler version, are pretty much direct implementations of the tutorial with display code. To run the Python version, you need Python 2.7 with the suitable version of PyGame installed.

Re: Help on programing a DM game

Posted: Mon Mar 03, 2014 10:50 am
by MadMunky
Thanks beowuuf, I've not gone anywhere just not really had anything to post about :)

zoinkers: Thanks for the python source, I'll take a look but I think I have made a solution for me issue.

Re: Help on programing a DM game

Posted: Mon Mar 03, 2014 12:19 pm
by ebeneezergude

Re: Help on programing a DM game

Posted: Wed Mar 05, 2014 11:05 pm
by MadMunky
Thanks all for the help, finally manage to get this working - http://bloodwych.co.uk/bwhtml/bloodwych.html

Still early days..