Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2

Author Topic: Experimental map viewer  (Read 2708 times)

nornagon

  • Bay Watcher
    • View Profile
    • nornagon.net
Experimental map viewer
« on: August 02, 2008, 01:55:28 am »

This map viewer came about as a result of the recent discussion about the presentation arc, as a possible direction I think the map viewing part of the interface could go. It's mostly centered around providing the player with a better feel for the 3rd dimension of the world. I imagine the game would still be primarily played in a top-down mode, and that the true 3D part of this interface would be used only when ambiguities arise, or when the player wants to 'feel out' the landscape.

Spoiler (click to show/hide)

There is a Windows executable (mostly untested) here: http://nornagon.net/dfviewer.zip

The source code is available here (you'll need SDL and zlib to build it): http://nornagon.net/code/dfmockup.tar.gz

Drag a .fdf-map file to the .exe to open it. On Linux, run './view whatever.fdf-map'.

The controls are:
Arrow keys move around by five-tile jumps.
Middle-click and drag to move around in top-down mode.
Left-click and drag to enter 3D mode and rotate.
Scroll button zooms in 3D mode.
'<' and '>' (or '.' and ',') to change the z level.
'[' and ']' to change the number of z levels displayed.
'1' and '2' changes the seperation between z levels.
Space returns to top-down mode.

Note that I provide this software with no guarantee whatsoever. If it kidnaps your children and demands ransom: not my fault!

[EDIT: fixed control spec...]
« Last Edit: August 02, 2008, 11:12:22 pm by nornagon »
Logged

Jifodus

  • Bay Watcher
  • Resident Lurker
    • View Profile
    • Dwarf Fortress Projects
Re: Experimental map viewer
« Reply #1 on: August 02, 2008, 01:59:52 am »

Poor crappy Vista laptop, that only has Microsoft's drivers. :(

Code: [Select]
Error: OpenGL extension GL_ARB_texture_rectangle probably not supported
Logged

nornagon

  • Bay Watcher
    • View Profile
    • nornagon.net
Re: Experimental map viewer
« Reply #2 on: August 02, 2008, 02:09:31 am »

Poor crappy Vista laptop, that only has Microsoft's drivers. :(

Code: [Select]
Error: OpenGL extension GL_ARB_texture_rectangle probably not supported

Hmm... what video card do you have?

I uploaded a slightly different version, which should error out a little earlier if you really don't have the extension and it wasn't a boo-boo in my programming. Additionally, it should print out a bunch of information about your OpenGL setup to stdout.txt...

I'd appreciate it if you'd redownload and try again ^_^
Logged

Jifodus

  • Bay Watcher
  • Resident Lurker
    • View Profile
    • Dwarf Fortress Projects
Re: Experimental map viewer
« Reply #3 on: August 02, 2008, 02:20:21 am »

It's a Intel 915GM something rather, but the real problem is I only have Microsoft's drivers, Intel dropped Vista support on my laptop's chip.

Code: [Select]
GL info:
Vendor: Microsoft Corporation
Renderer: GDI Generic
Version: 1.1.0
Extensions: GL_WIN_swap_hint GL_EXT_bgra GL_EXT_paletted_texture
Logged

Areyar

  • Bay Watcher
  • Ecstatic about recieving his own E:4 mug recently
    • View Profile
Re: Experimental map viewer
« Reply #4 on: August 02, 2008, 10:51:10 am »

Looks promising. :)

-Shouldn't the levels be closer together? or is that done to allow viewing underground structures?

-Probably a stupid question: how do you generate fdf files?

-Any way to make the surface water see-through as well? (or just several colours of the 'flow'sequence)
Logged
My images bucket for WIPs and such: link

Jifodus

  • Bay Watcher
  • Resident Lurker
    • View Profile
    • Dwarf Fortress Projects
Logged

sinoth

  • Bay Watcher
    • View Profile
    • http://sinoth.net
Re: Experimental map viewer
« Reply #6 on: August 02, 2008, 07:04:44 pm »

Good job :D  Something like this would be invaluable in-game... nothing fancy, just a quick 3D overview.  A few things that would make it even more usable:
  • Move each Z-layer closer together
  • Connect the Z-layers with slopes... will be sorta tough, but visible slopes would make it even easier to see what is going on
  • The camera doesn't feel "right" to me.. maybe have the X mouse movement only swivel on the openGL Y-axis, and Y mouse movement only rolls on the relative X-axis.  As is, I found myself rotating to really unusable viewpoints
  • When the window is resized, openGL context is lost and the textures die.  You can detect a window resize in SDL and force a reload of the textures
  • Have the arrow buttons auto-repeat so you don't have to press them over and over to move
  • The arrow buttons move in a certain direction regardless of camera facing.  Ideally, when the camera is between 315 - 45 degrees, UP moves forward.  At 45 - 135 degrees, UP moves right, etc
  • When entering 3D mode from 2D mode, the camera shouldn't jump any.. it should smoothly rotate from the current view 2D view
Thanks for this tool, I hope we get to play around with this as it is more refined :)
Logged
[i do not regret]

nornagon

  • Bay Watcher
    • View Profile
    • nornagon.net
Re: Experimental map viewer
« Reply #7 on: August 02, 2008, 07:15:09 pm »

It's a Intel 915GM something rather, but the real problem is I only have Microsoft's drivers, Intel dropped Vista support on my laptop's chip.
Ah. That would do it. And yes indeed, the GDI Generic driver sure doesn't support anything useful, OpenGL-wise. Sorry! :)

Looks promising. :)

-Shouldn't the levels be closer together? or is that done to allow viewing underground structures?

-Probably a stupid question: how do you generate fdf files?

-Any way to make the surface water see-through as well? (or just several colours of the 'flow'sequence)

Ah, I forgot -- you can change the level seperation with '1' and '2'.

Making the top level of water semitransparent is definitely a possibility: just look for water tiles with nothing above them. The only problem is actually identifying water tiles, which is not always easy/possible, due to the way that fdf-map files are encoded. They're generated from the .bmp exports that DF makes, which don't contain tile information beyond the actual images of the map. Some fdf-map compressors make an effort to identify which tile is which by comparing notes with the font, but it isn't always perfect...

In order to get better information out of DF, I'd have to write a map exporter that read info from DF's memory.

Good job :D  Something like this would be invaluable in-game... nothing fancy, just a quick 3D overview.  A few things that would make it even more usable:
  • Move each Z-layer closer together
  • Connect the Z-layers with slopes... will be sorta tough, but visible slopes would make it even easier to see what is going on
  • The camera doesn't feel "right" to me.. maybe have the X mouse movement only swivel on the openGL Y-axis, and Y mouse movement only rolls on the relative X-axis.  As is, I found myself rotating to really unusable viewpoints
  • When the window is resized, openGL context is lost and the textures die.  You can detect a window resize in SDL and force a reload of the textures
  • Have the arrow buttons auto-repeat so you don't have to press them over and over to move
  • The arrow buttons move in a certain direction regardless of camera facing.  Ideally, when the camera is between 315 - 45 degrees, UP moves forward.  At 45 - 135 degrees, UP moves right, etc
  • When entering 3D mode from 2D mode, the camera shouldn't jump any.. it should smoothly rotate from the current view 2D view
Thanks for this tool, I hope we get to play around with this as it is more refined :)

Yeah, the camera's a little bit dodgy, and it's something I need to work on. With the arrow keys, I should make them only work in the top-down mode, and have the middle mouse button work in 3D mode like it does in Black & White: like a hand pulling the landscape towards you, or pushing it away.

The transition from 2D to 3D is a tricky one, because I'm moving from an orthographic projection (i.e, stuff doesn't get smaller as it gets further away) to a perspective projection (in which it does). A smooth transition from one to the other is possible, but I'd need to sit down with a pencil and paper and work out the maths.

Glad you enjoy it :)
Logged

pickupsticks

  • Bay Watcher
    • View Profile
Re: Experimental map viewer
« Reply #8 on: August 02, 2008, 10:59:44 pm »

Great stuff!

Thanks for putting this together
I think that it shall prove most useful to me.
Logged

Asehujiko

  • Bay Watcher
    • View Profile
Re: Experimental map viewer
« Reply #9 on: August 03, 2008, 03:46:38 am »

Can't get it to work on vista. flashes the cmd prompt for 0.1 sec or so and then vanishes.
Logged
Code: [Select]
Tremble, mortal, and despair! Doom has come to this world!
.....EEEE..E..E.E...EEE.EE.EE.EEE.EE..EE.EE.E.EE.EE.E.EE.
......E..EE.EE.EE.EE..E...EEEE..E..E.E...EEE.EEE...E.EEE.
.☺..EE.E...E.EE.EE...E.EE..E..EE.EE.EE.EE..E...EE.EE..E.E
.....E..E.E.E.E.E.EE.E.E.EE.E...E.EE.EE...E.EE.EE.EEE...E
....E.EE.EEE.EE..EE.EE.E..EEEE..E..E.E...EEE.EEE..E.E..EE

nornagon

  • Bay Watcher
    • View Profile
    • nornagon.net
Re: Experimental map viewer
« Reply #10 on: August 03, 2008, 04:34:52 am »

Can't get it to work on vista. flashes the cmd prompt for 0.1 sec or so and then vanishes.

You're dragging a .fdf-map file to it, right? Could you look in stderr.txt or stdout.txt please? It shouldn't be showing the command prompt at all...
Logged

Markavian

  • Bay Watcher
  • DF Map Archive Admin
    • View Profile
    • DF Map Archive
Re: Experimental map viewer
« Reply #11 on: August 03, 2008, 05:00:09 am »

I couldn't get the viewer to work

First map I tried I received:
Error: OpenGL extension GL_ARB_texture_rectangle probably not supported

Then I tried some older maps and received:
Error: Clipping not supported yet

GL info:
   Vendor: Intel
   Renderer: Intel 915GM
   Version: 1.4.0 - Build 4.14.10.4332
   Extensions:
Spoiler (click to show/hide)
« Last Edit: August 03, 2008, 05:02:11 am by Markavian »
Logged

nornagon

  • Bay Watcher
    • View Profile
    • nornagon.net
Re: Experimental map viewer
« Reply #12 on: August 03, 2008, 05:22:12 am »

I couldn't get the viewer to work

First map I tried I received:
Error: OpenGL extension GL_ARB_texture_rectangle probably not supported

Then I tried some older maps and received:
Error: Clipping not supported yet

The first problem should be fixed now, as I've redone it so as not to use that extension (in the windows version at least; haven't uploaded the new source yet).

I've not yet gotten around to implementing some of the fdf-map features (namely, clipping and tile-index RLE). Support's coming :)
Logged

Markavian

  • Bay Watcher
  • DF Map Archive Admin
    • View Profile
    • DF Map Archive
Re: Experimental map viewer
« Reply #13 on: August 03, 2008, 07:03:34 am »

Ok, got it working with the version.

It doesn't appear to like single layer world maps.

Tested it using the map Skyseal by A_Fey_Dwarf:


The camera controls need a lot of work, they are unfriendly at the moment, but good progress :)
Logged

nornagon

  • Bay Watcher
    • View Profile
    • nornagon.net
Re: Experimental map viewer
« Reply #14 on: August 03, 2008, 07:22:12 am »

I updated the camera controls; now they're tilt/orbit instead of trackball. Should make you a little less sick :)
Logged
Pages: [1] 2