Bay 12 Games Forum

Please login or register.

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

Author Topic: Strange question about tilesets and websites  (Read 2739 times)

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Strange question about tilesets and websites
« on: May 03, 2015, 11:19:09 am »

Hey guys,

A thought randomly popped into my head today: Using DF tilesets to draw a comic for a community fortress. I'd take the workshop draw utility and draw a scene, screenshot it and use the image... but why stop there? Would be a lot more fun if people that saw it could change the color scheme and tileset.

I did not find any utility for this, but maybe it's possible to write a website that does it, some java or html5 that reads out the data?

No idea how easy/hard that would be, just throwing the idea out there.
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

Vherid

  • Bay Watcher
  • [CREATURE:SLARK]
    • View Profile
Re: Strange question about tilesets and websites
« Reply #1 on: May 03, 2015, 03:44:28 pm »

Hey guys,

A thought randomly popped into my head today: Using DF tilesets to draw a comic for a community fortress. I'd take the workshop draw utility and draw a scene, screenshot it and use the image... but why stop there? Would be a lot more fun if people that saw it could change the color scheme and tileset.

I did not find any utility for this, but maybe it's possible to write a website that does it, some java or html5 that reads out the data?

No idea how easy/hard that would be, just throwing the idea out there.

So you're saying, a web app that could somehow read an image, redisplay it in a canvas and allow people to change the tileset and colors.
That sounds pretty hard with my experience.

Unless you have a application that can spit out the picture in some form of data that is far more easily readable and then you could probably use a console library like rot.js, and from that point changing tiles and colors might be far easier.

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: Strange question about tilesets and websites
« Reply #2 on: May 03, 2015, 10:30:54 pm »

How does the .cmv movie player on the map viewer site work? I noticed that the .cmv was exported in vanilla tiles and resolution/etc, then the movie player translates that into something flash can work with, might be handy to dig around in there to see what they did?
Logged

milo christiansen

  • Bay Watcher
  • Something generic here
    • View Profile
Re: Strange question about tilesets and websites
« Reply #3 on: May 04, 2015, 11:58:25 am »

I have some CMV rendering code that could easily be re-purposed to make a rendering server. Currently I use something like that to render on-the-fly workshop previews for addon description pages in the Rubble web UI.

Obviously someone would have to be willing to host such a server...

Such a server would need an image description, and a set of tilesets/colors which it would use to render images as needed and cache commonly requested ones.

Some kind of client side system would also work, but I don't know anything about that so I can't help there.
Logged
Rubble 8 - The most powerful modding suite in existence!
After all, coke is for furnaces, not for snorting.
You're not true dwarven royalty unless you own the complete 'Signature Collection' baby-bone bedroom set from NOKEAS

palu

  • Bay Watcher
    • View Profile
Re: Strange question about tilesets and websites
« Reply #4 on: May 07, 2015, 12:14:56 pm »

You could have some JavaScript that draws the images from a tileset onto a canvas. Does anyone know how DF colors tiles?
Logged
Hmph, palu showing off that reading-the-instructions superpower.
The internet encourages thoughtful, intelligent discussion and if you disagree I hate you.

lethosor

  • Bay Watcher
    • View Profile
Re: Strange question about tilesets and websites
« Reply #5 on: May 07, 2015, 03:02:21 pm »

That's definitely possible - an extension on the wiki and BenLubar's cmvjs library do it, for example.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: Strange question about tilesets and websites
« Reply #6 on: May 08, 2015, 01:36:40 am »

I was kinda thinking of the way that "workshop draw" works. You can already paint with it, 32x32 and change colors and tilesets, but if I would have to make a screenshot and upload it for each tileset... by hand, instead of offering a dropdown menu.
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

palu

  • Bay Watcher
    • View Profile
Re: Strange question about tilesets and websites
« Reply #7 on: May 11, 2015, 03:11:44 pm »

Here's how it worked back in 40d, no idea how much its changed since then:
http://dwarffortresswiki.org/index.php/40d:Tilesets#How_colors_other_than_white_and_magenta_work
Logged
Hmph, palu showing off that reading-the-instructions superpower.
The internet encourages thoughtful, intelligent discussion and if you disagree I hate you.

lethosor

  • Bay Watcher
    • View Profile
Re: Strange question about tilesets and websites
« Reply #8 on: May 11, 2015, 04:37:45 pm »

It could depend on whether that page refers to 40d or 40d# (e.g. 40d19) - the latter included the graphics improvements by Baughn (and others), although I'm not sure if the way colors were handled in graphics sets was affected.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

milo christiansen

  • Bay Watcher
  • Something generic here
    • View Profile
Re: Strange question about tilesets and websites
« Reply #9 on: May 16, 2015, 11:46:59 am »

What I do (with the Go "image/draw" package) is draw a sold block of the background color, then draw a solid block of the foreground color over that using the tile as a mask. I am not sure of the specifics of how "image/draw" handles the mask, but the result looks the same as what comes out of DF, so I am happy :)
Logged
Rubble 8 - The most powerful modding suite in existence!
After all, coke is for furnaces, not for snorting.
You're not true dwarven royalty unless you own the complete 'Signature Collection' baby-bone bedroom set from NOKEAS

DragonDePlatino

  • Bay Watcher
  • [HABIT:COLLECT_WEALTH]
    • View Profile
Re: Strange question about tilesets and websites
« Reply #10 on: May 16, 2015, 12:03:00 pm »

Hey, this is a pretty neat idea! And why not use Tiled as your workshop program? It's a very simple tool I use for all of my mockups and it's really flexible. The tool handles layers, non-aligned objects and you can edit sheets while the program is open and it'll update in real time. It's pretty compact too, with all of the map data stored in a single .xml file.

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: Strange question about tilesets and websites
« Reply #11 on: May 16, 2015, 12:12:38 pm »

Hey, this is a pretty neat idea! And why not use Tiled as your workshop program? It's a very simple tool I use for all of my mockups and it's really flexible. The tool handles layers, non-aligned objects and you can edit sheets while the program is open and it'll update in real time. It's pretty compact too, with all of the map data stored in a single .xml file.
Couldnt get more meta than making a patreon-funded web-comic using a patreon-funded program. :D (tiled is also on patreon.)
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

Pidgeot

  • Bay Watcher
    • View Profile
Re: Strange question about tilesets and websites
« Reply #12 on: May 16, 2015, 04:44:02 pm »

What I do (with the Go "image/draw" package) is draw a sold block of the background color, then draw a solid block of the foreground color over that using the tile as a mask. I am not sure of the specifics of how "image/draw" handles the mask, but the result looks the same as what comes out of DF, so I am happy :)

This is where the Wanderlust tileset is very handy, because its use of shading catches several edge cases. Based on your description, I don't think your code will do the right thing here.

The proper calculation is blend(bgrgb, fgrgb*tilergb, tilea), where the blend function refers to alpha blending (linear interpolation such that alpha=0 returns the first input, and alpha=1 returns the second input). Typically, the alpha blending aspect will be handled automatically when drawing the two on top of each other, so if you have that, you just need to do the multiplication to get the tile foreground and then just overlay it onto the background.

(EDIT: Some tilesets don't actually contain an alpha channel. For these, all pixels colored #FF00FF (magenta) should be considered transparent (alpha=0), and the rest opaque (alpha=1).)

For a webcomic, there are ways to do this with CSS, but AFAIK, they're not universally supported (IIRC, IE11 doesn't do it, not sure about others). You'd need to look for a Javascript library to handle that operation.
« Last Edit: May 16, 2015, 05:06:55 pm by Pidgeot »
Logged

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: Strange question about tilesets and websites
« Reply #13 on: May 17, 2015, 04:11:15 am »

Or instead of offering 30 tilesets that are automated, I take the 3-4 most popular ones and do it by hand.
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

Pidgeot

  • Bay Watcher
    • View Profile
Re: Strange question about tilesets and websites
« Reply #14 on: May 17, 2015, 05:56:57 am »

Or instead of offering 30 tilesets that are automated, I take the 3-4 most popular ones and do it by hand.

You can do that, but remember that you have to do this for every combination of tileset and color you want to support (so 16 colors per scheme per tileset). At 4 tilesets, that's 64 versions per colorscheme.
Pages: [1] 2