FyroxEngine / Fyrox

3D and 2D game engine written in Rust
https://fyrox.rs
MIT License
7.48k stars 339 forks source link

thread 'main' panicked #616

Closed realroot2185 closed 2 months ago

realroot2185 commented 3 months ago

I just made an empty project:

cargo install fyrox-template
fyrox-template init --name fyrox_test --style 2d
cd fyrox_test
cargo run --package editor --release
[...]
thread 'main' panicked at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fyroxed_base-0.20.1/src/lib.rs:575:56:
called `Result::unwrap()` on an `Err` value: Custom("\"No such file or directory\"")
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::result::unwrap_failed
   3: fyroxed_base::Editor::new
   4: editor::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Did I miss something?

Kernel: 6.7.5-artix1-1 
arch: x86_64
Distro: Artix Linux
mrDIMAS commented 3 months ago

Looks like your OS does not support OpenGL 3.3. Run glxinfo to check which version is supported. If you're trying to run the editor under an virtual machine, make sure you use VMWare Workstation. Other virtual machines does not support OpenGL 3.3+.

realroot2185 commented 3 months ago

It is not in a VM.

glxinfo | grep OpenGL
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: NVIDIA GeForce GTX 1060 3GB/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 545.29.06
OpenGL core profile shading language version string: 4.60 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.6.0 NVIDIA 545.29.06
OpenGL shading language version string: 4.60 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 545.29.06
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:

Do I have 4.60 version and 3.20 for ES?

mrDIMAS commented 3 months ago

It also might be related to ALSA, in any case the error message in not helping at all. You can help the project by debugging the issue.

realroot2185 commented 3 months ago

How do I debug? Using RUST_BACKTRACE=full?

mrDIMAS commented 3 months ago

I think you need to go to https://github.com/FyroxEngine/Fyrox/blob/master/src/engine/mod.rs#L1304 and replace ? signs with unwrap() to see what's exactly fails.

realroot2185 commented 3 months ago

I cloned the repo and replaced ? signs. After I ran cargo build.

Then do I simply use cargo run --package editor --release again?

mrDIMAS commented 3 months ago

You can just cargo run --package fyroxed from the engine repo to run the editor without any plugins.

realroot2185 commented 3 months ago
cargo run --package fyroxed
...
[INFO]: Shader FXAAShader linked successfully!
ALSA lib pcm_dmix.c:1000:(snd_pcm_dmix_open) unable to open slave
thread 'main' panicked at src/engine/mod.rs:1511:64:
called `Result::unwrap()` on an `Err` value: "No such file or directory"
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::result::unwrap_failed
   3: core::result::Result<T,E>::unwrap
             at /build/rust/src/rustc-1.76.0-src/library/core/src/result.rs:1073:23
   4: fyrox::engine::Engine::initialize_graphics_context
             at ./src/engine/mod.rs:1511:13
   5: fyroxed_base::Editor::on_resumed
             at ./editor/src/lib.rs:2479:9
   6: fyroxed_base::Editor::run::{{closure}}
             at ./editor/src/lib.rs:2572:21
   7: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
             at /build/rust/src/rustc-1.76.0-src/library/core/src/ops/function.rs:294:13
   8: winit::platform_impl::platform::x11::EventLoop<T>::single_iteration
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.14/src/platform_impl/linux/x11/mod.rs:553:13
   9: winit::platform_impl::platform::x11::EventLoop<T>::pump_events
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.14/src/platform_impl/linux/x11/mod.rs:441:13
  10: winit::platform_impl::platform::x11::EventLoop<T>::run_on_demand
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.14/src/platform_impl/linux/x11/mod.rs:408:19
  11: winit::platform_impl::platform::EventLoop<T>::run_on_demand
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.14/src/platform_impl/linux/mod.rs:829:56
  12: winit::platform_impl::platform::EventLoop<T>::run
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.14/src/platform_impl/linux/mod.rs:822:9
  13: winit::event_loop::EventLoop<T>::run
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.14/src/event_loop.rs:249:9
  14: fyroxed_base::Editor::run
             at ./editor/src/lib.rs:2549:9
  15: fyroxed::main
             at ./editor-standalone/src/main.rs:33:5
  16: core::ops::function::FnOnce::call_once
             at /build/rust/src/rustc-1.76.0-src/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
mrDIMAS commented 3 months ago

Looks like a problem on your end. I don't use Linux, and the only thing I can do is google for solutions ((snd_pcm_dmix_open) unable to open slave):

https://forums.debian.net/viewtopic.php?t=123902 https://www.linuxquestions.org/questions/slackware-14/no-sound-with-flash-player-in-firefox-after-adding-nvidia-gt-220-graphics-card-809773/

realroot2185 commented 3 months ago

Audio is working fine so I did not think about that error.

I made the file /etc/modprobe.d/alsa.conf with this content: options snd_hda_intel index=1 And now it works.

Maybe fyrox could give the error as after I modified the function? That's why I did not close the issue.

realroot2185 commented 3 months ago
[WARNING]: OpenGL Message
    Source: Calls to the OpenGL API
    Type: Code has triggered possible performance issues
    Id: 131218
    Message: Program/shader state performance warning: Vertex shader in program 96 is being recompiled based on GL state.
[INFO]: A new associated scene rendering data was created for scene 2:1!
[...]
[INFO]: Shader GaussianBlurShader linked successfully!
[WARNING]: Failed to load settings, fallback to default. Reason: Io(Os { code: 2, kind: NotFound, message: "No such file or directory" })
[INFO]: Graphics settings were applied successfully!
[INFO]: New working directory was successfully set: "/path/to/rpg"
thread 'main' panicked at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fyrox-resource-0.11.0/src/lib.rs:429:17:
Attempt to get reference to resource data which failed to load! Path is External ()
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I used cargo run --package editor in a new project fyrox-template init --name=rpg --style=3d. Not sure what's the problem.

mrDIMAS commented 3 months ago

Could you please show the full stack trace?

realroot2185 commented 3 months ago
thread 'main' panicked at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fyrox-resource-0.11.0/src/lib.rs:429:17:
Attempt to get reference to resource data which failed to load! Path is External ()
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: <fyrox_resource::ResourceDataRef<T> as core::ops::deref::Deref>::deref
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fyrox-resource-0.11.0/src/lib.rs:429:17
   3: fyrox::scene::terrain::make_quad_tree
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fyrox-0.33.1/src/scene/terrain/mod.rs:95:22
   4: <fyrox::scene::terrain::Chunk as fyrox_core::visitor::Visit>::visit
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fyrox-0.33.1/src/scene/terrain/mod.rs:231:26
   5: <alloc::vec::Vec<T> as fyrox_core::visitor::Visit>::visit
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fyrox-core-0.27.0/src/visitor.rs:1391:17
   6: <fyrox_core::variable::InheritableVariable<T> as fyrox_core::visitor::Visit>::visit
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fyrox-core-0.27.0/src/variable.rs:255:29
   7: <fyrox::scene::terrain::Terrain as fyrox_core::visitor::Visit>::visit
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fyrox-0.33.1/src/scene/terrain/mod.rs:773:17
   8: <fyrox::scene::node::Node as fyrox_core::visitor::Visit>::visit
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fyrox-0.33.1/src/scene/node/mod.rs:500:9
   9: fyrox::scene::node::container::read_node
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fyrox-0.33.1/src/scene/node/container.rs:105:13
  10: <fyrox::scene::node::container::NodeContainer as fyrox_core::visitor::Visit>::visit
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fyrox-0.33.1/src/scene/node/container.rs:134:44
  11: <fyrox_core::pool::PoolRecord<T,P> as fyrox_core::visitor::Visit>::visit
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fyrox-core-0.27.0/src/pool.rs:517:9
  12: <alloc::vec::Vec<T> as fyrox_core::visitor::Visit>::visit
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fyrox-core-0.27.0/src/visitor.rs:1391:17
  13: <fyrox_core::pool::Pool<T,P> as fyrox_core::visitor::Visit>::visit
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fyrox-core-0.27.0/src/pool.rs:549:9
  14: <fyrox::scene::graph::Graph as fyrox_core::visitor::Visit>::visit
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fyrox-0.33.1/src/scene/graph/mod.rs:2162:9
  15: fyrox::scene::Scene::visit
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fyrox-0.33.1/src/scene/mod.rs:446:9
  16: fyrox::scene::SceneLoader::load
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fyrox-0.33.1/src/scene/mod.rs:308:9
  17: fyrox::scene::SceneLoader::from_file::{{closure}}
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fyrox-0.33.1/src/scene/mod.rs:280:22
  18: futures_executor::local_pool::block_on::{{closure}}
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-executor-0.3.30/src/local_pool.rs:317:23
  19: futures_executor::local_pool::run_executor::{{closure}}
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-executor-0.3.30/src/local_pool.rs:90:37
  20: std::thread::local::LocalKey<T>::try_with
             at /build/rust/src/rustc-1.76.0-src/library/std/src/thread/local.rs:270:16
  21: std::thread::local::LocalKey<T>::with
             at /build/rust/src/rustc-1.76.0-src/library/std/src/thread/local.rs:246:9
  22: futures_executor::local_pool::run_executor
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-executor-0.3.30/src/local_pool.rs:86:27
  23: futures_executor::local_pool::block_on
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-executor-0.3.30/src/local_pool.rs:317:5
  24: fyroxed_base::Editor::load_scene
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fyroxed_base-0.20.1/src/lib.rs:1820:21
  25: fyroxed_base::Editor::update
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fyroxed_base-0.20.1/src/lib.rs:2235:25
  26: fyroxed_base::update
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fyroxed_base-0.20.1/src/lib.rs:2620:9
  27: fyroxed_base::Editor::run::{{closure}}
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fyroxed_base-0.20.1/src/lib.rs:2439:25
  28: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
             at /build/rust/src/rustc-1.76.0-src/library/core/src/ops/function.rs:294:13
  29: winit::platform_impl::platform::x11::EventLoop<T>::single_iteration
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/x11/mod.rs:614:13
  30: winit::platform_impl::platform::x11::EventLoop<T>::pump_events
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/x11/mod.rs:441:13
  31: winit::platform_impl::platform::x11::EventLoop<T>::run_on_demand
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/x11/mod.rs:408:19
  32: winit::platform_impl::platform::EventLoop<T>::run_on_demand
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/mod.rs:829:56
  33: winit::platform_impl::platform::EventLoop<T>::run
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/platform_impl/linux/mod.rs:822:9
  34: winit::event_loop::EventLoop<T>::run
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.15/src/event_loop.rs:249:9
  35: fyroxed_base::Editor::run
             at ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fyroxed_base-0.20.1/src/lib.rs:2436:14
  36: editor::main
             at ./editor/src/main.rs:16:5
  37: core::ops::function::FnOnce::call_once
             at /build/rust/src/rustc-1.76.0-src/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
mrDIMAS commented 3 months ago

Looks like an outdated built-in scene, go to your_project/editor/src/main.rs and find scene field in StartupOptions and set it to None. This way the editor should start without the scene and it will load fine.

realroot2185 commented 3 months ago

<project>/editor/src/main.rs

//! Editor with your game connected to it as a plugin.

use fyrox::event_loop::EventLoop;
use fyroxed_base::{Editor, StartupData};
use rpg::GameConstructor;

fn main() {
    let event_loop = EventLoop::new().unwrap();
    let mut editor = Editor::new(
        &event_loop,
        Some(StartupData {
            working_directory: Default::default(),
            scenes: vec!["data/scene.rgs".into()],
        }),
    );
    editor.add_game_plugin(GameConstructor);
    editor.run(event_loop)
}

This is what I have, it's the default code generated by the template.

I set it to scenes: Vec::new() and now it starts.

realroot2185 commented 3 months ago

Looks like an outdated built-in scene, go to your_project/editor/src/main.rs and find scene field in StartupOptions and set it to None. This way the editor should start without the scene and it will load fine.

Will that scene be fixed? Are there other scene that I can use?

mrDIMAS commented 3 months ago

I'll fix this. Which version of the engine do you use btw?

realroot2185 commented 3 months ago

Not sure to how check. In my path, which has ~/.cargo/bin, I have only fyrox-template.

cargo install --list 
fyrox-template v0.10.0:
    fyrox-template

I have fyrox-0.33.1 in ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/.

mrDIMAS commented 3 months ago

Looks like stable from crates.io. I think I can submit a patch 0.33.2. I will do this only tomorrow.

realroot2185 commented 3 months ago

Could you tag me when you do it? Thanks.

mrDIMAS commented 3 months ago

I just checked this bug and I cannot reproduce it. Built-in scene loads fine, in the stack trace I see that it fails on make_quad_tree, but I just created a terrain, saved the scene, restarted the editor and it loads fine. I did this on 0.33.1. Any details of how to reproduce the bug?

realroot2185 commented 3 months ago

I have that problem with RPG scene: https://fyrox-book.github.io/tutorials/rpg/tutorial-1/data.zip. Did you try the built-in scene of the template or that too?

mrDIMAS commented 3 months ago

That scene needs to be re-made anyways, I don't have time for this now. Just create your own scene

realroot2185 commented 3 months ago

Is there some other scene that one can take from some Fyrox game for example?

mrDIMAS commented 3 months ago

You can take Sponza from here - https://github.com/FyroxEngine/Fyrox-demo-projects/tree/main/sound/data