Jump to content

SetMultColour() issues in Hamlet only


pickleplayer

Recommended Posts

Someone recently informed me my first-person mod was broken for Hamlet, and I've been fixing it up but there is one bug that I cannot figure out.

The component that controls darkness shading and distance transparency is crashing the game in first-person view, but only for Hamlet. There is no crash screen, it simply closes the game. No crash related messages show up in the error log at all. 

I've been tossing print messages into the code like landmines try and find where exactly it stops showing the messages, but... It just kinda doesn't stop. Like it runs the component for a full tick and displays every print message, and THEN crashes.

BUT I've discovered that removing the line of code that actually changes the color;   inst.AnimState:SetMultColour(r, g, b, a)  fixes the crashing. Changing the r,g,b,a values to a static SetMultColour(1,1,1, 1) also fixes the crashing. But changing it to SetMultColour(1,1,1, a)  or   SetMultColour(1,1,1, 0.1)  crashes the game, Meaning that something specific being set to an alpha of 0.1 is causing the crash.

I'm not sure what this could be from, since this mod still runs fine on every other version of the game (vanilla, RoG, Shipwrecked, and DST)

 

For reference: the shading component works by running a formula to determine shading color on all entities within 65 unit radius and calculating the color and alpha values for all of those. It looks a little something like this (but much bigger an messier)

local ents = TheSim:FindEntities(x,y,z, 65, {}, {"INLIMBO", "NOCLICK", "skybox"})

for k, v in pairs(ents) do	
	if v.AnimState or v.Light then
    			--(a bunch of complex calculating for color as R,G,B)
    			--(a bunch of complex calculating for opacity as A)
    			v.AnimState:SetMultColour(R,G,B,A)
    	end
end

 

I'm not very familiar with Hamlet or the recent updates, but does anyone have any clue as to what might have been added to the game that would cause a crash like this? Any weird glowing creatures or strange opaque particle effects? This seems to be the only version that recently had any issues with entities being at an alpha less than 1.0

Link to comment
Share on other sites

1 hour ago, pickleplayer said:

inst.AnimState:SetMultColour(r, g, b, a)  fixes the crashing. Changing the r,g,b,a values to a static SetMultColour(1,1,1, 1) also fixes the crashing. But changing it to SetMultColour(1,1,1, a)  or   SetMultColour(1,1,1, 0.1)  crashes the game, Meaning that something specific being set to an alpha of 0.1 is causing the crash.

This seems to imply that the shader used in Hamlet differs from the non-Hamlet versions.

When something goes wrong on the shader level the engine itself explodes as, as far as I know, when this happens the graphical context gets deleted- it's a runtime error on the GPU.

 

The only things that I can think of that have special handling are the vines, light rays, and the black overgrowth spots in the jungle.

Try setting in your options for the game to turn them off and see if your mod still explodes.

If this doesn't help it, then I'm not sure- it's something with a shader somewhere not compliant with the rest of the game's assets.

Link to comment
Share on other sites

 

On 9/29/2019 at 5:56 PM, CarlZalph said:

The only things that I can think of that have special handling are the vines, light rays, and the black overgrowth spots in the jungle.

Try setting in your options for the game to turn them off and see if your mod still explodes.

Oh my god you can turn those off??? First of all, that just fixed one of the most annoying graphical glitches that I thought previously to be unfixable, so thank you for that.

It didn't fix the crashing though

 

Whew this has been a tough one. For a while I was tricked into thinking I was onto something, only to find out a few other parts of my mod were broken and that it only stopped crashing because my shader disables itself upon leaving buildings.

It's weird that taking the radius down from 65 to 40 fixes this issue, but leaves you with a very short field of vision. And at 45, the game will actually continue to run for a few seconds before crashing. But I'll occasionally find random "safe spots", like large sections of jungle that I can wander around in without crashing until I stray too far in a specific direction.

And I can teleport out of bounds into the middle of the ocean and look around just fine. But as soon as I get close to land and start seeing bits of grass and trees; poof! crash.

 

It's really hard to tell if it's an issue with my mod's code or the game's shading engine.

I guess I could just disable my shader while in hamlet worlds. I used to play with it disabled anyways because it lagged pretty hard in Hamlet. But whatever got recently updated made the framerate issues much better

Link to comment
Share on other sites

  • Developer
On 9/29/2019 at 2:56 PM, CarlZalph said:

This seems to imply that the shader used in Hamlet differs from the non-Hamlet versions.

It does not.

@pickleplayer I don't have the time, but Wagstaff infroggles set the multcolour on pretty much every entity in range, could you try setting that alpha to a non 1.0 value and let me know if that crashes?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...