Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Exporting embark terrain as lossless image file  (Read 1658 times)

Setes

  • Bay Watcher
    • View Profile
Exporting embark terrain as lossless image file
« on: May 04, 2015, 03:02:16 pm »

Hello people

I've been playing dwarf fortress on/off for about 2½ year now, and i've come so far in my quest to play this game that i now want to create mods for it.

My short term goal for this mod is to be able to create a Visualizer for Dwarf Fortress in Unity3D, so you'll be able to explore your fortress in 1. person.

granted this is a huge-ass project, and i've already hit my first issue.

How would i go about exporting an embark location as a bitmap or tga, where each pixel corresponds to a particular material, in the perfect world i'd need to do this for every layer on the embark site, so in the end i'll have 200+ imagefiles.

My current thougts are to create a tileset where every tile has been replaced by a single color value, and all units (humanoids, animals, monsters etc etc etc) are hidden by a transperent alpha tile.

I've messed around with the legends exporter, but that only gives me the terrain for the entire world, and therefore i assume i'd need to recreate the caves, rivers, buildings and sites in Unity.

So, is it possible to get some help?, i'm not looking for a complete tutorial, i'm more looking for a place to start :)

Thanks in advance
Logged

Deon

  • Bay Watcher
  • 💀 💀 💀 💀 💀
    • View Profile
Re: Exporting embark terrain as lossless image file
« Reply #1 on: May 05, 2015, 01:39:20 am »

I would ask how they do it in the Stonesense thread:
http://www.bay12forums.com/smf/index.php?topic=106497.0
There's a DFHack involved and I am sure Japa or anyone else there can give you a better advice than a "special tileset" (which sounds like a fun idea, but it will probably take more time than needed).
Logged
▬(ஜ۩۞۩ஜ)▬
✫ DF Wanderer ✫ - the adventure mode crafting and tweaks
✫ Cartographer's Lounge ✫ - a custom worldgen repository

ragundo

  • Bay Watcher
    • View Profile
Re: Exporting embark terrain as lossless image file
« Reply #2 on: May 05, 2015, 02:26:55 pm »

There's already a Unity viewer in construction called Armok Vision developed by Japa. Look for it in the forum.

You should contact him, and, may be collaborate together instead of developing a new solution from scratch. He's available also in the #DFHack chat room in Freenode.

In a technical view, Armok Vision has a DFHack plugin called RemoteFortressReader that sends all the data via RPC to a client that displays the map using Unity. The RPC used is a serialization of the data read from DFHack/Dwarf Fortress using Google protocol buffers.

Fortunately, protocol buffers has support for C#, so you can use it in Unity.

Hope it helps.
Logged

Setes

  • Bay Watcher
    • View Profile
Re: Exporting embark terrain as lossless image file
« Reply #3 on: May 10, 2015, 09:44:06 am »

Wow, holy shit, wow.

Yeah, there's no point in my inventing the wheel all over again.

I'm mainly doing this for my own enjoyment and personal challenge, and i'm not that good a programmer, so i'm not sure if i could help Japa at all :) I'll try to join the DFHack chat at some point, i've got an education as a 3D artist, so i might be able to help with the graphical aspect of creating the viewer.

Thanks for the heads up :), i might continue to play what i've made so far, its interesting technology.
Logged