Closed mjuchno closed 5 years ago
The tcod.tileset
module isn't implicitly imported by the libtcodpy API which is part of tcod
, so you'll need to import it manually with import tcod.tileset
. It's the same thing with tcod.event
.
Once you add import tcod.tileset
your IDE will know it exists.
This was explained better for the tcod.event
module. I've added more documentation to make it clear the need to import the tcod.tileset
module.
Thanks! After I found tileset.py in the tcod folder I suspected that this might be the case.
What is the best place to ask question about the library (without opening issues)?
My experiment with tileset allowed me to change a tile (by altering a color table) after the console was initiated (using SDL2 renderer) but only before the tile was first used. After it was used any further modification with the same method did not do anything.
I'am aware that this functionality is not meant for animations or layer stacking but I was wondering if it could be. Here is how I tried doing it:
tile_set = libtcod.tileset.get_default()
player_tile = tile_set.get_tile(glyph_number)
then altering a player_tile and after that:
tile_set.set_tile(glyph_number, player_tile)
the following I tried as a last resort, but it didn't help:
libtcod.tileset.set_default(tile_set)
What is the best place to ask question about the library (without opening issues)?
You could continue talking on this issue, contact me directly, or discuss on the roguelikedev Discord or IRC channel. Sometimes people ask questions on Reddit.
https://discord.gg/jEgZtqB http://webchat.quakenet.org/?channels=rgrd https://www.reddit.com/r/roguelikedev/
I don't mind trivial issues being opened here, so that isn't a problem.
My experiment with tileset allowed me to change a tile (by altering a color table) after the console was initiated (using SDL2 renderer) but only before the tile was first used. After it was used any further modification with the same method did not do anything.
This could be an actual issue. There's an optimization in the SDL2 renderer that skips redrawing characters. It's supposed to be aware that tiles could be altered in a tileset but that might not be triggering.
Thanks! That could explain it. Unfortunately OPENGL2 gives exactly the same result and all other renders give me all sorts of other problems that testing this particular thing does not make sense.
I that something that can be fixed on the python-tcod side or rather on the SDL2 side?
Well anyway, I only finished the tutorial so far so I shouldn't be thinking about adding animation of layer stacking to a "skeleton" that has only a tutorial style core implemented.
I assumed that OPENGL2 would fix it. If it didn't then this issue is narrowed down to the tileset implementation rather than any of libtcod's renderers. Renderers outside of SDL2/OPENGL2 don't support these tilesets.
Tilesets should be fixed in python-tcod 11.1.1
.
That's great! Thank you! I will definitely take it for a spin again when the new version shows up!
I've already released that version. It should be finished deploying around now.
A very quick test during a coffee break shows that it works! Thank you!
I will have to test it more in my usual environment at home to verify few things from a quick test: -game window opening significantly slower (like 4sec, but it might be something wrong with the python setup on this particular machine) -first frame with an updated tile shows a blank tile (or with an artifact white pixels on the left border) but when the screen is refreshed the tile is showed correctly. Maybe it is due the time needed for set_tile() to be update (documentation warns about it being slow).
I will test it more at home.
set_tile()
is slow since it usually needs to upload to the GPU. I expect it to be synchronous with other calls so there shouldn't be artifact frames. I didn't see that kind of issue in my own tests.
I've tested it a bit more on my home computer
The slow opening window was clearly a problem with that other environment. I don't have such behavior on this one.
As for the "artifact" it only appears in OPENGL2 renderer and SDL2 works fine, here is an example of how it looks like. (Of course changing a color is not the point here, but but being able to modify tiles pixels is)
I've been unable to reproduce any artifacts. It could be graphics card specific or something else. Is it possible for me to see your repository?
My repo should be public now. engine_set_tile_test.py has renderer fixed to OPENGL2 in the main() and the part modifying the tile with set_tile() around the begging of play_game(). After starting the game, the tile color is changed every ~10 frames/events.
I have a bit non-standard graphics card setup so I wouldn't be surprised if that would be the reason, although it rarely gives me any problems like that. As for me, I'm already happy that SDL2 works fine and grateful that managed to fix it that quick! Thanks!
Thanks for uploading that. With it I was able to reproduce and fix the issue.
Great! I'm glad I could help
Hello, I wanted to experiment with tcod.tileset even though its API is provisional.
I am getting "module 'tcod' has no attribute 'tileset'" error when trying to use tcod.tileset.get_default(). Neither my IDE nor dir(tcod) show tileset attribute.
Am I using it the wrong way (with a bitmap font) or is it no longer available in version 11.1.0 ?