Bay 12 Games Forum

Please login or register.

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

Author Topic: Dwarf Fortress 3D Visualizer - EARLY ALPHA  (Read 9788 times)

Mithaldu

  • Bay Watcher
    • View Profile
Dwarf Fortress 3D Visualizer - EARLY ALPHA
« on: November 08, 2007, 08:50:00 pm »

( greetings to the SA crowd. your amusing threads are what pushed me to doing this.   ;) )

Greetings,

Ahead, warnings:
This is not for the faint of heart. It is hacked together in an ugly way with the purpose of creating a proof of concept and it may crash and burn on machines other than my two. It requires at least 2 GHz to run in something that is approaching an acceptable manner. It looks pretty ugly. Movement is pretty choppy due to an optimization i did in regards to stationary FPS. Moving around too much may consume your RAM at a rate of 300kb/cube, unless you already were at that location, in that case it is cached.

Now the link: http://fchan.us/dwarvis.rar  (You will have to click through the disclaimer, the rar file itself is work-safe.)

Basic info:
This thing is done entirely in Perl. I've taken the activeperl distribution, added in http://www.bribes.org/perl/wopengl.html, then began building off the example on that site. As soon as i had a state where i was fairly certain that it could work, i took the distribution as is, ripped out all the parts that the script didn't need and repacked it as one standalone package. That is what is in the link above.

To start it you simply run the file "dwarvis.bat".

The controls are WASD for normal shooter movement, mouse-click + drag to turn, and R+F to move up or down.

The xx_map_data.txt files contain basic ascii maps. 14 is z+-0, 13 is z-1, etc. The map can currently consist of: " " nothing; "." basic ground; "_" channel or hole in the ground; "#" rock.

The program code is in cube.pl, feel free to muck around with it as you wish.

The texture used is a basic square tileset, partly self-done, partly copied from others.

If you are interested in this, and wish to help me improve it, here's what i am most interested in:

1. crash reports, any and all bugs and complaints the program throws out.

2. general feedback, ideas, etc.

3. expert feedback from other programmers, specifically on the topic of opengl (again, poking at the code, changing, etc. HIGHLY recommended)

4. as this can be done in parallel, and as i suspect by looking at DMFA, may already be done: a way to parse the DF map exports into text files. for now the type of square is sufficient to know, but in the future some color analysis may be neat.

[ November 08, 2007: Message edited by: Mithaldu ]

[ November 09, 2007: Message edited by: Mithaldu ]

[ November 17, 2007: Message edited by: Mithaldu ]

Logged

sinoth

  • Bay Watcher
    • View Profile
    • http://sinoth.net
Re: Dwarf Fortress 3D Visualizer - EARLY ALPHA
« Reply #1 on: November 08, 2007, 10:37:00 pm »

Looks like a good start  :)  A few suggestions:

- Movement is pretty jerky, smoothing it out would be preferable
- Letting the user specify a longer view distance would be good, as the current one is fairly short
- There is a lot of artifacting when moving around, with flashes happening randomly

I'm currently working on a similar tool, using SDL+OpenGL with C++ as my base.  May the quest for the best 3D visualizer begin  :D

Logged
[i do not regret]

Malenfant

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress 3D Visualizer - EARLY ALPHA
« Reply #2 on: November 09, 2007, 05:59:00 am »

Can you post some screenshots for those of us who are at work?
Logged

Mithaldu

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress 3D Visualizer - EARLY ALPHA
« Reply #3 on: November 09, 2007, 07:55:00 am »

quote:
Originally posted by Malenfant:
<STRONG>Can you post some screenshots for those of us who are at work?</STRONG>
Sure, let me throw something together, then i'll answer the points of sinoth.  :)

first, the map used:

code:
|#######.........|   #            |                |
|###_##..........|  #.#           |                |
|#####...........|   #            |                |
|#...............|    ##          |                |
|...#_...........|   #..#         |                |
|................|    #.##        |                |
|................|    #...#       |                |
|................|    #....#      |         #####  |
|................|     #..._####  |        #.....# |
|................|      ####      |         #####  |
|................|                |                |

And now, some pics.

 

Desktop Size

All of them can be found here: http://fchan.us/dwarvis/

Logged

thehunterunseen

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress 3D Visualizer - EARLY ALPHA
« Reply #4 on: November 09, 2007, 07:58:00 am »

.....woah
Logged

Mithaldu

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress 3D Visualizer - EARLY ALPHA
« Reply #5 on: November 09, 2007, 08:36:00 am »

quote:
Originally posted by sinoth:
<STRONG>Looks like a good start   :)</STRONG>
Thanks, i'm happy this works out at all, performance-wise. ^^

quote:
<STRONG>- Movement is pretty jerky, smoothing it out would be preferable</STRONG>

Ahead: My machine is an AMD Athlon 3k+ XP with 1.5 GB ram and a GF 7600 GS. I expect the average user to have something that's 2/3 as powerful.

Some performance data: An average map is 240*240*30 = 1.728.000 cubes. Each cube has 6 faces. I'm already pre-converting map data to cut out faces that would *normally* be invisible. I am not yet culling by camera position and angle.

The problem is that even when not rendering faces, it costs quite a bit in terms of cpu power to cycle through a million cubes. So what i do is this:

I specify a range of cubes from the current position of the camera, then when the position changes by more than 1 unit, the program takes the grand sum of all cubes in the map and cycles through it, cutting out all cubes that are outside the specified range. This gets then cached as he local map for that coordinate.

To give this a better test i just defined the range as 20, which means we're cycling through 40*40 = 100 cubes. As it's a perfectly flat plane, we're dealing with as many quad polygons. Using this i get roughly 45 FPS while stationary and a choppy 10-20 while moving.

I'm still thinking about ways to improve this, but in the end it'll be a trade-off of performance while stationary vs. performance while moving. Additionally it's costly in time to implement various schemes of dealing with this data to see the net result in fps. For the moment I am more concerned

quote:
<STRONG>- Letting the user specify a longer view distance would be good, as the current one is fairly short</STRONG>

I plan to have the user set constraints on view range in all 3 dimensions, similar to how fortress location selection currently works ingame. Might add an intermediary range change mechanism.

quote:
<STRONG>- There is a lot of artifacting when moving around, with flashes happening randomly</STRONG>
stuff like this? http://www.nhancer.com/help/images/VSync.png

quote:
<STRONG>I'm currently working on a similar tool, using SDL+OpenGL with C++ as my base.  May the quest for the best 3D visualizer begin   :D</STRONG>
/me would rather we could combine our efforts.  ;)
Due to working in Perl I will be able to bang out code a lot faster, however performance there is lower and I am missing more extensive knowledge in OpenGL.
Do you use IRC?
Logged

Kjoery

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress 3D Visualizer - EARLY ALPHA
« Reply #6 on: November 09, 2007, 08:40:00 am »

Cool, but... Fchan? How'd you manage to host a .rar file on an imageboard?
Logged

Mithaldu

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress 3D Visualizer - EARLY ALPHA
« Reply #7 on: November 09, 2007, 09:10:00 am »

quote:
Originally posted by Kjoery:
<STRONG>Cool, but... Fchan? How'd you manage to host a .rar file on an imageboard?</STRONG>
by being admin there.  ;)
Logged

I3erent

  • Bay Watcher
  • The mounted dwarf has gone bErZeRk
    • View Profile
Re: Dwarf Fortress 3D Visualizer - EARLY ALPHA
« Reply #8 on: November 09, 2007, 12:51:00 pm »

Nice start man.
Logged
quot;I got really stoned a couple days ago and ended up talking to THIS GUY. anyway... I''m really drunk now. The guy said: There is this application called "Mya" MI-AH that makes animations of people that he paid $2000 for. F- that Jazz ARMOK ROCKS. FIGHT THE MAN, GO TEAM!

Capntastic

  • Bay Watcher
  • Greetings, mortals!
    • View Profile
    • A review and literature weblog I never update
Re: Dwarf Fortress 3D Visualizer - EARLY ALPHA
« Reply #9 on: November 09, 2007, 01:13:00 pm »

This is really groovy looking and I hope it progresses smoothly!
Logged

Senso

  • Bay Watcher
    • View Profile
    • http://lendemaindeveille.com
Re: Dwarf Fortress 3D Visualizer - EARLY ALPHA
« Reply #10 on: November 09, 2007, 03:15:00 pm »

Haha fchan

Good work though.

Logged

Serjndestroy

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress 3D Visualizer - EARLY ALPHA
« Reply #11 on: November 09, 2007, 04:07:00 pm »

Any possibility of hosting it on another site? Permanent internet censorship denies 4chan in this country..
Logged

Fortunatos

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress 3D Visualizer - EARLY ALPHA
« Reply #12 on: November 09, 2007, 04:23:00 pm »

No kidding, it seems my workplace has the whole server blocked. If I get a company email about my net activity I'm blaming your dressed link sharing servers with fchan, of all places.. :P

[ November 09, 2007: Message edited by: Fortunatos ]

Logged

dyze

  • Bay Watcher
    • View Profile
Re: Dwarf Fortress 3D Visualizer - EARLY ALPHA
« Reply #13 on: November 09, 2007, 04:33:00 pm »

awesome, will definitely be watching this one!
Logged

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: Dwarf Fortress 3D Visualizer - EARLY ALPHA
« Reply #14 on: November 09, 2007, 07:59:00 pm »

nice!!!

I have a collection of open source program code(found all over the internet) that I can look at for 3D rendering refrence, but I am too lazy to do much digging.(all of it is in c or c++)

edit: remembered that one was blender. and some game engine.
Those are good resources.

[ November 09, 2007: Message edited by: qwertyuiopas ]

Logged
Eh?
Eh!
Pages: [1] 2 3