I asked this question in the module section but haven't gotten a response. I guess I will try again here.
I would like to use T-Engine4 to develop a roguelike but I'm having a lot of trouble figuring one thing out. I want to modify the simple example project to use a tileset rather than ascii for the random dungeon that it generates. Simple right? No. For for the life of me I can't get it to work.
I put my tile images in a 'terrain' directory under the gfx folder. In the general/grids/basic.lua file I pointed the walls and floors to my tileset images (name = "wall", image = "terrain/granite_wall1.png", for example). However, no matter what, it still loads up showing ascii instead of the tiles. Tilesets are enabled in my game options so I can't figure out why it doesn't use my tile images. I must be missing a step somewhere.
After days of trying to figure this out, I'm beyond frustrated. Nowhere in the 'how to' documentation does it mention tilesets at all. There are no examples there. I looked at the Hulk module and as far as I can tell, I'm doing what they did there but it still doesn't work.
Can someone please tell me what what steps I need to do to get my tileset images to be used as walls and floors in the example module? Thanks.
How do you get a tileset to work in the module example?
Moderator: Moderator
Re: How do you get a tileset to work in the module example?
I finally figured it out. In game.lua under the class folder there's a function that sets up the display. Use of images for tiles is set to false by default. Once I changed it to true there, it worked.
function _M:setupDisplayMode()
print("[DISPLAY MODE] 32x32 ASCII/background")
Map:setViewPort(200, 20, self.w - 200, math.floor(self.h * 0.80) - 20, 32, 32, nil, 22, true)
Map:resetTiles()
Map.tiles.use_images = true

function _M:setupDisplayMode()
print("[DISPLAY MODE] 32x32 ASCII/background")
Map:setViewPort(200, 20, self.w - 200, math.floor(self.h * 0.80) - 20, 32, 32, nil, 22, true)
Map:resetTiles()
Map.tiles.use_images = true

Re: How do you get a tileset to work in the module example?
Hooray! I had no clue where the problem might have been.
My feedback meter decays into coding. Give me feedback and I make mods.
Re: How do you get a tileset to work in the module example?
Thanks. Yeah even the simplest things seem to be hard to figure out in this engine. For example, I just created a PlayerDisplay strip on the left side of my screen from the example in the 'how to' documentation. But the background that the player stats are displayed on is gray and the rest of the screen is back so I wanted to set its background to black as well to match. In game.lua I have the following statement:
self.player_display = PlayerDisplay.new(0, 0, 200, self.h * 0.8, {30,30,0}, "/data/font/VeraMono.ttf", 12)
Now, according the the function in PlayerDisplay.lua the {30,30,0} parameter in the above is supposed to be the background color. However, no matter what I change those values to, the stats display bar remains gray in color. I assume those are RGB values so setting it to {0,0,0} should work, but it doesn't. I also tried using 'colors.BLACK' there but that doesn't work either.
Anyone ever run into this issue and know how to fix it? Also, I'm new here so forgive me for asking but has this forum always been this dead? Is there anywhere else to to go to get help with TE4 questions?
self.player_display = PlayerDisplay.new(0, 0, 200, self.h * 0.8, {30,30,0}, "/data/font/VeraMono.ttf", 12)
Now, according the the function in PlayerDisplay.lua the {30,30,0} parameter in the above is supposed to be the background color. However, no matter what I change those values to, the stats display bar remains gray in color. I assume those are RGB values so setting it to {0,0,0} should work, but it doesn't. I also tried using 'colors.BLACK' there but that doesn't work either.
Anyone ever run into this issue and know how to fix it? Also, I'm new here so forgive me for asking but has this forum always been this dead? Is there anywhere else to to go to get help with TE4 questions?
Re: How do you get a tileset to work in the module example?
This forum is rarely used by anyone to get help with things. I think most people use the IRC channel. But I know Zizzo doesn't (despite repeated whippings).
My feedback meter decays into coding. Give me feedback and I make mods.
-
- Sher'Tul Godslayer
- Posts: 2521
- Joined: Thu Jan 23, 2003 8:13 pm
- Location: A shallow water area south of Bree
- Contact:
Re: How do you get a tileset to work in the module example?
*sigh…*HousePet wrote:I think most people use the IRC channel. But I know Zizzo doesn't (despite repeated whippings).


[sound F/X: wiki diving] I assume you're referring to the "T4 Modules Howto Guide/Character Sheet Dialogs" page? [sound F/X: source diving] …Yeah, if you examine the PlayerDisplay code on that page, you'll see that it never actually uses the "self.bgcolor" parameter that gets passed in. Which is bizarre, frankly.coldsteel wrote:For example, I just created a PlayerDisplay strip on the left side of my screen from the example in the 'how to' documentation. But the background that the player stats are displayed on is gray and the rest of the screen is back so I wanted to set its background to black as well to match.

And you do have a point about the sparseness of the code documentation. A lot of the time, your best bet is to just look at the engine code or the T4 module code itself and figure out what it's doing. That's what I end up doing most of the time.
"Blessed are the yeeks, for they shall inherit Arda..."
Re: How do you get a tileset to work in the module example?
Well, I guess I'm with Zizzo because I don't like IRC and have resisted using it for however long it's been around(20+ years?). I'm not going to install client software just to ask a question. Plus, IRC is in a big decline right now.HousePet wrote: I think most people use the IRC channel. But I know Zizzo doesn't (despite repeated whippings).
Yeah, I did notice that and it had me really puzzled and frustrated. Finally, I just figured it had to be a bug of some kind. Which is not what you want to run into when you're trying to learn this stuff. It's hard enough without that. But, it actually makes me feel good to confirm that I figured out it wasn't working right.Zizzo wrote:Yeah, if you examine the PlayerDisplay code on that page, you'll see that it never actually uses the "self.bgcolor" parameter that gets passed in. Which is bizarre, frankly.
You know, I actually took a hard look at those erase statements and wondered if maybe the background was being set there but then I thought, 'nah, couldn't be'. I will look again.Zizzo wrote:The relevant spot in the code is likely to be one of the calls to "s:erase()", which is what is used to actually draw the background; you'll need to track down the right one and replace its first three parameters with the three fields of self.bgcolor{}.
I actually have been doing that but there's a few issues with that approach. In this particular case, they don't even have PlayerDisplay.lua in the ToME code so it's hard to figure out what they are actually doing. The best I can figure is that instead of using that method they use UI elements to draw a frame at the top left of the screen and then display the HP, Mana, Paradox, etc. inside that. How they actually do that I'd love to know but so far I haven't been able to track down where they do that.Zizzo wrote:A lot of the time, your best bet is to just look at the engine code or the T4 module code itself and figure out what it's doing.
And that's the other issue. there's a LOT of code and for someone like me that's just starting trying to learn TE4, it's kind of overwhelming to dive into. That's why I was trying to go through the 'how to' examples first.
It's really frustrating and really a huge shame. After researching it, this is, by far, the best roguelike engine available, bar none. If only it was adequately supported with documentation, it would be super popular. It would be the Unity of rogue engines. Instead what happens is that people get really enthused to use it but then bounce off it hard when they try to learn how to use it because there's no adequate learning resources. I guess I don't understand why Darkgod created such an awesome tool and then abandoned it.Zizzo wrote:And you do have a point about the sparseness of the code documentation.
Now you can say that TE4 is not abandoned but just look at when any documentation was last created or even updated. Nothing really's been done since 2013 or so. Nobody talks about TE4 anymore and only a bare handful of people are using it (maybe 2 or 3?). The modules that are available for download are all several versions old and don't even work anymore so it's hard to use them as examples. It's depressing.
Re: How do you get a tileset to work in the module example?
Actually, as it turns out, s:erase() is not the function that draws the background. A little testing revealed that is was actually this:Zizzo wrote:The relevant spot in the code is likely to be one of the calls to "s:erase()", which is what is used to actually draw the background; you'll need to track down the right one and replace its first three parameters with the three fields of self.bgcolor{}.
core.display.drawQuad(self.display_x, self.display_y, self.w, self.h, 100,100,100, 200)
Replacing the 100,100,100 values there with zeroes worked to set the background to black. This is the spot that the "self.bgcolor" parameter should have been used in the example.