OpenTechEngine / OpenTechBFG

Engine based on (RB) Doom 3 BFG aiming to allow the creation of standalone games
Other
84 stars 11 forks source link

engine segfaults when loading any light if no default light is present in the map #73

Open BielBdeLuna opened 8 years ago

BielBdeLuna commented 8 years ago

I got this:

********************
ERROR: Attempted to load material decl 'lights/defaultpointlight' from game thread!
********************
signal caught: Segmentation fault
si_code 1

when loading a weapon with a light (like d3 machine-gun ) or when I shoot with the gun (the muzzleflash light) or when a monster shot back.

it was solved by adding a normal light somewhere in the map. Should we solve this? it's an unlikely scenario but at the same time before finding that solution I couldn't understand what was happening as it makes no sense, also I couldn't find the error message in the code.

also, in Dhewm3 it didn't fail, so it's something about idTechX.

DanielGibson commented 8 years ago

On 08/13/2015 09:39 PM, Biel Bestué de Luna wrote:

I got this:

|**** ERROR: Attempted to load material decl 'lights/defaultpointlight' from game thread!


signal caught: Segmentation fault si_code 1 | I couldn't understand what was happening as it makes no sense, also I couldn't find the error message in the code.

$ ag "from game thread!" neo/framework/DeclManager.cpp 1319: idLib::Error( "Attempted to load %s decl '%s' from game thread!", GetDeclNameFromType( type ), name );

I think idLib::Error() shouldn't segfault though, but just do exit(1) or something similar.

BielBdeLuna commented 8 years ago

@DanielGibson what is "ag" ?

I see that in Dhewm3 there is no 'idLib::Error( "Attempted to' in that file so I guess this is added code for idTechX

ghost commented 8 years ago

I also had a issue with lights in an older build of OTE where the dmap couldn't finish, had to delete all lights and redo them. The problem went away after a newer build.

BielBdeLuna commented 8 years ago

no, but this is another problems, dmap could finish perfectly

DanielGibson commented 8 years ago

ag is similar to grep. See http://geoff.greer.fm/ag/ (In this case grep would have found the exact same thing. Didn't look in dhewm3, but why would I grep dhewm3 for D3BFG errors?)

BielBdeLuna commented 8 years ago

to see if this code was introduced in idTechX or was already there

DanielGibson commented 8 years ago

let's just look at the code:

    // if it hasn't been parsed yet, parse it now
    if( decl->declState == DS_UNPARSED )
    {
        if( !idLib::IsMainThread() )
        {
            // we can't load images from a background thread on OpenGL,
            // the renderer on the main thread should parse it if needed
            idLib::Error( "Attempted to load %s decl '%s' from game thread!", GetDeclNameFromType( type ), name );
        }
        decl->ParseLocal();
    }

What does it mean? That you're trying to use some decl that hasn't been parsed yet (presumably since starting the current level).

Why does it not happen in dhewm3? It doesn't happen in old doom3, because it's not multi-threaded (so this check was not necessary there).

What does this mean for us? I think it means that all needed assets must be loaded when the level is loaded.

Does it only happen if you spawn weapons/monsters via console or also if they're already in the level? I haven't looked up how d3bfg makes sure to load everything it needs when starting a level, but I'd hope that it at least loads everything that's in a level and your inventory.

BielBdeLuna commented 8 years ago

another thing, the flashlight works and doesn't segfault the engine, now the flashlight notoriously uses a light, is this light created somewhat differently than the other weapons muzzle flash light?

it happens once I select a weapon which has a light on ( like the machine-gun GUI light, or the plasma-gun blue fire light ) or once I shoot the pistol ( because it uses it's muzzle-flash light )

or it also happens when the monster fire their weapon again the same muzzle flash light related stuff. why the flashlight doesn't segfault the engine when all other light effects do?

I've tried deleting the default light from that level, and the problem returns, and then adding the default light back it returns.

the level already has an ambient light which isn't the default one, and this light doesn't seem to affect this problem. maybe the flashlight being a directional light instead of a point light, and also having it's own different shader doesn't trigger this error?

BielBdeLuna commented 8 years ago

the same happened when loading a fx for the first time

*******************
ERROR: Attempted to load fx decl 'fx/chunk' from game thread!
********************