pickleplayer

SetMultColour() issues in Hamlet only

Recommended Posts

pickleplayer    171

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

Share this post


Link to post
Share on other sites
CarlZalph    3,074
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.

Share this post


Link to post
Share on other sites
pickleplayer    171

 

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

Share this post


Link to post
Share on other sites
bizziboi    1,770
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?

  • Like 1

Share this post


Link to post
Share on other sites
bizziboi    1,770

Can confirm it's engine side, very strange. I'll have to investigate.

  • Thanks 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now