Code Monkey home page Code Monkey logo

Comments (6)

StarArawn avatar StarArawn commented on August 16, 2024

The tile entities are already in an array. You'll want to look at:

get_tile_entity
https://github.com/StarArawn/bevy_ecs_tilemap/blob/main/src/map_query.rs#L144
get_tile_neighbors
https://github.com/StarArawn/bevy_ecs_tilemap/blob/main/src/map_query.rs#L144

You can also see an implementation of astar here:
https://github.com/StarArawn/bevy_roguelike_prototype/blob/main/src/game/map/generate_map.rs#L87

from bevy_ecs_tilemap.

mlflabs avatar mlflabs commented on August 16, 2024

Thx for the links this helps a lot

i dont want to start a new thread, but have another question, not sure if its with tilemap or bevy, but how would i setup a query where i loop through all the tiles in a particular chunk?

from bevy_ecs_tilemap.

StarArawn avatar StarArawn commented on August 16, 2024

Thx for the links this helps a lot

i dont want to start a new thread, but have another question, not sure if its with tilemap or bevy, but how would i setup a query where i loop through all the tiles in a particular chunk?

Chunks are mainly meant to be a rendering optimization technique only, but if you really need to you can access the chunks via the map entity. You can't or rather wont be able to use map_query in this instance as it doesn't expose chunks. You can look at the logic for grabbing a chunk though and use something similar in your own code.

Once you have a chunk you can use:
https://github.com/StarArawn/bevy_ecs_tilemap/blob/main/src/chunk.rs#L183

from bevy_ecs_tilemap.

mlflabs avatar mlflabs commented on August 16, 2024

Thank you for all the replies

now my goal is just to divide the load into several frames, dont iterate through all tiles, i thought that each frame just iterate through a single chunk tiles would be nice, but is this the bevy way, is there a better way to do this?

from bevy_ecs_tilemap.

StarArawn avatar StarArawn commented on August 16, 2024

Thank you for all the replies

now my goal is just to divide the load into several frames, don't iterate through all tiles, i thought that each frame just iterate through a single chunk tiles would be nice, but is this the bevy way, is there a better way to do this?

I wouldn't necessarily say its the bevy way, as bevy is quite flexible, but I can understand the need to do this. It might be a better idea to keep track of tile entities(I would use tile position) yourself using some sort of hierarchical storage. HPA* comes to mind.
https://docs.rs/hierarchical_pathfinding/0.4.3/hierarchical_pathfinding/

from bevy_ecs_tilemap.

mlflabs avatar mlflabs commented on August 16, 2024

thank you again for the reply, help a lot

from bevy_ecs_tilemap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.