joshuajbouw/bevy_tilemap

Examples/documentation for single chuck map with origin in corner

jbowtie opened this issue · 2 comments

What problem does this solve or what need does it fill?

People following tutorials (such as the Rust Roguelike Tutorial) may not have a clear grasp of how chunking helps with map management, or how to convert between the coordinate system used in the tutorial to the one used by Tilemap.

Looking at the existing examples and documentation, I think the following are unclear without delving into the code itself:

  • The relationships between map, chunk, and texture dimensions.
  • Guidance on choosing a chunk size and how many to spawn initially.
  • How to work out the dimensions I need for a map that just fills particular screen or window size.

Most tutorials I've seen start with the following constraints:

  • A small, self-contained map (something like 10x10 or 80x50)
  • An origin in the top left or bottom left corner of the map (for simple conversion between tile coord and index into a vector).

These constraints get gradually lifted in later chapters or tutorials, of course, but the initial constraints make it easy to focus on learning the basics of movement, collisions, working with tiles, etc.

I think a simple example that follows these constraints, coupled with some documentation to help people understand when and how to use chunks for map management, would make this a simple transition for people following or adapting tutorials.

I don't know if this is better served with a more carefully annotated random_dungeon or a new tutorial_dungeon example that is closer to the old, single-chunk version of random_dungeon (but with an origin in the corner).

There has been a bit of discussion about exactly this in general. One of the ideas is just to make chunking 100% internal and not even give the concept of it publicly at all. All you would need to worry about is simply just putting tiles in a map. I do want to get into that direction, but it'll certainly break quite a bit of people's maps.

I DO want to do something much like the Rust Roguelike Tutorial eventually.

I'm not sure you have to hide chunking completely, but having a sensible default where you don't have to think about it initially would be a better experience. That way tutorials can work their way up to it gradually.

I'm currently working my way through the roguelike tutorial (halfway through chapter 7); it maps fairly closely but I had to write a couple of functions to translate between coordinate systems because I couldn't be bothered to figure out how to move the Tilemap origin.