amethyst / bracket-lib

The Roguelike Toolkit (RLTK), implemented for Rust.
MIT License
1.51k stars 108 forks source link

Gaps with multiple layers? #279

Open observant2 opened 2 years ago

observant2 commented 2 years ago

On some lines there are gaps or the renderer renders too much of the next tile, I don't know how to describe this:

grafik

(first line in the log and under the player)

I initialize the console like this:

    let font = "terminal8x8.png".to_string();
    let context = BTermBuilder::simple80x50()
        .with_font(font.clone(), 8u32, 8u32)
        .with_sparse_console(80, 50, font.clone())
        .with_sparse_console_no_bg(80, 50, font)
        .with_title("vortex")
        .build()?;

Any idea how this happened? On a side note, I don't know exactly what I'm doing there with no_bg, I just needed two console layers and this looked like it worked.

Edit: It looks fine when I don't scale it, but when I resize the window to some resolutions, it shows these artifacts on some lines.

thebracket commented 2 years ago

I see the lines; that's an issue I periodically fight with, caused by the font scaling. Is this on the github version?

observant2 commented 2 years ago

If you mean the github version of that game (vortex_rs), yes. It is reproducible there. Or if you mean what version of bracket-lib I'm using, it's this in my cargo.toml:

bracket-lib = "0.8.1"
thebracket commented 2 years ago

If you have time, would you mind trying pointing vortex at the current Github version? I believe that recent scaling work should have fixed the issue, but this would be a great chance to make sure.

bracket-lib = { git= "https://github.com/amethyst/bracket-lib.git" }

observant2 commented 2 years ago

that gives me this:

error[E0425]: cannot find value `BUFFER_AGE_EXT` in module `ffi::egl`
   --> C:\Users\Admin\.cargo\registry\src\github.com-1ecc6299db9ec823\glutin-0.29.0\src\api\egl\mod.rs:584:27
    |
584 |                 ffi::egl::BUFFER_AGE_EXT as i32,
    |                           ^^^^^^^^^^^^^^ not found in `ffi::egl`

Do I need to use nightly or so?

thebracket commented 2 years ago

You shouldn't, but that's good to know. I recently upped the glutin version, and it's working here. Maybe try a rustup update to make sure you have the latest toolchian? What platform/OS are you using? That's definitely one I need to hunt down.

observant2 commented 2 years ago

Windows 10, I recently downloaded rust, so I should be fairly up to date. 🤷‍♂️

thebracket commented 2 years ago

I just checked out your repo. I see that you're using specs, so I updated Cargo.toml to:

[package]
name = "vortex"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bracket-lib = { git= "https://github.com/amethyst/bracket-lib.git", features = [ "specs" ] }
specs = "0.18.0"
specs-derive = "0.4.1"
num = "0.4.0"

I don't see gaps - the scaling code seems to work: image

Very odd that you got an FFI error. That's the "glutin" library looking for some C code in your OpenGL support. Maybe there's a driver issue? I don't have a wide range of systems to test on (I'm on a Win11 PC and it works).

I did just find a couple of other bugs trying to see if Vulkan/DX12 would work - so I'll chug away on those. Thanks!

thebracket commented 2 years ago

And there it is in DirectX12: image

[dependencies]
bracket-lib = { git= "https://github.com/amethyst/bracket-lib.git", default-features = false, features = [ "specs", "webgpu" ] }

(In case that works better than OpenGL for your drivers)

observant2 commented 2 years ago

Yes, adding specs to features worked, but I guess it should still compile without it.^^ Thank you! This probably will make it into the next version, but in the meantime I pinned my project to the current revision, so it won't break by accident. :)

[dependencies.bracket-lib]
git = "https://github.com/amethyst/bracket-lib.git"
rev = "10f2b9d3c237125e6a456dae0f291a4b6f18a5dc"
features = ["specs"]