Author Topic: Prettier Graphics with Libtcod?  (Read 21351 times)

toggle

  • Newcomer
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Prettier Graphics with Libtcod?
« on: March 27, 2016, 05:47:49 PM »
Hello, I've been lurking on the forums for a while and working away at a little rogue game, but I'm very new to Python/Libtcod.

As weird as this sounds (being a rogue game) I kind of want to upgrade the standard ASCII tile output to something nicer. Even if I could get it looking something like Dwarf Fortress (with tiles) that would be awesome (something like this would be fantastic: http://i.imgur.com/FQaND.png).

But so far I can't get anything working (other than just changing the tileset). It seems like tiles in libtcod console are just 1 colour (with different transparencies). I tried overlaying multiple tiles over each other but that doesn't seem to work, it just deletes the tile underneath (even when using a new console layer). It also seems like a lot of trouble (7 different layers and 7 different tilesets overlaid for a 7-colour tile). Is it even possible?

My other question was: perhaps I'm going about this the wrong way? I'm thinking maybe there's a better way to output graphics in Python if I want more colours/options?

Any help or advice would be appreciated, thanks in advance.  :)

Quendus

  • Rogueliker
  • ***
  • Posts: 447
  • Karma: +0/-0
  • $@ \in \{1,W\} \times \{1,H\}$
    • View Profile
    • Klein Roguelikes
Re: Prettier Graphics with Libtcod?
« Reply #1 on: March 27, 2016, 07:29:47 PM »
Take a look at BearLibTerminal. In terms of tile display and keyboard input it has almost the same capabilities as libtcod, plus the features you want (coloured tilesets, tile composition using transparency) and other nice things like unicode characters, multi-tile sprites, and pixel offsets. It doesn't have libtcod's map generation and field-of-vision facilities.
Python support is quite mature, and Mac support (if you need it) is a recent addition which still needs a couple of bugfixes.

toggle

  • Newcomer
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: Prettier Graphics with Libtcod?
« Reply #2 on: March 28, 2016, 04:22:26 AM »
Take a look at BearLibTerminal. In terms of tile display and keyboard input it has almost the same capabilities as libtcod, plus the features you want (coloured tilesets, tile composition using transparency) and other nice things like unicode characters, multi-tile sprites, and pixel offsets. It doesn't have libtcod's map generation and field-of-vision facilities.
Python support is quite mature, and Mac support (if you need it) is a recent addition which still needs a couple of bugfixes.
Hey, this looks great. Thanks for the tip.
In theory I think I could use Libtcod for my lighting engine/pathfinding and then use BearlibTerminal for my graphics output, if I still wanted to use those libtcod features. I think.
« Last Edit: March 28, 2016, 04:24:13 AM by toggle »

Kyzrati

  • 7DRL Reviewer
  • Rogueliker
  • *
  • Posts: 507
  • Karma: +0/-0
    • View Profile
    • Grid Sage Games
    • Email
Re: Prettier Graphics with Libtcod?
« Reply #3 on: March 28, 2016, 05:47:28 AM »
libtcod actually supports multicolored tiles, I'm just not sure where it's documented since it was added much later than the original feature set, so it might not be in the regular documentation.

Here's a shot of one of the first libtcod games to make heavy use of it. (Though that game was never finished, and this was about three years ago.)

toggle

  • Newcomer
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: Prettier Graphics with Libtcod?
« Reply #4 on: March 28, 2016, 12:48:40 PM »
libtcod actually supports multicolored tiles, I'm just not sure where it's documented since it was added much later than the original feature set, so it might not be in the regular documentation.

Here's a shot of one of the first libtcod games to make heavy use of it. (Though that game was never finished, and this was about three years ago.)
Wow, that's incredible! I would love to know how on earth they did that. There's almost no information at all online about how to fiddle with libtcod's console output. In that example they definitely weren't just layering, unless they used hundreds of layers.

The only thing I was able to find was this: http://roguecentral.org/doryen/forum/index.php?topic=1468.45
From what I can gather the dev just layered 4 or more tiles over each other to get the effect but it seems like a really lengthy process.

Kyzrati

  • 7DRL Reviewer
  • Rogueliker
  • *
  • Posts: 507
  • Karma: +0/-0
    • View Profile
    • Grid Sage Games
    • Email
Re: Prettier Graphics with Libtcod?
« Reply #5 on: March 28, 2016, 12:55:30 PM »
Ah yeah, there you go, one of the discussion threads. I wasn't sure those forums were still around since libtcod stuff has disappeared before and some of it hasn't returned.

Really no matter what tile solution you use, you're going to end up with multiple layers, at least for the ground and whatever's sitting on top of it at that position (if anything). Unless you go the black background route, which generally calls for simpler tiles. pat's example in that thread looks pretty good, and is fairly simple to implement. That only requires one layer (though he's also demonstrating the use of subtile sizes there, something you don't necessarily need).

toggle

  • Newcomer
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: Prettier Graphics with Libtcod?
« Reply #6 on: March 28, 2016, 01:17:06 PM »
I'm fine with layering, like layering characters over ground tiles, or layering a GUI over the top, etc. But I don't want to have to do a layer for each individual colour. For example, if I wanted a 16-colour font, it would mean 16-layers for the ground, 16 for the character, meaning possibly hundreds of layers per tile. But if you're saying there's a simple solution that would be great. There doesn't seem to be any documentation or examples I can find.

When I try and use coloured tiles I just get a silhouette, like this http://imgur.com/OUl56zM

I can change the colour of that black blob but that's about the extent of my graphical abilities haha.

Kyzrati

  • 7DRL Reviewer
  • Rogueliker
  • *
  • Posts: 507
  • Karma: +0/-0
    • View Profile
    • Grid Sage Games
    • Email
Re: Prettier Graphics with Libtcod?
« Reply #7 on: March 28, 2016, 01:28:50 PM »
Nah, I've never heard of anyone doing a layer per color. That's... unheard of :P

I do know that libtcod can take those sprites and put them down on the map as a single tile, but I've never done it before and didn't see it in the docs so I can't help you there :/

toggle

  • Newcomer
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: Prettier Graphics with Libtcod?
« Reply #8 on: March 28, 2016, 01:38:32 PM »
Nah, I've never heard of anyone doing a layer per color. That's... unheard of :P

I do know that libtcod can take those sprites and put them down on the map as a single tile, but I've never done it before and didn't see it in the docs so I can't help you there :/

Yeah at first I thought I could use for loops to print hundreds of layers and then I figured it's probably not the most efficient way of doing things. ;)
Yeah it seems like there's not much info available, but thanks anyway! I've managed to get BearLibTerminal up and running so perhaps I'll have more success with that.

Kyzrati

  • 7DRL Reviewer
  • Rogueliker
  • *
  • Posts: 507
  • Karma: +0/-0
    • View Profile
    • Grid Sage Games
    • Email
Re: Prettier Graphics with Libtcod?
« Reply #9 on: March 28, 2016, 01:47:15 PM »
Yeah by all means go with another display method if you can get it working more easily!

toggle

  • Newcomer
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: Prettier Graphics with Libtcod?
« Reply #10 on: March 28, 2016, 02:55:45 PM »
Yeah by all means go with another display method if you can get it working more easily!
Wow, this BearLib thing is really powerful and works well, really simple design. Already in half an hour I've got fancy tiles jumping all over my screen.
Though I'm hoping to not get too carried away, I'm intending to strike a good balance between ASCII and pixel art. Nothing too elaborate, but also I want to steer away from just being a white '@' on a black background. I was just peeping at the RexPaint gallery in your signature, there's certainly much to be said for ASCII when it's done well. :)

Kyzrati

  • 7DRL Reviewer
  • Rogueliker
  • *
  • Posts: 507
  • Karma: +0/-0
    • View Profile
    • Grid Sage Games
    • Email
Re: Prettier Graphics with Libtcod?
« Reply #11 on: March 28, 2016, 03:02:13 PM »
For sure :). Remember one primary rule to get the best results: Stay consistent!

Good luck.

toggle

  • Newcomer
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: Prettier Graphics with Libtcod?
« Reply #12 on: April 10, 2016, 10:43:03 PM »
I'm not sure whether to post this in this thread or to start a new thread somewhere. Anyway over the last 2 weeks I've fooled around with BearLibTerminal and I've managed to put a little rogue together. It's pretty much identical to the Libtcod tutorial, except the graphical output uses BearLib (instead of the Libtcod console). Plus I added a bunch of other little features, improved pathfinding, etc.

I've put it on Github: https://github.com/tomzimmer/rogue_project

I'm planning to keep working on it and adding new features, update graphics, etc. Right now it's just a kind of proof-of-concept.
Here's a screenshot of what it looks like:
« Last Edit: April 10, 2016, 10:44:49 PM by toggle »

Kyzrati

  • 7DRL Reviewer
  • Rogueliker
  • *
  • Posts: 507
  • Karma: +0/-0
    • View Profile
    • Grid Sage Games
    • Email
Re: Prettier Graphics with Libtcod?
« Reply #13 on: April 11, 2016, 12:08:33 AM »
Looks great so far! You did all the art yourself?

Certainly a followup in this thread, to let others know how it went, was a good idea, though I'd suggest making a new thread about development of your game in particular (choose another appropriate board).

toggle

  • Newcomer
  • Posts: 9
  • Karma: +0/-0
    • View Profile
Re: Prettier Graphics with Libtcod?
« Reply #14 on: April 11, 2016, 12:47:55 AM »
Thanks!  :) No, I downloaded some tilesets and stitched them together, but it's just placeholder graphics at the moment. I've done a lot of pixel art (and I've made an entire point-n-click adventure game) in the past so I'll most likely make custom tiles. Might even bump it up to 32x32 also. One of the next steps will be having proper tiles for the walls, so there's corner/edge tiles for all the rooms. Maybe other little elements like pillars/altars, etc. I have to think about the game though, I'd like to depart from the standard high fantasy setting.

I'm not sure how much interest there is in Libtcod at the moment, but perhaps someone would find my code useful. It would be a great starting point for a beginner who wants to build a rogue-style game but they want to take advantage of BearLib's graphical abilities.

I'll have a look and make a new thread. :)

« Last Edit: April 11, 2016, 11:43:28 AM by toggle »