-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "Explicit Start Frame" tile animation mode. #82252
base: master
Are you sure you want to change the base?
Conversation
8e5ec35
to
1145373
Compare
1145373
to
148ee11
Compare
added explicit_start_frames param to set_cell
to get new hashes but still not work.. guess i did it wrong idk
so i should change this to
or what? Thanks. |
Thanks for the contribution. While I think the feature can be useful, I'd rather avoid bloating the data stored in the TileMap with new things right now. We need to rework the way we store the TileMap data, and using a dictionary here instead of the For now, I think users will have to use scene tiles for that kind of behavior. |
I meant the TileMapLayer's "tile_data", the one retrieved with Basically, this is the structure that holds what is stored, per cell, in a layer. |
Ya I considered TileMapCell, and TileData, and TileSetAtlasSource beside tile_animation_mode... but TileMapLayer seems better? It could and should only store data for tiles with animations using this mode? The dictionary is not exposed to scripting just an extra optional param to set_cell. If anyone can suggest a better place to store it or a better way to do it... How is this "super inefficient bloat"? Storing an int? The other tile animation mode is fine cuz it not store ints? I guess cuz I am doing a dictionary lookup... But it is not running constantly for all tiles... just happens when drawing tiles in that mode and setting tile in that mode. Sure it would be nice if could integrate into some other tile lookup but idk where. Does not seem to interact at all with users who not use this feature or have any effect on their performance... and users who want this feature might be ok with cost of looking up an int to look up an int? no? lighter then looking up a scene tile? idk sorry Thanks. |
Okay, maybe I'm misunderstanding everything that went into your pull request, but is there a pressing need for it to actually store what the original start frame was as a separate value? When you implemented randomized tile offsets, there's already an offset value for where in its animation the tile starts out. If we calculate (or precalculate) how many seconds that will take, we can reuse most of the structure used in the random tile code. Basically, if it's a 10 frame animation which lasts 10 seconds, we just tell it to skip ahead 4 seconds at creation, and then leave it to act like a normal tile. That'd require more work on the backend in tileset, mapping any tile which has coordinates within an animation to the animation itself, but would avoid expanding the data stored in tilemap at all. |
Thanks. Yes both animation modes basically just offset the animation start time eventually, but Random Start Time animation mode is just random so it not need to store anything... it keeps it constant during run time by seeding the random number generator with a hash of the layer & coords, so i just generate a new offset instead of load one. Explicit Start Frame animation mode, needs to keep these exact offsets for each cell using this mode after quit and reload. Random Start Time can discard the data and regen it the same, random. I think. |
Quit and reload should be the same as initializing the tilemap the first time, right? Would it be too ugly for the tilemap to just be given the coordinate of a nonfirst frame, and then the tileset handles all the nitty gritty details of assigning it an animation with the right offset start? So (for instance), if the 3 frame animation contains tiles in the atlas at <1,1> <2,1> and <3,1>, and we want the animation to start at the second frame in <2,1>, can we just store <2,1> in the tilemap and ensure the tileset knows this frame is part of an animation? That also has the advantage of having a very literal mapping between selecting the tile in an atlas and putting it on the map; if you pick the tile at <2,1> on the tileset atlas it will just put <2,1> in the tilemap, instead of the current situation where it puts in <1,1>. @groud do you think that would be a good way to implement without bloating the tilemap? |
I believe it could work, but that's probably a lot of work. The TileSet was designed around the fact that one ID = one tile, this is probably very difficult to work around in a safe way. |
Closes: godotengine/godot-proposals#7461
TODO:
Works, but only till quit and reopen. Not persistingHashMap<uint32_t, int> animation_explicit_start_frames
.Tried moving it to TileData or TileAlternativesData a few times but could not figure it out... hoping to get some feedback about where and how to store the data.Can't overwrite explicit, even after delete. So only really works on tiles that were empty when map opened.Will probably 'fix itself' when first issue is solved. Deciding where and how to store the data.Ensure it works from code too.Thanks.