Closed regner closed 8 years ago
pyscroll doesnt keep track of empty cells, so that is what is causing the issue. it might be fixed by passing "alpha=True" to the BufferedRenderer constructor. You can also fix it by just fill in in the empty cells with some blank tile. Hope that helps!
Hmm, i think i have a similar issue here. When .center()ing the map to a rather distant position, with alpha=True, i get remnants of old mapdata at places where there is no new tile. If i slowly move out of the area and back in, the tiles are erased.
Is there a method to manually clean this? I tried mapgroup.clear() + draw() after a "teleport" event, to no avail :(
I could add empty (i.e.transparent) tiles to where this occurs, but that sounds like a rather unwieldy hack (many of my maps use alpha and do involve teleporting :)
Riot, quit breaking my projects. :) just kidding, thank you for reporting the issue. The redrawing code needs a little love and you found a nice way to break it. For now, after your teleport, you can force the buffer to redraw. I'll look into a better way to handle large movements in the future.
I can't type code blocks on my phone, but here is how to force a redraw of the buffer.
BuffereredRenderer.redraw() https://github.com/bitcraft/pyscroll/blob/master/pyscroll/orthographic.py#L438
If you don't have a reference to the map layer handy you can try the following, but it isn't gaurenteed to work forever, since it references a private attribute:
PyscrollLayer._map_layer.redraw()
oh, ah, thanks - i should've found that one myself, sorry. But, updating to the latest commit, alpha doesn't work at all anymore. What happened? I get repeating tiles all over the place :( (Also, the redraw function doesn't affect this)
Same with Alpha=False - any recent changes here i didn't adapt for?
Not that I'm aware of. You might just want to use an earlier commit. On Sun, Dec 13, 2015 at 9:18 PM riot notifications@github.com wrote:
Same with Alpha=False - any recent changes here i didn't adapt for?
— Reply to this email directly or view it on GitHub https://github.com/bitcraft/pyscroll/issues/11#issuecomment-164256453.
I don't test alpha enough....I'll make a test case for it tonight and test it out.
Aaah, i did find out the commit that introduced this: 3e6c3cdd41887028a0ebde276405716d48487069
Ah, that damn isometric experiment. I got carried away with refactoring to support alternate perspectives.
aah, simple fix, i switched from alpha to colorkey=(0,0,0,0) - wonderful again. But i think, the initialization for alpha is a bit weird. Would you like a pull request on that?
You don't have to go through the trouble... How do you think the alpha init could be better? I'm doing some testing on my end. Alpha support is really broken, I just never knew (since i didn't test it often)! :(
If you have a close look at the init, it is never set ;) With the colorkey in place, i don't even need to redraw everything. All nice here =) :+1:
Yeah, i noticed that as well. I suppose that was probably a debug thing i forgot to revert. I've pushed a few changes and tested with a map that has lots of empty cells. With alpha, it works, but only at zoom level 1.0, so no chunky pixels.
I've tracked the cause of it to the pygame scaling function not being able to handle per-pixel alpha surfaces.
So, right now, alpha works (according to my tests), but only if you do not use the new zoom feature. I will have to do some complicated checks to get alpha and zooming to work as expected.
In general, I just make sure my map has no empty cells, as it is quicker to render and avoids these kinds of issues. I should probably update my readme soon to address this issue.
Regner, if you have any input on this (did it get fixed?) please let me know.
uhm, i'm scaling the map like in the demo. Scale is currently at 5, as otherwise performance is baaad :-/ Gotta test with the new code =)
Really? Do you mind sharing your project with me privately? I've had great performance with every map I've tried. On Mon, Dec 14, 2015 at 1:21 AM riot notifications@github.com wrote:
uhm, i'm scaling the map like in the demo. Scale is currently at 5, as otherwise performance is baaad :-/ Gotta test with the new code =)
— Reply to this email directly or view it on GitHub https://github.com/bitcraft/pyscroll/issues/11#issuecomment-164278580.
I've done some work on the alpha option and in my testing, it seems to work well, so I will be closing this issue.
Hey,
I am not sure if this is an issue with my code, pygame, PyTMX, or pyscroll so sorry if this is the incorrect place for this.
When I place a tile in my level, using tiled, and then import it into the game if the tile started off the screen and then comes into the screen it seems to get repeated forever in the direction it came from.
Here is a screen shot to show what I mean. The player spawns the the left with the second row of red tile off the screen to the right. As the tile comes into the screen it appears to be repeated.
Here is a screen shot of how the level looks in Tiled. I have confirmed the XML is correct as well.
You can see my code here: https://github.com/Regner/ludumdare34
Any help would be greatly appreciated. :)