Grid Sage Forums

Grid Sage Forums

  • November 23, 2024, 09:26:13 PM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

News:

LINKS: Website | Steam | Wiki

Author Topic: Web-based REX viewer  (Read 6799 times)

Phssthpok

  • Unaware
  • *
  • Wiki Contributor Supported Cogmind Alpha Access 2015-2017 (Prime Tier)
  • Posts: 11
    • View Profile
Web-based REX viewer
« on: June 06, 2015, 06:26:18 AM »

I'm working on a web-based REX viewer. It's still pretty rough, but it gets the right tiles in the right location with the right foreground color. Give it a try:

http://jjclark1982.github.io/rex-viewer/
Logged

Kyzrati

  • Administrator
  • True Cogmind
  • *****
  • Posts: 4477
    • View Profile
    • Cogmind
Re: Web-based REX viewer
« Reply #1 on: June 06, 2015, 06:38:59 AM »

Wow, and I thought you were busy enough doing cool things with the wiki :P

This is pretty neat... what might it be used for? Any plans? I dropped some stuff in and can see that it's missing the background color implementation, but other than that it works nicely so far.
Logged
Josh Ge, Developer - Dev Blog | @GridSageGames | Patreon

Phssthpok

  • Unaware
  • *
  • Wiki Contributor Supported Cogmind Alpha Access 2015-2017 (Prime Tier)
  • Posts: 11
    • View Profile
Re: Web-based REX viewer
« Reply #2 on: June 06, 2015, 06:53:23 AM »

I thought it might be useful for importing item screenshots to the wiki. Are you ok with that in terms of copyright? It's easy to limit to items that other people have already spoiled.

I had done some similar work for Dwarf Fortress tilesets (http://jjclark1982.github.io/df-tileset-previewer/), so this was mostly a matter of parsing the binary format. But at this point I might as well get backgrounds working too.
« Last Edit: June 06, 2015, 07:22:48 AM by Phssthpok »
Logged

Kyzrati

  • Administrator
  • True Cogmind
  • *****
  • Posts: 4477
    • View Profile
    • Cogmind
Re: Web-based REX viewer
« Reply #3 on: June 06, 2015, 07:44:39 AM »

Nice DF tileset previewer!

I hadn't yet made the connection that this could be related to your wiki endeavor. I do need to put a proper copyright message up on the wiki, but yeah eventually images and art can/should all be there, anyway. I'm okay with that and expected it to happen at some point.
Logged
Josh Ge, Developer - Dev Blog | @GridSageGames | Patreon

Phssthpok

  • Unaware
  • *
  • Wiki Contributor Supported Cogmind Alpha Access 2015-2017 (Prime Tier)
  • Posts: 11
    • View Profile
Re: Web-based REX viewer
« Reply #4 on: June 06, 2015, 09:36:37 AM »

I think I have colors painting properly now. Is it correct to treat the final color as a linear interpolation between the bg color and the fg color, determined by the brightness of the font pixel?

It still doesn't handle font files with over 256 chars, so it's hard to find a good grayscale font to inspect visually.
Logged

Kyzrati

  • Administrator
  • True Cogmind
  • *****
  • Posts: 4477
    • View Profile
    • Cogmind
Re: Web-based REX viewer
« Reply #5 on: June 06, 2015, 08:55:09 PM »

Background colors are simply painted in each cell, and foreground pixels are painted over that using the grayscale value (0-255) of each font pixel to set the alpha transparency at that point.

Unless I've misunderstood what you're asking here...
Logged
Josh Ge, Developer - Dev Blog | @GridSageGames | Patreon

Phssthpok

  • Unaware
  • *
  • Wiki Contributor Supported Cogmind Alpha Access 2015-2017 (Prime Tier)
  • Posts: 11
    • View Profile
Re: Web-based REX viewer
« Reply #6 on: June 06, 2015, 10:16:38 PM »

Yeah, that sounds equivalent to the linear interpolation I'm using:

Code: [Select]
bgColor + (fontColor / 255) * (fgColor - bgColor)
Logged

ironpotato

  • Derelict
  • **
  • Weekly Seed Participant Supported Cogmind Alpha Access 2015-2017 (Prime Tier)
  • Posts: 43
    • View Profile
Re: Web-based REX viewer
« Reply #7 on: June 10, 2015, 04:25:27 PM »

Man I was just going to make something to view the game files but it looks like yours already works for it :P So much for that.

Good job on this though, very well done. I was considering making the viewer in javascript myself xD
Logged

Kyzrati

  • Administrator
  • True Cogmind
  • *****
  • Posts: 4477
    • View Profile
    • Cogmind
Re: Web-based REX viewer
« Reply #8 on: June 10, 2015, 08:37:26 PM »

You guys are really good at spoiling yourselves =p
Logged
Josh Ge, Developer - Dev Blog | @GridSageGames | Patreon

Phssthpok

  • Unaware
  • *
  • Wiki Contributor Supported Cogmind Alpha Access 2015-2017 (Prime Tier)
  • Posts: 11
    • View Profile
Re: Web-based REX viewer
« Reply #9 on: June 10, 2015, 08:54:09 PM »

Yeah, this will view Cogmind art files.

But I'm not sure how to handle Cogmind font files, which are not laid out in normal ASCII order. I hard-coded some mappings for obvious things like letters and punctuation, but there are still a lot of unreachable or duplicate tiles.
Logged