solenum / exengine

A C99 3D game engine
https://oods.net
MIT License
550 stars 31 forks source link

Default game hangs after launching the binary generated by make on cygwin #9

Closed lewis-carson closed 4 years ago

lewis-carson commented 5 years ago

A command prompt window opens, and then becomes unresponsive immediately.

solenum commented 5 years ago

I'm assuming this is Windows 10? Could you paste the make output and also any output you get when running the .exe. Also knowing your system specs might help.

Is this hang constant, or does it resume eventually?

lewis-carson commented 5 years ago

It never resumes, I have to force quit eventually.

Make output: mkdir -p obj mkdir -p build/licence cp licence/* build/licence/ zip -r -FS build/data.ex data/ adding: data/ (stored 0%) adding: data/.gitignore (stored 0%) adding: data/conf.cfg (deflated 11%) adding: data/cube.iqm (deflated 65%) adding: data/dude.iqm (deflated 43%) adding: data/fonts/ (stored 0%) adding: data/fonts/Apache License.txt (deflated 66%) adding: data/fonts/OpenSans-Regular.ttf (deflated 46%) adding: data/fonts/SIL Open Font License.txt (deflated 57%) adding: data/fonts/SourceSansPro-Regular.otf (deflated 43%) adding: data/level.iqm (deflated 66%) adding: data/level_2.iqm (deflated 43%) adding: data/shaders/ (stored 0%) adding: data/shaders/fboshader.glsl (deflated 50%) adding: data/shaders/forward.glsl (deflated 70%) adding: data/shaders/gbuffer.glsl (deflated 69%) adding: data/shaders/gmain.glsl (deflated 70%) adding: data/shaders/imgui.glsl (deflated 52%) adding: data/shaders/pointfbo.glsl (deflated 64%) adding: data/shaders/primshader.glsl (deflated 44%) adding: data/shaders/ssao.glsl (deflated 60%) adding: data/shaders/text.glsl (deflated 51%) adding: data/sound.ogg (deflated 21%) adding: data/textures/ (stored 0%) adding: data/textures/ball.png (deflated 87%) adding: data/textures/bar.png (deflated 0%) adding: data/textures/dev.png (deflated 95%) adding: data/textures/devg.png (deflated 35%) adding: data/textures/devo.png (deflated 5%) adding: data/textures/floor.png (deflated 1%) adding: data/textures/floorr.png (deflated 23%) adding: data/textures/gun.png (stored 0%) adding: data/textures/human.png (stored 0%) adding: data/textures/new_diff.png (deflated 0%) adding: data/textures/norm_ball.png (deflated 93%) adding: data/textures/norm_bar.png (deflated 0%) adding: data/textures/norm_dev.png (deflated 46%) adding: data/textures/norm_floor.png (deflated 1%) adding: data/textures/norm_human.png (deflated 0%) adding: data/textures/norm_nwall.png (deflated 1%) adding: data/textures/norm_rock.png (deflated 0%) adding: data/textures/norm_wall.png (deflated 0%) adding: data/textures/norm_white.png (deflated 0%) adding: data/textures/rock.png (deflated 0%) adding: data/textures/sky_back.png (deflated 0%) adding: data/textures/sky_bottom.png (deflated 0%) adding: data/textures/sky_front.png (deflated 0%) adding: data/textures/sky_left.png (deflated 0%) adding: data/textures/sky_right.png (deflated 0%) adding: data/textures/sky_top.png (deflated 0%) adding: data/textures/space_back.png (deflated 2%) adding: data/textures/space_bottom.png (deflated 2%) adding: data/textures/space_front.png (deflated 1%) adding: data/textures/space_left.png (deflated 2%) adding: data/textures/space_right.png (deflated 2%) adding: data/textures/space_top.png (deflated 1%) adding: data/textures/spec_ball.png (deflated 87%) adding: data/textures/spec_bar.png (deflated 0%) adding: data/textures/spec_dev.png (deflated 89%) adding: data/textures/spec_floor.png (deflated 0%) adding: data/textures/spec_human.png (deflated 2%) adding: data/textures/spec_rock.png (deflated 1%) adding: data/textures/spec_stg.png (deflated 1%) adding: data/textures/spec_wall.png (deflated 0%) adding: data/textures/spec_white.png (deflated 0%) adding: data/textures/stg.png (deflated 1%) adding: data/textures/stuff.png (deflated 66%) adding: data/textures/w.png (deflated 7%) adding: data/textures/wall.png (deflated 0%) adding: data/textures/walll.png (deflated 22%) adding: data/textures/white.png (deflated 0%) adding: data/textures/wkcamp_top.png (deflated 0%) cp lib/win/dll/* build x86_64-w64-mingw32-gcc -o build/game obj/main.o obj/game.o obj/cimgui.o obj/fontAtlas.o obj/drawList.o obj/listClipper.o obj/imgui.o obj/imgui_draw.o obj/imgui_demo.o obj/imgui_dock.o obj/physfs_archiver_7z.o obj/physfs_archiver_mvl.o obj/physfs_archiver_wad.o obj/physfs_platform_posix.o obj/physfs_archiver_dir.o obj/physfs_archiver_qpak.o obj/physfs_archiver_zip.o obj/physfs_platform_qnx.o obj/physfs_archiver_grp.o obj/physfs_archiver_slb.o obj/physfs_byteorder.o obj/physfs_platform_unix.o obj/physfs_archiver_hog.o obj/physfs_archiver_unpacked.o obj/physfs.o obj/physfs_platform_windows.o obj/physfs_archiver_iso9660.o obj/physfs_archiver_vdf.o obj/physfs_platform_os2.o obj/physfs_unicode.o obj/window.o obj/mesh.o obj/camera.o obj/texture.o obj/iqm.o obj/framebuffer.o obj/pointlight.o obj/scene.o obj/model.o obj/dirlight.o obj/skybox.o obj/collision.o obj/entity.o obj/octree.o obj/glimgui.o obj/dbgui.o obj/gbuffer.o obj/spotlight.o obj/ssao.o obj/engine.o obj/reflectionprobe.o obj/shader.o obj/defaults.o obj/input.o obj/sound.o obj/cache.o obj/text.o obj/msdf.o -g -lm -static -static-libgcc -static-libstdc++ -lstdc++ -Llib/win -lopengl32 -lglew32 -lglfw3dll -lopenal32 -DGLEW_NO_GLU -I. -Ilib/ -Iinc/ -Ilib/physfs/ -std=c99 **success**

I'm running windows 10 version 1809 and an nvidea 1050 with an 15 7th gen.

Here's what the command prompt window shows: screenshot 74

solenum commented 5 years ago

Oof, appears there was some whitespaced added to a file path in an older commit, should be fixed now. Could you confirm this for me?

lewis-carson commented 5 years ago

Sorry, still not working, same problem!

solenum commented 5 years ago

Rather difficult to debug without much to go on, I'm assuming your GPU drivers are up to date? Make sure you've pulled the very latest version of the engine with all the changes, run 'make clean' and re-run 'make' to get a new build.

Also try running the .exe from the Cygwin terminal (./game.exe) and from the Windows file explorer.

solenum commented 5 years ago

Wait, if I recall there's an issue with PhysFS on Windows 10 ver. 1809. There's been no new PhysFS release for a while.

Could you download this and extract it to src/lib/physfs (replacing all of the files), and do a full re-compile?

https://icculus.org/physfs/downloads/physfs-3.0.1.tar.bz2

I have no idea if the fix for 1809 is in that physfs release as it doesn't specify on when it was last updated, assuming it doesn't work for you I'll have to implement the fix myself.

Edit; I should specify, you need to extract the contents of the src/ dir in that tar.bz2 into src/lib/physfs, replacing all of the files in that directory.

lewis-carson commented 5 years ago

Unfortunately, this isn't working. When launching from cygwin it gives a seg fault and same as with the physfs patch. Have you any more possible fixes?

solenum commented 5 years ago

I'll need to update to build 1809 of Windows 10 myself and see if I can debug this, I'm sure its related to the physfs issue and I'm still not sure they've had a release yet that includes the fix for the API change in 1809.

The changes are listed below, if you want to attempt to modify the physfs source yourself to see if these fixes resolve the issue:

https://hg.icculus.org/icculus/physfs/rev/93b4c3bc6b9d https://hg.icculus.org/icculus/physfs/rev/ece6769c0676 https://hg.icculus.org/icculus/physfs/rev/ea88839fe34f

Edit;

Could you send me the compiled .exe? (Just the .exe, nothing else). I'll try it on my machine to confirm that the issue is in either the Windows version, or your hardware/driver setup.

solenum commented 5 years ago

After a lot of faffing about I finally got my Windows to build 1809. I can replicate the issue and I'm working on a fix at the moment :)

solenum commented 5 years ago

Alright I've pushed some changes, this should be resolved now. @torvim could you confirm this fix resolves the issue on your end?

lewis-carson commented 5 years ago

Sorry, I'm not at home at the moment, I'll be able to test in a few hours and confirm it for you.

lewis-carson commented 5 years ago

Sorry, still not working. Getting this (below), and then it hangs.

Loading config file data/conf.cfg Config variables: window_width = 1280 window_height = 720 Failed to initialize window Cleaning up scene

solenum commented 5 years ago

Well, that's progress. Could you post your (full) system specs please? And I'm assuming you're on a 64bit version of Windows? Including GPU driver versions if possible.

(Also are you on a laptop with a dual GPU setup?)

solenum commented 5 years ago

@torvim boop

BenjaminGu commented 5 years ago

I get the same error message.

Failed to initialize window

My system spec. Laptop Os windows 10 64bit Vga nvidia geforce 1050 Vga driver 419.17 February 22, 2019 Cpu intel i5 7600 Ram 16G

solenum commented 5 years ago

@BenjaminGu Could you try changing argument 4 in glfwCreateWindow (src/exengine/window.c line 20) from NULL to 'glfwGetPrimaryMonitor()' and see if that resolves the issue?

- display.window = glfwCreateWindow(width, height, title, NULL, NULL);
+ display.window = glfwCreateWindow(width, height, title, glfwGetPrimaryMonitor(), NULL);
BenjaminGu commented 5 years ago
- display.window = glfwCreateWindow(width, height, title, NULL, NULL);
+ display.window = glfwCreateWindow(width, height, title, glfwGetPrimaryMonitor(), NULL);

I'm sorry. But, Still not working with the same error message.

solenum commented 5 years ago

Could you confirm that your system supports at least GL 3.3 and your GPU drivers are up to date?

I've just pushed some changes that add error logging for GLFW, could you compile/run the latest changes I have made and let me know if GLFW throws an error?

BenjaminGu commented 5 years ago

GLFW throws an error as follows.

GLFW ERR (65540)
Invalid window size 0x0

src/exengine/engine.c line 60 and 61

width = conf_get_int(&conf, "window_width");
height = conf_get_int(&conf, "window_height");

both conf_get_int return 0 conf_get_int function return 0 at exe_conf.h line 173.

I set the width and height as follows and run game.exe successfully.

width = 1280;
height = 800;
solenum commented 5 years ago

Huh, that's bizarre. The conf vars for the window resolution are indeed window_width and window_height, I'm surprised it worked with just width and height. I'll need to investigate the config loader and figure out whats going wrong. (Whole thing needs a re-write to be honest)

Strange that I can't replicate this on Windows 10 myself.

solenum commented 4 years ago

As of https://github.com/exezin/exengine/commit/a0919fc6f2900a12d099b12623805bbb62c064da the config loader has been replaced with a more robust ini-esque one, so I assume this issue is resolved.

Feel free to re-open if the issue persists for you.