schellingb / ZillaLib

Sleek multiplatform C++ 2D and 3D game creation!
https://zillalib.github.io/
zlib License
109 stars 8 forks source link

Fail to build for wasm on macOS #2

Closed pixelpicosean closed 5 years ago

pixelpicosean commented 5 years ago

It says SYSSOURCES contains a filename with a $ character in it - Unable to continue with all dependence set up (using emsdk_portable and updated to latest emscripten)

I comment these lines (ZillaLibWasm.mk L251-253) out to be able to continue:

ifeq ($(findstring $,$(SYSSOURCES)),$)
  $(error SYSSOURCES contains a filename with a $$ character in it - Unable to continue)
endif

But the building process failed again, says: unable to create target: 'No available targets are compatible with this triple.' 1 error generated.

schellingb commented 5 years ago

Hi there! Thank you so much for trying ZillaLib and filing this issue.

I just committed some fixes for the WebAssembly builds on non-Windows platforms. The choice of $ as a replacement character wasn't great as on unix-like shells $ is used for environment variables. It should be better now.

As for the second problem, make sure you have the latest clang and lld with wasm support from https://releases.llvm.org/download.html. I tested with clang-8 and lld from clang+llvm-8.0.0-x86_64-apple-darwin.tar.xz and I could build fine on a not-so-up-to-date macOS. If problems persist, you can run make wasm -n to see the command line used to invoke clang which should help us diagnose this further.

Also, you sadly have to make sure that the paths for LLVM_ROOT and SYSTEM_ROOT given in ZillaAppLocalConfig.mk don't contain any spaces as make is not good at handling such paths.

pixelpicosean commented 5 years ago

Switch to LLVM 8.0.0 solved it :)

Your framework is just amazing, I especially love small binary size cause I mostly do web games. Will try it more.

BTW. ZillaLib supports 3D rendering, but I wander is it possible to render "unshaded" style 3D graphics? Something like krakens-curse-gif link to the game

schellingb commented 5 years ago

So happy that it works! Thanks for the praise, small output size is what drives me mostly :-)

Regarding un-shaded, graphics, with vertex coloring like in sample 31 you're halfway there. A more toon-shaded effect is sadly not supported out of the box. I played a bit with the light calculation and achieved the following look quite easily: image

//light calculation for directional light
Z3L_LIGHTFACTOR " = max(dot(" Z3S_NORMAL ", " Z3U_LIGHTDATA "[1+i*3]), 0.);" //original
Z3L_LIGHTFACTOR " = (dot(" Z3S_NORMAL ", " Z3U_LIGHTDATA "[1+i*3]) > .1 ? 1. : 0.);" //toon look

//light calculation for spot light
Z3L_LIGHTFACTOR " = max(dot(" Z3S_NORMAL ", " Z3L_DIRECTION2LIGHT "), 0.);" //original
Z3L_LIGHTFACTOR " = (dot(" Z3S_NORMAL ", " Z3L_DIRECTION2LIGHT ") > .1 ? 1. : 0.);" //toon look

But the 3D functionality is still very far from a full fledged 3D engine. Things shown in the game you linked like skeletal animation, moving water, the moving sail etc. would not be easy without touching the framework I think.

Features of ZillaLib are mostly driven by the small games I make. The most advanced 3D game I made with it is Altar War, it shows the state of most of the 3D features.

pixelpicosean commented 5 years ago

Thanks for the advice. And I think this issue should be closed now.