MULTI-THREADING on ROBLOX?!

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ธ.ค. 2024

ความคิดเห็น • 94

  • @Infinitelucidmaze
    @Infinitelucidmaze 9 หลายเดือนก่อน +18

    This taught me more about debugging which is really good to know if you're an advance scripter

  • @synkka1221
    @synkka1221 10 หลายเดือนก่อน +29

    will definitely be using this for my mesh deformation ocean so thanks! I've been trying to optimize it as much as I could for months and knew I should've been using this but it seemed so daunting. It'll be a pain to implement considering all the large module scripts associated with my system but now i have some motivation at least lol

    • @steechy
      @steechy 10 หลายเดือนก่อน

      good luck!!!

    • @lalaly2011
      @lalaly2011 10 หลายเดือนก่อน

      i have done it, its possible gl

    • @justsomeguy8597
      @justsomeguy8597 10 หลายเดือนก่อน

      goodluck man

  • @ipadgeek05
    @ipadgeek05 10 หลายเดือนก่อน +45

    Something I recommend is not multi-threading everything. I spoke to someone and they said don’t multi-thread it can make lower-end devices crash quite often.

    • @BockyDuh
      @BockyDuh 10 หลายเดือนก่อน +6

      thats cause older cpus lack propper mutithreading capability. so it cam cause crashes.

    • @ipadgeek05
      @ipadgeek05 10 หลายเดือนก่อน +6

      @@BockyDuh yeah, lower-end devices as i said. CPU's are interesting though. they execute code differently.

    • @BockyDuh
      @BockyDuh 10 หลายเดือนก่อน +1

      @@ipadgeek05 yeah. Mostly
      its older arcatechture cpus.

    • @alexanderdouble
      @alexanderdouble 6 หลายเดือนก่อน +12

      WE DON'T GIVE A DAMN ABOUT PEASANTS ❌🚫⛔

    • @Te.le.
      @Te.le. 6 หลายเดือนก่อน +4

      No just dont muiltithread in general. Roblox is serialized for stability. If a chunk of data is access twice over from multiple threads of scripts and one decided to modify it. It causes data racing which can take out all the scripts running on the effective data chunk. Its MUCH safer to run on roblox's serial execution. This WILL happen on any device.

  • @uncommonsaucers2355
    @uncommonsaucers2355 10 หลายเดือนก่อน +6

    Thanks a lot! I'm now going to run millions of square root calculations on the local player when they're fighting in PVP to make them break their computer when they lose.
    Seriously though. This was useful.

  • @Krysiuba1
    @Krysiuba1 10 หลายเดือนก่อน +8

    omfg your explanation is so good, i understood everything from this, thank you

  • @Illumina1414
    @Illumina1414 10 หลายเดือนก่อน +9

    This is really perfect for my project. I'm making an RPG with Dark Souls inspired enemy AI who make many different decisions based on many different math calculations. I was worried having possibly hundreds of complex AI might cause performance issues like Deepwoken has, however with this I'll be able to optimise my game efficiently. Really nice video, I have instantly liked and subscribed.

    • @justsomeguy8597
      @justsomeguy8597 10 หลายเดือนก่อน +1

      goodluck with your project!

    • @Tobi-hs9pt
      @Tobi-hs9pt 3 หลายเดือนก่อน

      For me, I thought Deepwoken had amazing performance.

    • @Illumina1414
      @Illumina1414 3 หลายเดือนก่อน

      @@Tobi-hs9pt I think the poor latency issues made the performance seem worse than it is. The devs seem to blame it on the NPCs.

  • @acelaox6836
    @acelaox6836 10 หลายเดือนก่อน +18

    next it's gonna be cuquantum in luau

  • @JoshTheKneeSnatcher
    @JoshTheKneeSnatcher 10 หลายเดือนก่อน +1

    Thank you man, I made collision detection with spherecasting and the somehow my game was lagging. This definitely helps with what I was going for

  • @Sakupenny
    @Sakupenny 17 วันที่ผ่านมา +1

    yet while true do end freezes u

  • @Czectly
    @Czectly 10 หลายเดือนก่อน +2

    Thank you i was really curious about this and i think it's a very interesting concept within lua their is actually alot more then i thought to it

  • @ItsSpaceManPlays
    @ItsSpaceManPlays 6 หลายเดือนก่อน +1

    This is an absolutely great video you explained it so well i bet even a new scripter could understand it

  • @fabiandidiercobobitriago
    @fabiandidiercobobitriago 9 หลายเดือนก่อน +1

    Excellent video, thank you! I've only seen 2 of your videos and I bought your Udemy course, I'm sure it's worth it.

    • @crusherfire1
      @crusherfire1  9 หลายเดือนก่อน +1

      Thanks for your support!

  • @MiniSodaDev
    @MiniSodaDev 10 หลายเดือนก่อน +1

    This is going to help so much, thank you.

  • @ЮраСуворов-у8ф
    @ЮраСуворов-у8ф 10 หลายเดือนก่อน +1

    Thank you for this tutorial im can optimize my game! 👍

  • @nin9578
    @nin9578 10 หลายเดือนก่อน +1

    You should make a video on editable meshes and images

  • @NykoZeraora
    @NykoZeraora 10 หลายเดือนก่อน +1

    And I still get ~20fps average while before I had 60. damn you developers!!

  • @SlightlySchizophrenic
    @SlightlySchizophrenic 9 หลายเดือนก่อน

    No way this bro made a deer tornado while tryna explain parallel executing and task desynchronization

  • @mewristem
    @mewristem 10 หลายเดือนก่อน +1

    Very helpful and perfect tysm!

  • @MarkoBrainz
    @MarkoBrainz 7 หลายเดือนก่อน +1

    Quick question! At 11:25 you made 3 connections and created a profile for each process, in order it has the numbers "1", "2" and "3". But in the profiler it says "3", "2", "1". So it's in order.. but reversed. I don't quite understand why though?

    • @crusherfire1
      @crusherfire1  7 หลายเดือนก่อน +1

      Good eye! While I'm not exactly sure the reasoning behind why this happens, this same pattern exists with regular connections as well. It must be some kind of internal thing relating to task scheduling.

    • @mahmoudayman6423
      @mahmoudayman6423 หลายเดือนก่อน +1

      ​​@@crusherfire1It might have to do with the deferring of the connections. They follow a rule where it is.. "first in, last out", so the last connection (heartbeat 3) is executed first
      Edit: That means, the first connection will be executed last, while the latest connections will be executed first
      I guess this is the case with deferring functions

  • @honkhonk8009
    @honkhonk8009 7 หลายเดือนก่อน

    Making a Helldivers type game for fun.
    I was thinking of using this to manage the NPC's but so far the tasks getting desynched is too much a pain to deal with lmfao.

  • @skyblox-eo5se
    @skyblox-eo5se หลายเดือนก่อน

    hi . If i use a modular approach in scripting where there is only one local/script ad many modules , how do i use parallel luau?

  • @Sanchayan_Mallick
    @Sanchayan_Mallick 8 หลายเดือนก่อน +1

    What font did you use in the video? I want to use it for studio.

    • @crusherfire1
      @crusherfire1  8 หลายเดือนก่อน

      JetBrains Mono!

    • @Sanchayan_Mallick
      @Sanchayan_Mallick 8 หลายเดือนก่อน

      @@crusherfire1 How do i get that in studio?

  • @YellowPeace
    @YellowPeace 4 หลายเดือนก่อน

    If I had a class with some method like;
    local Entity = {}
    --more class stuff
    Entity:Pathfind()
    How Would I use multithreading, since even if I have 100 entities, they all use the same pathfind function???
    If anybody could help me with this, it would be greatly appreciated!

  • @justsomeguy8597
    @justsomeguy8597 10 หลายเดือนก่อน

    thank you

  • @kokobroxd
    @kokobroxd 7 หลายเดือนก่อน

    the graph doesnt show up for me

  • @edgyman519
    @edgyman519 6 หลายเดือนก่อน

    AWESOME dude

  • @CurINC
    @CurINC 3 หลายเดือนก่อน

    nice video! (i have not watched yet)

  • @Kitsune_Dev
    @Kitsune_Dev 10 หลายเดือนก่อน

    What about Serial killers and Parallel killers?

    • @thisisaperson1536
      @thisisaperson1536 10 หลายเดือนก่อน +1

      uhhh
      serial killers kill one by one and parallel killers kill many at once or something
      parallel killers are scarier man, remember to pray

  • @Fellthrogures
    @Fellthrogures หลายเดือนก่อน

    The one thing TSB doesnt have

  • @chan3_.
    @chan3_. 10 หลายเดือนก่อน

    guy went from being russian to a coder 💀

  • @cracktusdev
    @cracktusdev 10 หลายเดือนก่อน

    NICE VIDEO MAN!!!!!!!!!!!!!!!!!!!!!!!!!!

  • @macjoeplays
    @macjoeplays 10 หลายเดือนก่อน

    😌 Amazing video. Why not Roblox Engine set their defaults from Serial to Parallel so there is no need to make some extras for parallel computing. Like just calling some function then wallah, the scripts are now set to parallel or Roblox Engine can automatically assign task computations for each available worker of the CPU 🤔then Player and Game Dev will surprise that the game is now optimize by 1million times

    • @lordnazzer
      @lordnazzer 8 หลายเดือนก่อน

      It will crash low end devices if things are parallel by default.

  • @osanixian1499
    @osanixian1499 10 หลายเดือนก่อน

    This is a great tutorial, I just have one question. It seems that parallel luau can only parallelize scripts, not any function in that script. This is a problem as I have a script that (hilariously) does need to iterate over a table 1 million times. Due to my array being separated into chunks, I would love to use parallel lua to run all the chunks in parallel, hopefully increasing performance. But it seems this is not possible as this only takes place inside one script. Also what happens if you try to run in parallel more scripts than there are workers?

    • @crusherfire1
      @crusherfire1  10 หลายเดือนก่อน

      Yes, you would have to figure out a way to separate your code into multiple scripts, as you need multiple actors to split into separate threads.
      In the case you have more actors than threads, the workload is distributed across all threads (like the deer in the video). Roblox recommends splitting long computations into separate scripts, as the granularity allows for more even distribution of tasks among threads.

    • @osanixian1499
      @osanixian1499 10 หลายเดือนก่อน

      ​@@crusherfire1 Is it possible to process in parallel using remote functions? Using remote functions would simplify spreading the data around and ease collection of it, though invoking a new actor might be a struggle.

    • @crusherfire1
      @crusherfire1  10 หลายเดือนก่อน

      @@osanixian1499
      The properties for remote functions and bindable functions aren't labeled with a safety label, so I'm gonna say no?
      Of course, you can easily just set up a test and see if you're able to use to it in parallel. If it errors, then you've got your answer.
      I'm not sure why you would need to use a remote function/bindable function? If you need to share data between actors, use a bindable event, you can use the Actor messaging system, and there is even a data type called SharedTable that was made specifically for use in Parallel Luau, and you can store them in a shared registry.
      create.roblox.com/docs/reference/engine/datatypes/SharedTable

  • @stavros222
    @stavros222 10 หลายเดือนก่อน

    "Luau" ok. Lets not talk about who thought of this name

  • @decat4
    @decat4 10 หลายเดือนก่อน +1

    (what i said is wrong read replies if anyone else comes by this)
    one thing you shouldve mentioned is task.spawn, this does one thing similar to actors and runs the code in parallel, so you don't need to make a script in a separate actor for everything, you can just use task.spawn to run multiple npcs in paralell for example.
    thanks so much for this video though, this will help a lot, a question though, are there limits to what can be given a profile label? for example i tried to label a while loop inside of a function but i've yet to see it anywhere despite it triggerring most of the functions of my NPCs

    • @crusherfire1
      @crusherfire1  10 หลายเดือนก่อน +3

      I'm sorry, but that is incorrect. The task library, like task.defer() and task.spawn() execute functions in a new coroutine thread, not a processor thread. I mentioned that coroutine threads are not the same as processor threads.
      Coroutines still execute in serial, except, they can have their flow manipulated using yield functions like coroutine.yield(). Only 1 coroutine executes at a time. So, no, task.spawn() does not run code in parallel.

    • @decat4
      @decat4 10 หลายเดือนก่อน

      @@crusherfire1 dang i misread the profiler then, so is it possibile to run multiple loops within the same code in paralell or is that done with task.desynchronize?

    • @crusherfire1
      @crusherfire1  10 หลายเดือนก่อน +2

      @@decat4 In order for code to be executed in a separate thread, the script where the code is executing has to be within an actor.
      If you have two while loops in the same script and both running in parallel, they will still be executing one after the other because they are inside of the same script in the same actor (executing on the same thread). However, those two while loops will also be separate from the current thread executing in a different thread.
      If those while loops are split into two separate scripts under two separate actors, then the two while loops will be executing in separate threads at the same time.
      Making a script a child of an actor doesn't make the code automatically run in parallel. You must define where using task.desynchronize() to run in parallel and using task.synchronize() to run in serial.
      Or you can also use :ConnectParallel() on events which automatically runs the connected callback in parallel without needing to call task.desynchronize()

    • @decat4
      @decat4 10 หลายเดือนก่อน

      @@crusherfire1 huge thank you for the explanation,

  • @SudoSed
    @SudoSed 10 หลายเดือนก่อน

    Hello, I am taking the course called Roblox studio on the Udemy platform. However, the course currently does not have a Turkish subtitle option. I have a request to add Turkish subtitles. Help me in this matter.

    • @crusherfire1
      @crusherfire1  10 หลายเดือนก่อน +1

      Udemy only offers a couple automatic subtitles, so I have to manually translate and add subtitles to Turkish which may take me a bit of time.
      I'll try to add them ASAP

    • @SudoSed
      @SudoSed 10 หลายเดือนก่อน

      @@crusherfire1 Thank you very much! I wish you good work!

  • @VangelTheDarkSide
    @VangelTheDarkSide หลายเดือนก่อน

    25:11

  • @j_ray01
    @j_ray01 9 หลายเดือนก่อน

    youre so cool

    • @crusherfire1
      @crusherfire1  8 หลายเดือนก่อน

      youre so cool

  • @elainecristina6215
    @elainecristina6215 10 หลายเดือนก่อน

    multi

  • @ExoticFoxy
    @ExoticFoxy 10 หลายเดือนก่อน

    Parrarel me amu???

  • @letter-a
    @letter-a 10 หลายเดือนก่อน

    a

  • @ultimate_masterpiece
    @ultimate_masterpiece 10 หลายเดือนก่อน +1

    ViewportFrame tutorial or else...

    • @crusherfire1
      @crusherfire1  10 หลายเดือนก่อน

      or else what 🤔

    • @thisisaperson1536
      @thisisaperson1536 10 หลายเดือนก่อน

      set viewportframe's current camera property to a camera (any camera)
      it will now render parts and models *parented to the viewportframe*, if ViewportFrame.CurrentCamera can see it.
      it won't look high quality but there's no good way to fix that so lol

    • @ultimate_masterpiece
      @ultimate_masterpiece 10 หลายเดือนก่อน

      buddy im pretty sure most people know that but its the camera positioning that gets most people@@thisisaperson1536

  • @SPDM_Riky47
    @SPDM_Riky47 9 หลายเดือนก่อน

    So, how do i achive something like task.spawn that uses actual different threads

  • @idoscripts
    @idoscripts 10 หลายเดือนก่อน

    do u have a discord?

    • @crusherfire1
      @crusherfire1  10 หลายเดือนก่อน +1

      I do, but it's not public

    • @idoscripts
      @idoscripts 10 หลายเดือนก่อน

      @@crusherfire1Are you talking about discord server or personal account

    • @crusherfire1
      @crusherfire1  10 หลายเดือนก่อน +1

      ​@@idoscripts I have a server, but it's private (reserved for my students).

    • @idoscripts
      @idoscripts 10 หลายเดือนก่อน

      @@crusherfire1 How do I become a student?

    • @idoscripts
      @idoscripts 10 หลายเดือนก่อน

      Never mind, figured it out. Is there any chance I could get a fan discount?

  • @tal5667
    @tal5667 9 หลายเดือนก่อน

    I did
    ```for i = 1, math.huge do
    --blah blah the coede math.sqeurit
    end```
    it's vame crs game crashed

    • @tal5667
      @tal5667 9 หลายเดือนก่อน

      nvm it loaded