Coder Social home page Coder Social logo

bevy-fast-tilemap's People

Contributors

dependabot[bot] avatar droggelbecher avatar msklosak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

bevy-fast-tilemap's Issues

Multiple Maps along the x and y axis do not Render correctly

I'm attempting to use this crate alongside a chunking implementation. To do so I wanted to make it so that each Chunk was a separate fast tilemap. However doing so causes all the other maps except for the first map to not be rendered correctly.

I copied the code straight from the examples for spawning my maps.

You can see based on the image that all the maps should be random like the first one however none of them actually are.

bevy_fast_tilemap_example_EP54SEQPqE

Code for spawning the tilemaps, used for each tilemap

// Create map with the given dimensions of our chunk
        let map = Map::builder(
            // Map size (tiles)
            uvec2(
                chunk.get_chunk_dimensions().x,
                chunk.get_chunk_dimensions().y,
            ),
            // Tile atlas
            asset_server.load("tiles_16.png"),
            // Tile size (pixels)
            vec2(16., 16.),
        )
        .build_and_set(&mut images, |pos| rng.gen_range(0..15));

        commands
            .entity(entity)
            .insert((
                SpatialBundle {
                    transform: Transform {
                        translation: Vec3::new(
                            chunk.chunk_pos.x() as f32
                                * chunk.get_chunk_dimensions().x as f32
                                * 16.0,
                            chunk.chunk_pos.y() as f32
                                * chunk.get_chunk_dimensions().y as f32
                                * 16.0,
                            1.0,
                        ),
                        ..default()
                    },
                    ..default()
                },
                ChunkMapSpawned,
            ))
            .with_children(|parent| {
                let mut map_bundle = MapBundle::new(map);
                map_bundle.transform.translation = Vec3::new(
                    chunk.chunk_pos.x() as f32 * chunk.get_chunk_dimensions().x as f32 * 16.0,
                    chunk.chunk_pos.y() as f32 * chunk.get_chunk_dimensions().y as f32 * 16.0,
                    1.0,
                );
                parent
                    .spawn(map_bundle)
                    .insert(Transform::from_translation(Vec3::new(1.0, 1.0, 1.0)))
                    // Have the map manage our mesh so it always has the right size
                    .insert(MeshManagedByMap)
                    .insert(FastTileMap);
            });

Flipping tiles on an axis

Great library. I'm render a Tiled map and am unable to find any way to flip a tile on an axis. Does this a feature exist, or would implementing this feature be possible?

On Wayland, examples panic with `Requested present mode Immediate is not in the list of supported present modes: [Mailbox, Fifo]`

On Fedora Workstation, cargo run --release --example iso (or any of the other examples) gets me:

thread 'main' panicked at 'Error in Surface::configure: Validation Error

Caused by:
    Requested present mode Immediate is not in the list of supported present modes: [Mailbox, Fifo]
', /home/mattdm/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.2/src/backend/direct.rs:734:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `bevy_render::view::window::prepare_windows`!

If I use WINIT_UNIX_BACKEND=x11, they work fine.

Tile generation line visual bug

So I am using this plugin to create a pretty big tilemap and I seem to have run into a very interesting visual problem. I believe it might be due to how the chunks are loaded for tiles but if I move around sometimes I can subtly see black lines go accross my screen. At first I thought that it was no big deal, but then I was walking around and randomly stopped on a spot where those black lines were covering the screen and they were staying there the whole time.

Maybe you can look into it, but in the meantime I will just ignore it.

image_2024-03-13_154842477

Layers

I've been playing with this locally and wadding through a-lot of learning and wanted to create an issue to figure out if I'm heading in the correct direction/wasting my time because you're already working on this.

The simplest surface change from the shader context, looks to be changing the map_size to a vec3u, and adding a 'layer_padding/layer_offset' vec2f.

isometric

Will donate this asset and my example I'm toying with, has some magical numbers.
https://gist.github.com/urothis/ba9eb3930dcc481c84fd10a6fc8d4e86

I assume the ideal would be to not over-complicate with additional logic for tile determinism and leave that up to build_and_initialize.

Feature Request: Tile Colors (background and foreground)

You might have a bunch of tiles (a most obvious example is when your tiles are really cp-437 ascii in a roguelike) that you want to "tint". I see that you just added a feature for map attributes that sets a color, which it looks like applies more or less a color to the entire map? It would be nice to be able to apply colors to tiles independently.

I had a hand at a prototype by changing to store a struct in the storage buffer that contains the index and foreground and background colors. That could work .. but I also found it seemed to run things a bit slower. I am wondering what your thoughts are for including a feature like this in the library?

Does it support 3D?

Out of curiosity, does it support 3D camera orthographic projection? I'm struggling on how to display it in the world. Any tips will be appreciated!

By the way, this crate seems to be awesome!

overhang cuts of the top

Hi!

i was trying to use overhang (perspective) to have tiles visually appear bigger.
for reference, we have those tiles:
tiles

to see it easier here is the same thing with a black grid:
Tiles_for_export_and_grid

each tile is 40x20, i used an overhang of

            vec2(4. * TILE_SIZE.x, 4. * TILE_SIZE.y), // inner
            vec2(2. * TILE_SIZE.x, 4. * TILE_SIZE.y), // lefttop
            vec2(2. * TILE_SIZE.x, 0. * TILE_SIZE.y), // rightbottom

so basically

  • 4 tiles padding between each tile
  • 2 tiles padding from the left and right
  • 4 tiles padding from the top
  • 0 tiles padding from the bottom

this is what im seeing:
image

only 4 tiles (2 horizontal, 2 vertical) are shown of the palm.

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.