Godot: Tilemap origin BOTTOM_LEFT and CENTER displaces offset texture and I think it should not.

Created on 13 Oct 2018  路  12Comments  路  Source: godotengine/godot

Godot version:

451e5fd0511bc2c17a66fc73a0de9a5169109517
but this problem is a concept problem in godot from 2.1 and probably before.

OS/device including version:

All

Issue description:

Ok, this is not a short issue, this is a problem that i have experiencie from long time ago and requires a long explanation.

Resumed problem: When you change tile origin in tilemap, not only the "origin point" (point that is used to calculate z-order and other things) is displaced... the offset of the texture is displaced. Images:

tiletopleft
tilebottomleft
tilecenter

Extended problem (a.k.a. the misconception of "origin point" and the tiles that are outside the tile, personal opinion):

Origin point allow you to know the map point of the tile, and if you are doing a "TopDown" Z Order game, allows you to make the "character behind wall or tree" effect. I麓m doing a game of this type, and i did a tool to center and calculate the offset of the texture in the tilemap when origin is "BOTTON_LEFT", because this is the necessary origin point of the tile. Real problem is that, you can not use flip_v, flip_h or transpose, because BOTTOM_LEFT, become TOP_RIGHT and other strange places by using that... so you need to duplicate and duplicate tiles to do the entire map....

... and later, thinking and thinking, and looking at the commit history of tile_map.cpp i see a lot of hacks that i think goes in the wrong direction... I explain:

There is not sense to have a off centered texture by default in tilemap, there is not good reason to have a tile out of a tile in your map... you have tile texture offset to do that. In current system flip_h flip_v and transpose lost their sense...

Tilmap_cpp have some variables that have not value and are passed to functions by parameters (sorry about size):
parameter-novalue

There are partial fix to fixing one fix that fix other fix, and forget other fix:
image
missingoffset1

And i think that all of this is because some programmers are misunderstanding the tile texture offset- tile origin... (Or it麓s me... i don麓t know).

I fix the texture offset only by commenting lines in tile_map.cpp, but there is other related problems like the shapes, the tilemap editor, etc.... I don麓t know if i麓m crazy with that or i麓m right, i would like to read some game dev that are trying to do a 2D topdown game with z-order ocultation, and some godot programmer opinion.

Minimal reproduction project:

There is the project that i use to some of the captures... but i think is not project related, it麓s dessign related.
Godot_TileMap_Test.zip

bug core

Most helpful comment

Well.... I think it麓s done. There is much code deleted and few added... and i think it works how it is supposed. I have to adapt to a recent master, i hope there was not too much changes in tile_map.cpp and tile_map_editor_plugin.cpp... if not, i make a commit in a few days and pray for the merge in 3.2... i hope that akien, reduz, etc... can understand that we need an usable version of tilemap in 3 version, no mathers if there will be a rewrite for 4.0:

TileMapFix

All 12 comments

There is no option to re-up the topic but i would like to read other developers or programmers about this topic because i don't want to maintain my own version for tile_map.cpp and tile_map_editor.cpp, if there is a workaround to flip h flip v and transpose tiles in not squared maps or isometric maps, or with BOTTOM LEFT or CENTER origin without displace the texture and i didn't know about that can be very helpful to me know the correct workaround.

Thanks for read.

i don't want to maintain my own version for tile_map.cpp and tile_map_editor.cpp,

If you solved/can solve the issue, then you could make a PR.

I was not sure to do that. That hack only fix texture offset in tilesets made with traditional manner (with export tileset tool). Last time that i compile that hack, shapes drawn in tileset editor had bad offset.... and i don麓t know well how to correct that, and do "clang style", and i don麓t use git to commit to godot (don麓t know all things that godot devs will start to ask me to do like squash, make the things in other way.... and for now you are the first person to see the issue... You experiment the same issue?, because that change is "breaking compatibility", if is considered a bug, godot usually don麓t respect bug as feature... but is so breaking change and if someone is using this bug as feature.... that麓s why i made this "big" issue, to explain and to ask for opinions and consensus. It will be fine to know if you find current tileset offset a bug...

I feel that this is a dessign problem that should be fixed by a real aplication dessigner and real c++ programmer.

Anyway i will do that pull request, although the hack will be not merged...

Reading other time the issue... problably that empty variable (center_ofs) has any value sometime in godot history... and probably current behaviour was not in the begining of the feature. It will take me some time to find and undestand that (c++ and headache are synonymous to me) but will try.

Well... I fix almost all problems with displace textures. Rest one problem with textures with different size that tiles and with different offset... this thing is make me a miserable... i hope the changes will be merged:
AvancesTileMap

Well.... I think it麓s done. There is much code deleted and few added... and i think it works how it is supposed. I have to adapt to a recent master, i hope there was not too much changes in tile_map.cpp and tile_map_editor_plugin.cpp... if not, i make a commit in a few days and pray for the merge in 3.2... i hope that akien, reduz, etc... can understand that we need an usable version of tilemap in 3 version, no mathers if there will be a rewrite for 4.0:

TileMapFix

Looks, great thanks a lot for the effort! Then I guess you also fixed #25610?

Don't know, i will test.

Looks, great thanks a lot for the effort! Then I guess you also fixed #25610?

Well, I tested that, it麓s not related. I explain in your issue report.

Demo test actualization to include navigation:
GodotTilemapBadOffsetTest-withNavigation.zip
Tilemap bug with navigation

With the last commit to maintain compatibility the result is:
TilemapOffsetBugJun19
So this issue is not fully adressed and i think i should be reopened.

Was this page helpful?
0 / 5 - 0 ratings