Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash due to body material not being available on start #111

Open
Nutomic opened this issue Nov 4, 2019 · 6 comments · Fixed by #112
Open

Crash due to body material not being available on start #111

Nutomic opened this issue Nov 4, 2019 · 6 comments · Fixed by #112

Comments

@Nutomic
Copy link

Nutomic commented Nov 4, 2019

I'm just running into one error after another here. But this seems unrelated to my previous problems, and I didnt find any open issue for it either. This is with Gothic 2, and running on Manjaro Linux, plus latest master (408a0db).

I am getting this error after running ./REGoth ~/workspace/gothic2/ with an empty cache:

[INFO] [GameWorld] Insert Character PC_HERO at STARTPOINT
[FATAL] A fatal error occurred and the program has to terminate!
- Error: InternalErrorException
- Description: Trying to access an object that has been destroyed.
- In function: void bs::GameObjectHandleBase::throwIfDestroyed() const
- In file: workspace/regoth-bs/lib/bsf/Source/Foundation/bsfCore/Scene/BsGameObjectHandle.cpp:32

Stack trace:
0) workspace/regoth-bs/build/bin/../lib/libbsf.so.1: bs::CrashHandler::getStackTrace[abi:cxx11]()+0x1f2 [0x7fa487e9e0e2]
1) workspace/regoth-bs/build/bin/../lib/libbsf.so.1: bs::CrashHandler::logErrorAndStackTrace(std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > const&, unsigned int) const+0x354 [0x7fa487e7d954]
2) workspace/regoth-bs/build/bin/../lib/libbsf.so.1: bs::CrashHandler::reportCrash(std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > const&, unsigned int) const+0x5f [0x7fa487e9daaf]
3) workspace/regoth-bs/build/bin/../lib/libbsf.so.1: bs::GameObjectHandleBase::throwIfDestroyed() const+0xc4 [0x7fa488265234]
4) ./REGoth: REGoth::VisualSkeletalAnimation::material(unsigned int) const+0x18 [0x5624c3979fe8]
5) ./REGoth: REGoth::VisualCharacter::setBodyTexture(bs::TResourceHandle<bs::Texture, false>)+0x39 [0x5624c3969259]
6) ./REGoth: REGoth::VisualCharacter::onInitialized()+0xa1 [0x5624c3969661]
7) workspace/regoth-bs/build/bin/../lib/libbsf.so.1: bs::SceneManager::_notifyComponentCreated(bs::GameObjectHandle<bs::Component> const&, bool)+0x112 [0x7fa488282002]
8) ./REGoth: REGoth::Character::onInitialized()+0x3c8 [0x5624c38ea0f8]
9) /home/felix/workspace/regoth-bs/build/bin/../lib/libbsf.so.1: bs::SceneManager::_notifyComponentCreated(bs::GameObjectHandle<bs::Component> const&, bool)+0x112 [0x7fa488282002]
10) ./REGoth: REGoth::GameWorld::insertCharacter(std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > const&, bs::Transform const&)+0x271 [0x5624c39218f1]
11) ./REGoth: REGoth::GameWorld::insertCharacter(std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > const&)+0x16f [0x5624c39229bf]
12) ./REGoth: REGoth::Gothic2Game::setupScene()+0x918 [0x5624c38d6ca8]
13) ./REGoth: REGoth::runEngine(REGoth::Engine&)+0x3ef [0x5624c38d78df]
14) ./REGoth: main+0x158 [0x5624c389c8b8]
15) /usr/lib/libc.so.6: __libc_start_main+0xf3 [0x7fa487260153]
16) ./REGoth: _start+0x2e [0x5624c38a81fe]
@ataulien
Copy link
Contributor

ataulien commented Nov 4, 2019

Interesting. Looks like the players body material has not been copied. That error is also thrown for handles which did not ever point to a valid object, so most likely Destroyed is not correct here, but that's an other issue! 😄

Can you delete bin/cache/* and try again? Maybe the player model got corrupted because of a crash while caching resources...

I'll take a look at it when I get home!

PS: I would suggest changing the issue title to "Crash due to body material not being available on start" or something...

@Nutomic Nutomic changed the title Trying to access an object that has been destroyed Crash due to body material not being available on start Nov 4, 2019
@Nutomic
Copy link
Author

Nutomic commented Nov 4, 2019

I already retried it with a cleared cache a few times, but the same error always happens. And I updated the title, but you can also do that yourself ;)

@ataulien
Copy link
Contributor

ataulien commented Nov 4, 2019

There are some other executables, such as REGothCharacterMovementTester. Does that work?

@Nutomic
Copy link
Author

Nutomic commented Nov 4, 2019

I tried REGothCharacterMovementTester, it has the exact same error (with cleared cache). REGothWorldCacheTest, REGothWorldMeshViewer and REGothCharacterViewer seem to work (there are no errors).

@KirmesBude
Copy link
Contributor

KirmesBude commented Nov 13, 2019

EDIT: Looking into a little closer. Commit e080948 was a bugfix so it works from cache, but the two lines in VisualCharacters onInitialized are always executed even if the objects are not loaded.

I am running into the same problem.
From my quick research at the point where setBodyTexture is called

void VisualCharacter::onInitialized()
{
VisualSkeletalAnimation::onInitialized();
setBodyTexture(mBodyState.bodyTexture);
setHeadTexture(mBodyState.headTexture);
}

The mSubRenderable has not been initialized yet
void VisualSkeletalAnimation::onInitialized()
{
bs::Component::onInitialized();
if (mSubRenderable)
{
// If this is called after deserialization, we need register the event-callback in here
setupAnimationComponent();
// Also the materials need to be cloned again, as those resources were not saved.
cloneMaterials();
}
}

I dont know enough about the component, but maybe it is enough to call buildObjectSubtree in the onInitialize function.

@ataulien
Copy link
Contributor

When onInitialized is called, the Visual does not even know what it should be drawing if I'm not mistaken. The subtree is only built after a visual has been assigned. We should rather guard the calls which set the textures by whether a head and/or body mesh exists IMHO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants