Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Opportunities for visualization mods  (Read 1901 times)

mattmoss

  • Bay Watcher
    • View Profile
Opportunities for visualization mods
« on: June 17, 2008, 03:11:44 pm »

Check this out (click for full-size):



While it looks like a font stupidly turned 90 degrees, it is not. It's a run-time mod to tweak texture coordinates.

To see the code, download http://www.splatbang.com/files/gltrace.zip. gltrace is a bit of open-source (GPL) code that provides an opengl32.dll replacement, wraps the original opengl calls, and gives you the opportunity to do other things. (I take no credit for gltrace, btw.)

Out of the box, gltrace saves many GL calls to a log file; in the particular zip I'm providing, I've commented out the logging calls (too many logs can suck up CPU), and instead slightly modified the wrapper for glTexCoord2f to tweak the texture coords (just to provide an example); hence, every character looks rotated. Yes, it's a stupid tweak, but the point is to make it available for more interesting or useful mods.

I had started playing with a mod that uses a double-height window to draw more than the 80x25 current restriction on the playing field. It could work... if you knew what to draw outside the default 80x25. That would require keeping track of what's been drawn so far, or finding a pointer to the map in memory... Unfortunately, I just don't have time to pursue mods like that, so I figured I'd make gltrace available/known to other devs.

After a build, you put the built opengl32.dll right into the same folder as the Dwarf Fortress exe and run. Remove the custom dll and DF will go back to using the system's. Feel free to send me questions you have to matthew.moss AT gmail.com, and I'll answer what I can.
Logged

DDouble

  • Bay Watcher
    • View Profile
Re: Opportunities for visualization mods
« Reply #1 on: June 17, 2008, 06:16:20 pm »

Thanks for posting this, I hope someone much more knowledgable than myself can pick up on it. What other uses do you see for it besides being able to draw outside the narrow 80x25 limit?
Logged

awdball

  • Bay Watcher
    • View Profile
Re: Opportunities for visualization mods
« Reply #2 on: June 17, 2008, 06:25:17 pm »

Outside the 80x25 sounds tough. My first thought is you could actually go quasi-isometric with this. Theoretically you could remap all the coordinates and rotate the font 30 or 45 degrees. perhaps even going so far as to only rotate specific tiles so the map is rotated but the creatures trees and other place-able type things remain vertical.
Logged

mattmoss

  • Bay Watcher
    • View Profile
Re: Opportunities for visualization mods
« Reply #3 on: June 17, 2008, 11:11:40 pm »

True, what awdball said... Going outside the 80x25 would be tough without having the actual data. That said, *perhaps some* of that has been done in the way of map_extract used by the 3d visualizer. Whether that makes it possible, I don't really know.

Also as awdball indicated, you could do something quasi-iso. Basically, with the opengl wrapper you will see output from DF like (pseudocode):
  glBegin(QUADS)
     4 times {
       glTexCoord2f(s, t)
       glVertex2f(x, y)
     }
  glEnd

Really, that's about all you get... Some texture IDs as well, iirc. In any case, you could change the camera from a simple 2d ortho to a 3d ortho (ie. iso), though that alone would still leave everything flat. You could track tex IDs/coords to know "Oh, this quad is a tree." and replace it with a tree model.

Logged

ChocoHearts

  • Bay Watcher
    • View Profile
Re: Opportunities for visualization mods
« Reply #4 on: June 18, 2008, 06:09:00 pm »

Here's a question: Could one set up something that remembered where everything is, for an extended viewer? That is, when you first start the game, it'd just show the standard viewport, but as you move the view around, it'd "fog of war" what you can't "see"?

Lemme see if I can diagram:

Code: [Select]
Standard view:
#####
#####
#####
#####
#####

"extended" view:
***********
***********
***#####***
***#####***
***#####***
***#####***
***#####***
***********
***********

# = currently visible square
* = last known state of this square

...Does that make sense? If I were a codemonkey, I'd try it, but alas.

And entirely off-topic: First post in these here forums. :D
Logged
Feeling dumb is just nature's way of telling you you're still learning.
Elfy McElf: We are here to hug trees and kill dwarves. And it's your fault we are all out of trees.

mattmoss

  • Bay Watcher
    • View Profile
Re: Opportunities for visualization mods
« Reply #5 on: June 20, 2008, 04:24:37 pm »

Here's a question: Could one set up something that remembered where everything is, for an extended viewer? That is, when you first start the game, it'd just show the standard viewport, but as you move the view around, it'd "fog of war" what you can't "see"?

That's exactly what I initially started playing with... The idea was that, while it wouldn't be quite as good as a larger "live" window, larger than 80x25, it would still have much more landscape/fortress visible, making things easier to picture.

The main difficulty is in tracking movement. This is an opengl wrapper, so you see _only_ the graphics calls.

You would have to start tracking the keyboard to know when the player moved the screen, since that information is not available here... and knowing which keys move what, knowing that the menus aren't part of the world... Knowing where you are when the game jumps to a whole new location because some dwarf has gone mad.

It *could* be done, but it's no minor task.
Logged

ChocoHearts

  • Bay Watcher
    • View Profile
Re: Opportunities for visualization mods
« Reply #6 on: June 20, 2008, 09:47:21 pm »

You would have to start tracking the keyboard to know when the player moved the screen, since that information is not available here... and knowing which keys move what, knowing that the menus aren't part of the world... Knowing where you are when the game jumps to a whole new location because some dwarf has gone mad.

It *could* be done, but it's no minor task.
Eeeew. I figured it'd be harder than it sounded at first. But hey, it was an idea... and since it's possible, maybe it'll happen. *crosses beard*
Logged
Feeling dumb is just nature's way of telling you you're still learning.
Elfy McElf: We are here to hug trees and kill dwarves. And it's your fault we are all out of trees.

Login

  • Bay Watcher
    • View Profile
Re: Opportunities for visualization mods
« Reply #7 on: June 29, 2008, 10:25:22 am »

http://i303.photobucket.com/albums/nn138/1200V2/Dwarfstothemoon.jpg

Used the stored jpg map on a sphere in Blender and had some fun. ;D

I have a also a small filmclip of it spinning quite nicely.

So you only need to get the data from the editor. The only question i have is this usefull?
Logged