ptitSeb / friking-shark

Port of Friking Shark (remake of Flying Shark) on the OpenPandora, Odroid and most Linux. Also with AmigaOS4 support. Status: Working (using gl4es).
https://boards.openpandora.org/topic/5600375-friking-shark/
Other
11 stars 0 forks source link

amigaos4 build #21

Open kas1e opened 5 years ago

kas1e commented 5 years ago

Hi ! Tried to build SDL2 version for amigaos4 , and tryint to use CMAKE as i am on crosscompiler, so can use that one.

That what i tried:

cd friking-shark-master

mkdir build cd build cmake \ -DCMAKE_SYSTEM_NAME=Generic \ -DCMAKE_SYSTEM_VERSION=1 \ -DSDL=ON \ -DCMAKE_C_COMPILER="/usr/local/amiga/bin/ppc-amigaos-gcc" \ -DCMAKE_CXX_COMPILER="/usr/local/amiga/bin/ppc-amigaos-g++" \ -DCMAKE_LINKER="/usr/local/amiga/bin/ppc-amigaos-ld" \ -DCMAKE_AR="/usr/local/amiga/bin/ppc-amigaos-ar" \ -DCMAKE_RANLIB="/usr/local/amiga/bin/ppc-amigaos-ranlib" \ -DCMAKE_FIND_ROOT_PATH="/usr/local/amiga/ppc-amigaos/" \ -DZLIB_INCLUDE_DIR="/usr/local/amiga/ppc-amigaos/SDK/Local/common/include/" \ -DZLIB_LIBRARY="/usr/local/amiga/ppc-amigaos/SDK/Local/newlib/lib/libz.a" \ -DPNG_PNG_INCLUDE_DIR="/usr/local/amiga/ppc-amigaos/SDK/Local/common/include/libpng12/" \ -DPNG_LIBRARY="/usr/local/amiga/ppc-amigaos/SDK/Local/newlib/lib/libpng12.a" \ -DOPENGL_gl_LIBRARY="libgl4es.a" \ -DOPENAL_LIBRARY="/usr/local/amiga/ppc-amigaos/SDK/Local/newlib/lib/libopenal.a" \ -DOPENAL_INCLUDE_DIR="/usr/local/amiga/ppc-amigaos/SDK/Local/common/include/AL/" \ -DTIFF_INCLUDE_DIR="/usr/local/amiga/ppc-amigaos/SDK/Local/common/include/" \ -DTIFF_LIBRARY="/usr/local/amiga/ppc-amigaos/SDK/Local/newlib/lib/libtiff.a" \ -DJPEG_INCLUDE_DIR="/usr/local/amiga/ppc-amigaos/SDK/Local/common/include/" \ -DJPEG_LIBRARY="/usr/local/amiga/ppc-amigaos/SDK/Local/newlib/lib/libjpeg_8b.a" \ ..

It the says :

CMake Error at CMakeLists.txt:21 (FIND_PACKAGE): By not providing "FindSDL2.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "SDL2", but CMake did not find one.

Could not find a package configuration file provided by "SDL2" with any of the following names:

SDL2Config.cmake
sdl2-config.cmake

Add the installation prefix of "SDL2" to CMAKE_PREFIX_PATH or set "SDL2_DIR" to a directory containing one of the above files. If "SDL2" provides a separate development package or SDK, be sure it has been installed.

-- Configuring incomplete, errors occurred!

I tried to remove from CMakeList.txt : FIND_PACKAGE(SDL2 REQUIRED) (as i will link everything manually at end anyway), so , it then cry about non possibility to build shared versions and will use static instead (that ok), but then at end:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files:

XINERAMA_LIBRARY linked by target "GameGraphics" in directory /d/friking-shark-master XRANDR_LIBARY linked by target "GameGraphics" in directory /d/friking-shark-master

-- Configuring incomplete, errors occurred!

I probably can set them to some void nulls , but probably they need to be removed from CMake if "-DSDL=ON" is used ?

ptitSeb commented 5 years ago

ah, push everything.... so that doesn't help :'(

Look at this function, you'll see it's composed of a series of if(mask & ...): if you could put some printf before (or after) each block, to understand wich one trigger the issue...

Also, about the missing models. Is there a version (with scripts hacked for example) were the models were visible or you never saw them? same question for the water (but I guess the shader compiler error is the water one...).

kas1e commented 5 years ago

Window/fullscreen mode works. At least in fullscreen it now take by default my desctop resolution, and in window it set some as well (a little bit wrong one it seems, but that we can keep for now, as not so matter).

ah, push everything.... so that doesn't help :'(

By the way, when i trying to start level (i.e. when i have grey screen), or when i just press "Exit" from menu (and also have grey screen), in console i have lots of glPushAttrib(0xFFFFF) which is never ends.

Look at this function, you'll see it's composed of a series of if(mask & ...): if you could put some printf before (or after) each block, to understand wich one trigger the issue...

Added before and after each block (17 blocks in summ, so 34 printfs) , and it pass first 13 blocks and fail before 14st one , which is:

printf("we before 14..\n"); // TODO: GL_STENCIL_BUFFER_BIT if (mask & GL_STENCIL_BUFFER_BIT) { cur->stencil_test = gl4es_glIsEnabled(GL_STENCIL_TEST); gl4es_glGetIntegerv(GL_STENCIL_FUNC, &cur->stencil_func); gl4es_glGetIntegerv(GL_STENCIL_VALUE_MASK, &cur->stencil_mask); gl4es_glGetIntegerv(GL_STENCIL_REF, &cur->stencil_ref); //TODO: glStencilFuncSeperate

//TODO: Stencil value mask gl4es_glGetIntegerv(GL_STENCIL_FAIL, &cur->stencil_sfail); gl4es_glGetIntegerv(GL_STENCIL_PASS_DEPTH_FAIL, &cur->stencil_dpfail); gl4es_glGetIntegerv(GL_STENCIL_PASS_DEPTH_PASS, &cur->stencil_dppass); //TODO: glStencilOpSeparate

gl4es_glGetIntegerv(GL_STENCIL_CLEAR_VALUE, &cur->stencil_clearvalue); //TODO: Stencil buffer writemask } printf("we after 14..\n");

So i never see last printf.

Also, about the missing models. Is there a version (with scripts hacked for example) were the models were visible or you never saw them? same question for the water (but I guess the shader compiler error is the water one...).

I never see water that for sure, but today when i create bugreport for warp3dnova, i found what line in shaders cause issue , it is gl_TexCoord[0]=gl_TextureMatrix[0]*gl_MultiTexCoord0; Hans says that its his optimizer make a mistake, which he will fix soon (but probabaly in next few days).

As for models : nope as well. All what i see its only menus : first one, and one where levels to choice.

kas1e commented 5 years ago

Watched youtube video of friking shark again and nope, i never see any kind of anymation. I.e. i didn't see a boat which come from bottom to top, didn't see moved water, and didn't see fade-out animation when level should start. All looks pretty static

ptitSeb commented 5 years ago

Ah stencil? Mmmm, strange it makes a crash. I guess there is a bug (in Warp3D?) when getting/settings stencil stuff and there is no stencil buffer.

I can try to track stencil state, I had planned to do that one day (because it helps speed in general to track more stuffs), that may help (not sure when I'll do that, it's not difficult a bit boring to do).

kas1e commented 5 years ago

If i comment out that block about stencil then have no crash, but it didnt help to no-background-no-animation in menu issue. Can stencil stuff be related to that ?

I need to report that crash to Hans, but is it legal to set/get stencil stuff when there is no stencil buffer ? Or can we made some small test case to reproduce it ?

ptitSeb commented 5 years ago

I don't see anything illegal there. And it's allowed to query stencil status even if no stencil buffer is present. Change are also permited (but they'll have no effect with no stencil buffer).

ptitSeb commented 5 years ago

I pushed Stencil stuff tracking in gl4es. I guess it will not crash anymore.

Now, what you can try is to force OpenGL 1.5, to avoid the use of shader. Use LIBGL_GL=15 or chnage in the configs files to disable shaders. Shader will not fail to load and, hopefully, everything will be on screen (models and water).

kas1e commented 5 years ago

I don't see anything illegal there. And it's allowed to query stencil status even if no stencil buffer is present. Change are also permited (but they'll have no effect with no stencil buffer).

I forwared to Hans crashlog, and he say that It's crashing in Warp3DNova's GetStencilFunc(), he have spotted a potential issue, so maybe soon he will be able to fix it as well.

I pushed Stencil stuff tracking in gl4es. I guess it will not crash anymore.

Yes, everything builds and links fine, and no crash anymore :) But fix in warp3dnova also necessary, just be safe for future, but that up to Hans now.. Is those changes good for every platform ? I mean to have tracking things in whole ?

Now, what you can try is to force OpenGL 1.5, to avoid the use of shader. Use LIBGL_GL=15 or chnage in the configs files to disable shaders. Shader will not fail to load and, hopefully, everything will be on screen (models and water).

Tried LIBGL_GL=15, and while i have in output that it targeting now to opengl 1.5, it still trying to load shaders. So, i then just change in the Resources/Scripts/GameGUI.cfg , value IgnoreShaderSupport from 0 to 1, shader then didn't loads, but still all the same :( The only differences without loading of shader, is that when i press "Go" for the level, or "exit" from main menu, instead of grey screen, i have now water-texture. But no animation and all static. And nothing happens next. I.e. cursor can be moved, over that texture and nothing else.

For example i run game, press exit right away, it show me water texture, cursor moves, but game didn't exit. There how it looks like:

http://kas1e.mikendezign.com/aos4/gl4es/games/frikingshark/frik5_no_shaders.jpg

kas1e commented 5 years ago

But press on closed-gadget of the SDL window, make game exit. So events works, just no anymation at all.

ptitSeb commented 5 years ago

What surprise me in the log you sent 2 days ago is that all time measurement are 0ms. I find this very fast! Too fast in fact, as if there was no time measurement. That could explain why there is no animation. I'll have to check how time is measure...

kas1e commented 5 years ago

Yeah, 0ms for everything all the time, even if i can see how some of resources take a little time, it still 0ms

ptitSeb commented 5 years ago

Time should be mesured using GetTimeStamp() function defined in PlatformDependent.cpp. There is already an AMIGAOS4 define there, to be sure it use gettimeofday(...) Maybe the implicit conversion from double to unsigned int is a bad idea?

kas1e commented 5 years ago

I just created a simple test case:

#include <stdio.h> #include <proto/dos.h>

unsigned int GetTimeStamp() { timeval tNow; gettimeofday(&tNow, NULL); return ((double)tNow.tv_sec)*1000.0+((double)tNow.tv_usec)/1000.0; }

int main() {

int nStartTime=GetTimeStamp();

IDOS->Delay(500);

printf("test time %d ms",GetTimeStamp()-nStartTime);

}

And while after running it wait for about 10 seconds, it then print me 0 ms !

ptitSeb commented 5 years ago

I just pushed a changed were I removed all the double calculation... Maybe that help? If it doesn't, how tNow is (just printf tNow.tv_sec and tNow.tv_usec content).

kas1e commented 5 years ago

With that change in the test case example i have in return 10000 ms, as it should be , yeah ! Will check no in the game itself. Strange why double calcualtion didn't works.. Something platform or compiler dependant ? Or maybe some flags of compiler ? Or even newlib library ,etc.. Will check game now.

kas1e commented 5 years ago

Ok ! Water here moving , boats move in the menu too. When i choice first level it fade in to black as on youtube video, all fine , but then, in console i have:

COOpenGLModel::LoadFromFile -> GCM file for Models/Level1Terrain.ase not found, rebuilding if possible COOpenGLModel::LoadBSP -> GCM file for Models/LEvel1Terrain.ase not exists, rebuilding COOpenGLModel::LoadFromFile -> Loaded model Models/LEvel1Terrain.ase (5590ms)

The same for playerfighter.ase and playerbullet.ase , and then freeze.

kas1e commented 5 years ago

I also run dos tracer, to see where it trying to find GCM files, and seems that files itself found. At least i can see locks on Models/PlayersBomb.gcm, etc, but then after few errors of this kind it crashes/freezes, and in stack trace i can see last lines about "vector" stuff, so probabaly its endianes in terms of reading some of gcm datas ?

ptitSeb commented 5 years ago

Normaly, there is a Level1Terrain.gbs that is generated (using .ase and/or .gcm). Do you have it ? But the message seems to be that the GCM is not found, so maybe I messed up one of the "AmigaPath" fix for this kind of file?

kas1e commented 5 years ago

Yeah,files there, and they seems found , just error maybe spawns when its in reality didnt read it ? Will recheck it now with printfs and stuff. But imho reading of gcm files not endian aware

ptitSeb commented 5 years ago

ASE files are ascii, so no endianness issues. But GCM ad GBS seems binary, and not bigendian aware at all :( I'll need to add code for those 2 formats...

kas1e commented 5 years ago

Hans fixed that stencil related issue (it was check of first pointer three times..)

As for .gbs . I delete all the gbs files which was before generated, and run the game again.

Then that what i have in output:

COOpenGLModel::LoadBSP -> GBS file for Models/Level1Terrain.ase does not exists, rebuilding COOpenGLModel::LoadFromFile -> Loaded model Models/Level1Terrain.ase (3189ms) COpenGLTexture::LoadFromFile ->Loadede texture player.png (42ms) COOpenGLModel::LoadFromFile -> Loaded model Models/PlayerFighter.ase (47ms) COpenGLTexture::LoadFromFile ->Loadede texture playerbullet.png (12ms) COOpenGLModel::LoadFromFile -> Loaded model Models/PlayerBullet.ase (27ms) COOpenGLModel::LoadFromFile -> Loaded model Models/PlayerBomb.ase (1ms)

And the crashes with some fatal error, even can't see stack trace.

But if i reboot, and go to models/ directory, i can see there creates 5 or 6 necessary gbs files.

kas1e commented 5 years ago

Hi ! Tried to build your last big-endian changes, and comiling of GCMFiles.cpp fail, with those errors: http://kas1e.mikendezign.com/aos4/gl4es/games/frikingshark/big_endian_compiling_errors.txt

ptitSeb commented 5 years ago

Ah yes. I should have fixed most of the errors now, with latest commits.

kas1e commented 5 years ago

Yes, almost fixed, through few still there: http://kas1e.mikendezign.com/aos4/gl4es/games/frikingshark/big_endian_compiling_errors_2.txt

ptitSeb commented 5 years ago

Should be ok, at least for GCMFiles.cpp now.

kas1e commented 5 years ago

Yeah, now compiles and links fine ! Sadly can test it only after 4 hours, fingers crossed :) Btw, if you in interest, few days ago i made some video where shown amigaos4 versions of prototype and barony (just a little bit, to tease aos4 users), there is:

https://www.youtube.com/watch?v=jIFG-9EHr94

Starting from 2:50 if prototype, and then after barony. But before release of all the stuff for xmas will made some normal video showing all about gl4es and co, so gl4es will got more attention, and some more donations for your good work :)

kas1e commented 5 years ago

Tested

For first delete all *.gbs files , so on first run i have words about "not exists, rebuilding", all is ok on this point, rebuilds 5 of them and then after last COpenGLModel::LoadFromFile -> loaded model from Models/PlayerBombs.ase (28ms) heavy crashes , i even didnt' have stack trace.

Then reboot, and run it again (to see, if rebuilded .gbs files reads at all and not bring errors), and then i didn't have any errors about "non found" or "can't load" about .gbs files , but still the same crash right after loading of PlayerBombs.ase. I even didn't catch any stack trace on serial, which mean something heavy happens..

Probabaly only way is printfs now. Have a clue where better to start with ?

ptitSeb commented 5 years ago

NIce video, thanks for sharing. Yeah it's smooth, that's nice.

About the crash, unfortunately, I also have a crash at the same point. Issue is about a vtable for some class that is incoherent, but I don't know why it does that yet. I have done some debugging already, and tried some workaround, but I still haven't nailed it. If that gives you a hardcrash, don't bother with that for now, wait until I have found a solution, as it seems the behavior is the same for you and for me. Just to be clear, this is related to the "STATIC_BUILD", it no a BigEndian or GL4ES issue.

ptitSeb commented 5 years ago

The game start for me now. I don't know if it goes far, but at least it start. You can try on you side.

kas1e commented 5 years ago

Tried to compile:

[ 96%] Building CXX object VectorLib/CMakeFiles/VectorLib.dir/GBSFiles.cpp.obj /amiga/friking-shark-master/VectorLib/GBSFiles.cpp: In member function ‘bool CGBSFileType::Load(const char*, CBSPNode, std::vector<CPolygon>)’: /amiga/friking-shark-master/VectorLib/GBSFiles.cpp:101:9: error: expected ‘,’ or ‘;’ before ‘if’ if(bOk) bOk=(freadBE(pPolygon->m_pVertexes[v].c+1,sizeof(double),1,pFile)==1) ^~ make[2]: ** [VectorLib/CMakeFiles/VectorLib.dir/build.make:135: VectorLib/CMakeFiles/VectorLib.dir/GBSFiles.cpp.obj] Error 1 make[1]: [CMakeFiles/Makefile2:920: VectorLib/CMakeFiles/VectorLib.dir/all] Error 2 make: *** [Makefile:150: all] Error 2

ptitSeb commented 5 years ago

Ok, I fixed that hopefully.

kas1e commented 5 years ago

Seems something with github, can see that there was 681 commit , but in the master branch still shown last one a hour ago, probably need to wait a little

kas1e commented 5 years ago

Hm strange, still nothing. Maybe commit was broken somehow ?

ptitSeb commented 5 years ago

There is a timestamp issue (different VM...), and it seems to be from 2 days ago, but the commit is there: https://github.com/ptitSeb/friking-shark/commit/2da55817e9c2883182f487d237f2e38801c5d961

kas1e commented 5 years ago

Ok some good progress ! For first, levels starts, yeah !

But there is 3 issues:

  1. There is no main ship. I mean it didn't show up at all. I can move left/right (so can see how screen moves a bit), so all physics here, but visually nothing drawns. Levels going, all looks fine, just no main ship. There is how it looks like:

level2: http://kas1e.mikendezign.com/aos4/gl4es/games/frikingshark/frik_level2.jpg level3: http://kas1e.mikendezign.com/aos4/gl4es/games/frikingshark/frik_level3.jpg level4: http://kas1e.mikendezign.com/aos4/gl4es/games/frikingshark/frik_level4.jpg level5: http://kas1e.mikendezign.com/aos4/gl4es/games/frikingshark/frik_level5.jpg

  1. Another issue, is with level1. It just half of black. I mean, other levels do not have ship, but at least render whole level, but level 1 just mostly black, take a look how it looks like:

level1: http://kas1e.mikendezign.com/aos4/gl4es/games/frikingshark/frik_level1.jpg

  1. And last issue, I have crash when press "f4" at any level (be it level1 , or any other ones), and stack trace point out on TTF_SizeUTF8() , which come from TTF_RenderUTF8_Solid() which come from TTF_RenderText_Solid() which in turn come from OpenGLFontGetSystemFontForHeight().

Check readme i didn't see any mention of "f4", but in sources it seems like should show some perfomance indicator (fps? ) , and that fail by some reasson.

kas1e commented 5 years ago

And when i press fire (in hope to see bullets at least if not the main ship), i can't see them too. But i can see effect of bombs for sure.

ptitSeb commented 5 years ago

I tried (before your message) on my side and it was ok. So I'm not sure what's wrong. I need to check the type of file loaded, maybe there is some bigendian issue left on some 3D Model file format (both the player's plane and level1). I guess you have no particular error in the log?

About F4, I don't know. I don't remember ever pressing that key in FrikingShark. I'll look.

kas1e commented 5 years ago

I tried without shaders all the time, btw, maybe it make any differences too ? At least, i can see when compare with video from youtube, that without shaders i didn't have shadows, and less details, but that probabaly expected.

I also compare level2 rendering , and how it on youtube: https://www.youtube.com/watch?v=cApljLJ-RJI&index=2&list=PLB2B302FC50C6E410

And can see, that at begining, i also didn't have at bottom right side, 2 planes rendered which part of level. Probabaly its the same issue why there is no main ship and no bullets too.

kas1e commented 5 years ago

Also seems those keys:

H: Activate/Deactivate shaders T: Activate/Deactivate textures L: Activate/Deactivate solid/wireframe I: Activate/Deactivate lighting O: Activate/Deactivate shadows B: Activate/Deactivate blending G: Activate/Deactivate fog

Do nothing for me, at least without shaders, that probabaly expected ?

kas1e commented 5 years ago

Any if i press "fire" all the time, i can see how i hit the enimies, just see no ship and no bullets :)

ptitSeb commented 5 years ago

Yeah, the hotkeys are for shaders IIRC, so I don't expect them to do anything for you now, as shaders are disabled.

kas1e commented 5 years ago

Probabaly they even will not works with shaders too, as seems they for some "scenarioeditor" mode,which runs when do "gameengine scenarieditor" (that one crashes at start, but i think we can skip it for now).

ptitSeb commented 5 years ago

Maybe it would be better to cleanup all the "Models" folder. Something like rm -r Demo/Models followed by git checkout Demo/Models, just in case?

kas1e commented 5 years ago

Yeah, one moment

kas1e commented 5 years ago

Damny damn , it helps ! :) All renders fine in all levels, ship is here, bullets here, etc. Have a look at this:

level1: http://kas1e.mikendezign.com/aos4/gl4es/games/frikingshark/frik_level1_yeah.jpg level5: http://kas1e.mikendezign.com/aos4/gl4es/games/frikingshark/frik_level5_yeah.jpg

But should to say, without shaders it unplayable. Its quite offten just "pause" , like loading something, dunno. Its not like something heavy done, but still everything "pauses" while something happens behind, or like something froze gameplay for a while. Is it the same for you without shaders ?

Crash when press "f4" still here through, there is : http://kas1e.mikendezign.com/aos4/gl4es/games/frikingshark/Crashlog_GameEngine_2018-12-07_23-59-56.txt

(see "Stack trace" section)

ptitSeb commented 5 years ago

Yeah, the "pause" are will a new shader is compiled, and because there is a lots of light (in the fixed pipeline stuff), compile can be feel. But it happens only one time. So when you replay, no more pause. But sure, it will be better with shaders, once the error is fixed in the warp3d.

I'll look at the "F4" error (maybe it's a missing font...).

kas1e commented 5 years ago

Seems those "pauses" happens when at begining of level, you first time kill some new enemy, and then it "pauses", then another new enemy, again pause, and then seems all loads and continue fine.

I assume with or without shaders it will not change much ?

kas1e commented 5 years ago

Ah, same issue as with neverball seems so ? I mean those binary/precompiled shaders need it ?

ptitSeb commented 5 years ago

I assume with or without shaders it will not change much ?

No, when using shaders, you will not have the pause as the shaders are compiled before the start of the level. And yeah, same as with neverball, or everything that use some complex shaders sudenly.

ptitSeb commented 5 years ago

Yep, "Font not found" issue... I'll think of something