Future and ShadowMap technologies breaks game

Hello, today, when I was working on the UI for my game, I decided to test the game outside of studio to check if the UI looks good in a real game, and there was a problem with lightning.

For some reason, when Future or ShadowMap lightning technologies are enabled, when testing in a real game, lightning seems to be broken and unexpectedly affects my game. I have no idea why this is happening, but the shadows are blinking and the enemies models are just disappearing or enemies stop walking which is really strange, because there are no such issues while testing game in studio.

Here are videos with bugs, so you clearly can understand what is going wrong:
In studio: https://youtu.be/yY2P1wqhaf4
In game: https://youtu.be/HKq4Gk6g40w
Disappearing enemies: https://youtu.be/eMKssehyuX8

Also I’ve noticed really strange behaviour of this bug while testing game:

As you can see, issue fixes after around a minute of waiting and then when I use commands it happens again. It’s not game bug I guess because commands doesn’t break game in studio and bug is happening not only when using commands but also when joining the game.

Also I joined my game with 2 different players and they didn’t have this problem. Enemies were walking fine and lightning didn’t blink. I reinstalled my drivers, rebooted pc and it didn’t help, problem still persists. I’m not sure at what moment it appeared, maybe after some update or fix on the roblox engine side.

Here are components of my PC:
CPU: AMD Ryzen 7 5700X 8-Core Processor 3.40 GHz
GPU: GIGABYTE GeForce RTX 3060 Ti GAMING D6X OC
RAM: 64,0 GB ADATA XPG SPECTRIX D45G RGB
Disks: Samsung SSD 870 QVO 2TB; StoreJet SCSI Disk Device 1TB; WDC WD20EZAZ-00L9GB0 2 TB;
Motherboard: GIGABYTE B550 AORUS ELITE AX V2
System: Windows 11 Pro; Version 23H2; Build 22631.3958

Additional information:
Place Id: 13976791222 (Defite Developer Build - Roblox)
Universe Id: 4838507449 (Game link: Defite Developer Build - Roblox)
Owner Group Id: 32679907 (Tornadium Interactive - Roblox)

Also I’m not sure if it can help you, but function which handles enemies movement calculations and models positioning is connected to the RunService.Heartbeat event.

EDIT: Deleting and reinstalling Roblox & RobloxStudio didn’t help

Expected behavior

Lightning shouldn’t blink and enemies shouldn’t disappear as shown in the video with studio test.

A private message is associated with this bug report

1 Like

Thanks for the report! I filed a ticket in our internal database and we’ll follow up when we have an update for you.

Hello! Thank you for your response and help!

I have been investigating this bug for a week and finally found and fixed the issue (at least, this hasn’t happened to me and other players since yesterday). At some point it’s my bad because there was division by 0, but I found 2 strange things while finding solution of this problem. Let me explain more.

So enemies in my game were disappearing when walking on the line or while rotating between lines. In the first case, it probably was my mistake because I was finding angle between 2 vectors and then divide another value by this result. So once angle was 0 or at least that small that it rounded to 0, there was something like value / 0 which lead to getting NaN value and breaking system.

But the second case is actually more interesting and more related to Roblox side I believe.
At some moment DeltaTime value when playing at 240 FPS becomes that small that .Heartbeat event automatically gives just 0 instead of that really really small value. So since my system actually uses DeltaTime to calculate where enemies are currently located it calculated absolutely the same rotation position as the current enemy position. And then it tried to find rotation between this vectors, using CFrame.lookAt(currentPosition, newPosition).Rotation, but the problem is that if both vector3 arguments are the same, then it will give really unexpected and broken CFrame (if you print it, it would like this): x, y, z, NAN, NAN, NAN, NAN, NAN, NAN, NAN, NAN, NaN, so if you try to use this code:

local CurrentPosition = Vector3.new(5, 1, 4) 
local EnemyPosition = Vector3.new(5, 1, 4) 
local ActualCFrame = CFrame.lookAt(CurrentPosition, EnemyPosition) 
print(ActualCFrame)

Here’s what actually will be printed:

In my mind it’s absolutely unexpected and broken as I said before. I’m not sure what values instead of NANs it should return, 0 or any other values, but this problem may confuse some developers because there are no information of such issue or possible result in the official documentation. This is first strange thing which I wanted to mention.

And the second strange thing is actually related to Lightning. I believe that reason of these blinking shadows was actually setting new CFrame which has NaN values to the PrimaryPart of the model. Here’s the empty place which has setup for next explanation of this bug:
LightningBugPlace.rbxl (54,6 КБ)

In this place I created a script in the ServerScriptService which has the same code as I provided earlier for generating CFrame value with 9 rotation NANs values, with the only exception that now it sets workspace.Hamburger.PrimaryPart.CFrame to this broken CFrame. And if you click play you can see that on the server side position of the origin of the model looks like that:

Client doesn’t even render this model’s part, since workspace.StreamingTargetRadius is much less, than Y position value of the model PrimaryPart. Probably this is what was happening in the my game. Models were not disappering, they were just moving to the unbelievable Y axis value. I believe that’s the reason of breaking shadows, but unfortunatly, my attempts to repeat this bug in the empty place were not successful, maybe there was some code in my game that “helped” this issue to persist.

I hope I didn’t forget to mention anything and information I provided is actually helpful and related to the wrong behaviour of CFrame.lookAt API and Future, ShadowMap lightning technologies. I’m sorry if it’s actually supposed to work like that and my topic is a little waste of Roblox Staff’s time. Also in the original post I said that this bug has only happened to me, but not to other players. Well, probably this is a completely rng issue, which may happen or may not happen (probably depending on your FPS limit value), since on the next day my Animator also met this problem. The assumption that this is completely rng issue, is also confirmed by the fact that I’ve had to reconnect to the game for about 2-8 times again and again to meet this bug at the start of testing and not wasting my time by trying to accidently meet it while playing game for 30 minutes to investigate it more further. However, I have no idea why this issue almost never persist in studio for me, but persisted in the actual game and my animator met this problem actually in both, the studio and the game, it’s very unclear. If you have more questions about these issues, feel free to ask me to check something in my game, or explain how something works (to help you with fixing these issues), I will do my best to help you!

2 Likes

Bumping this topic to make sure that Roblox Staff saw my reply with ton of information

1 Like