Really loving this feature, it’s allowed me to do real-time map generation that I could have only dreamed of previously. Currently able to render a map the size of South Carolina!
Any update as to what month actors might get BasePart property access? I’ve got it all organized into chunks so that second actors can make updates to parts under them I’ll be able to get even better performance, hopefully giving me the bandwidth to provide more close-up details.
I’ve been having this issue recently and it’s been really annoying, I found a work around for it though.
Call task.synchronize right before running anything else in the event.
-- Main thread:
bindable.Event:Connect(function()
task.synchronize() -- Workaround for this
workspace.Baseplate:Destroy() -- Will throw error: "Function Instance.Destroy is not safe to call in parallel"
end)
-- From actor:
task.desynchronize()
bindable:Fire()
According to fflag changes, this feature went live today.
I’m not sure if this is a problem of not all changes rolling out to clients yet, but trying to play my testing game with the client causes an immediate crash. Just want to report this here to be safe before it goes live.
Has anyone else started noticing mysterious errors like this popping up from scripts that are not under Actors, are not desynchronizing, and are not and have never used parallel API whatsoever? Probably related to the flag getting flipped today.
These errors are one-offs and seem rare, happening totally at random. I only found these two today.
This code is initialized from a server script that requires a hierarchy of server modules. This function is run on PlayerAdded, and the code that’s erroring runs after some HTTP calls and some datastore calls. The datastore module is third party (DataSync by Mullets) so I don’t know exactly what it’s doing.
SetupServer requires SetupPlayerJoin which connects to PlayerAdded which fires onPlayerAdded, etc.
This code has not been updated for a while. There is no parallel Lua whatsoever.
I’ve had this issue for like 2 or more months at this point.
One thing, I had an issue not even using RBXScriptSignals, just using task.spawn, the one thing in common here is that we were doing HTTP requests, in this case I was doing DataStore requests, might be a coincidence or not, but it’s good to note for anyone fixing this, so
Sorry for bumping this up (I don’t think it bumps but anyways), is there are an estimated day for when this feature will be totally released (I don’t even know if is released)? I need to use it for my game. By the way when I was testing with it, I wonder why if you execute some expensive code in performance freezes the main lua thread?! I ran a while loop without wait in parallel and it froze all. I also had another loop before I executed the parallel code with a wait and it was printing all it could.
task.wait(10)
local Value = 0
task.spawn(function()
while true do
task.wait()
Value += 1
print(Value)
end
end)
task.wait(1)
task.spawn(function()
task.desynchronize()
while true do
end
end)
I expected the coroutine on the top to continue running on the back even if the thread froze all but this didn’t happened. It printed around 57 and stopped. Since is waiting for the other loop to finish. Anyways once it timed out the loop continued printing and it started from 58. I thought it would be in like 300 already but nope. Is this really parallel and if so, is this the behavior?
Parallel Lua doesn’t run in parallel with the entire engine, but only with other Lua threads. If one of your threads takes too long to finish executing it’ll probably drag out all the other ones that already finished.
Would you mind sharing the source code/place for this? I would love to see a proper example of parallel luau being used as I’m sure many of us are curious.
Ok, maybe it isn’t because of that. But its kinda like this:
--here is a remote event for firing protectiles because its a shooting game (and it causes extreme lag)
coroutine.resume(coroutine.create(function()
while task.wait() do
for i, v in pairs(game.Players:GetPlayers()) do
--a bunch of stuff like reloads and stuff
end
end
end))
while task.wait(1) do
for i, v in pairs(game.Players:GetPlayers()) do
--a bunch of stuff like unlocks, upgrades, stuff
end
end
end
it’s all in one script pls help should i separate them?
Hi. Thank you for responding, but someone introduced my to Script Performance windows and it helped A LOT. I found it’s actually from the client and sometimes it take up up to 20%! I think it’s because of a very complex function which has lots of other smaller functions in it with lots of for loops. Thanks for replying!
Hey, it seems like the beta is completely broken (unless behavior changed?). Running @Elttob’s raytracing demo crashes for me: RaytraceWithLibraryDemo.rbxl (27.6 KB)