Multi Thread, Parallel Scripts, MicroProfiler - Roblox Scripting Tutorial

Поделиться
HTML-код
  • Опубликовано: 16 янв 2025

Комментарии • 77

  • @CSHorseBobJoe
    @CSHorseBobJoe Год назад +56

    This channel is insanely valuable, the amount of coverage on different important topics here outranks any other channel I've seen, I have no idea why it's not popular

    • @purplebeaste7718
      @purplebeaste7718 6 месяцев назад +3

      Probably because it covers more advanced subjects, meaning that only advanced scripters would want to watch this. New scripters are abundant but won't care to watch this.

  • @KebeMaro
    @KebeMaro 2 года назад +26

    Wow , I really was looking to try and understand parallel scripting a few days ago , can't believe you actually released a video on it today.
    I'm so glad you did , keep up the unique and amazing videos!

  • @wrello
    @wrello Год назад +5

    Thanks!

    • @5uphi
      @5uphi  Год назад +2

      Your very welcome and thank you for the support :)

  • @judlex7300
    @judlex7300 Год назад +2

    Love your keyboard sounds 🥰🥰

    • @5uphi
      @5uphi  Год назад +2

      Me too I have Outemu brown switches on the Magicforce keyboard and I'm very happy with them

  • @calamitydoggo6973
    @calamitydoggo6973 2 года назад +3

    great tutorial, learned a lot about the micro profiler

  • @CodeProto
    @CodeProto 7 месяцев назад

    That last part explains a TON, I've been having weird bugs and this explains it.

  • @com2480
    @com2480 Месяц назад

    great video!

  • @hlflifeenjoyer6176
    @hlflifeenjoyer6176 9 месяцев назад

    Amazing video really helped me with multi threading and usage of actors

  • @rodeveloperro
    @rodeveloperro 11 месяцев назад

    Great tutorial! Really loved how you used the micro profiler to demonstrate how the work gets executed. Would be cool if you cover the cross thread communication, but I can do that on my own to hahhaa.

  • @hoanghanguyen1410
    @hoanghanguyen1410 2 года назад

    Amazing, I don't understand MicroProfiler Debug much until your video. I already donated to you :D Thanks mate

    • @5uphi
      @5uphi  2 года назад

      I'm happy my video helped you learn something and thanks for the donation

  • @guy3565
    @guy3565 2 года назад

    You are doing Gods work my friend.

  • @andrei_cn8246
    @andrei_cn8246 2 года назад +11

    video idea : caves in noise generation

  • @insurrxct
    @insurrxct 2 года назад +1

    I have no idea what this video is trying to teach but i liked the explanation, nice vid!

    • @5uphi
      @5uphi  2 года назад

      This video is the first steps to understanding parallel scripting :P ill have more demonstrations in future videos

  • @goreacraft
    @goreacraft 2 года назад +16

    Amazing video, thank you. Can you please make some more tutorials about this topic with more details and examples?
    - for example how to implement this actors properly with module scripts as i almost never use localscripts
    - or a few examples on how can one troubleshoot issues and implement multithreading in existing code

  • @root6132
    @root6132 2 года назад +11

    Would absolutely love it if you could show us some use cases for this as I really don’t see much difference between using this and using something like coroutines.

    • @5uphi
      @5uphi  2 года назад +7

      I hope to incorporate it into my newer scripts if you use coroutines they will not be on separate threads they will run one after the other the same way task.defer and task.spawn works this is the first time we have been able to do true multi thread in Roblox

    • @monoqqr
      @monoqqr 2 года назад +1

      This is used for multi-threading, which will lead to optimization, threads on serialized luau run on one and only core and when threads run on parallel it will create a new core to run in from my perspective

    • @DriftHyena
      @DriftHyena 2 года назад

      It's good for if you have a mass amount of NPCs that need updating, or in some other cases I've seen pop up recently, as a sort of hacked together CPU raytraced global illumination system. The key here is to break down operations in read only and write only chunks, and move the read only chunks to threads, synchronize them, and then perform all of your writes.

    • @dimitar.bogdanov
      @dimitar.bogdanov 2 года назад +1

      @@monoqqr It cannot run on a 'new' core, as the amount of cores is how many cores your CPU has. That's usually a pretty small amount, e.g. 4, 6, or 8. The game will try to balance your actors between your cores, so if you have 2 cores and 6 actors, presumably it'd run 3 actors on one core and the rest on the other core. This is slightly oversimplified, though.

  • @lyptical7868
    @lyptical7868 2 года назад

    Incredible video

  • @gabrioche6757
    @gabrioche6757 Год назад

    Thanks, very interesting

  • @exhydraboy2429
    @exhydraboy2429 8 месяцев назад +2

    the ONLY criticism I have for this video is please....use either a mic compressor, or noise reduction using Adobe's free tool or something in your editing suite.... you could also use NVidia broadcast as a microphone input, or something similar to that to fix the background audio 🤗

    • @5uphi
      @5uphi  8 месяцев назад

      My newer videos have a new mic that's a lot better

  • @getmanovich377
    @getmanovich377 Год назад

    Parallel Luau looks unpredictable

  • @rodeveloperro
    @rodeveloperro 11 месяцев назад

    14:00 Something strange happens for me, for both scripts the connections inside gets executed, but they all fall under localscript1.

  • @-T0Ast200-
    @-T0Ast200- 2 года назад +1

    Awesome video! I had no idea this was even a thing until now, but I have a great video idea; a plane you can fly in, or maybe a car that drives to a position that you want? I don’t know but those are some cool ones that I think you should try

  • @the_pr0fessorRBXL
    @the_pr0fessorRBXL 2 года назад

    🙌

  • @robocu4
    @robocu4 2 года назад +3

    So, I understand that this has no usage benefit when you consider spreading a large calculation across multiple actors/threads seeing as the parallel threads usually can't influence one another in anyway. Would you happen to know if this would allow threads to continue executing even when a large calculation has halted server-side runtime? I'm trying to get my day loop to continue operating as expected while the server stutters to procedurally process islands, and if using an actor would enable the thread to continue running while the sequence is holding back the main thread, I'd definitely look into implementing this. As it stands I don't really understand the use cases.

    • @5uphi
      @5uphi  2 года назад +9

      There are benefits for instance you can look at my infinite terrain plugin to see how each chunk of terrain generates in a separate actor, your actor has to complete before the end of the frame or it will block the synchronized part you can use a task.wait() to make it wait till the next frame and continue its work, lets say you have a calculation 1 * 1 + 2 * 2 what you can do is make actor1 to 1 * 1 then synchronize and actor2 do 2 * 2 then synchronize then after both have synchronize do 1 + 4 to get the result 5

  • @costo.
    @costo. 4 месяца назад

    7:10 "Lua" option doesn't appear anymore :(

    • @MeatMake
      @MeatMake 2 месяца назад

      same, did u find a solution?

  • @Scryptings
    @Scryptings Год назад +2

    Hey there suphi! Great video as always, although i have a question
    Put it simply, i have a module that have a start function inside of it, and it will start IF the module has never been started yet, (an internal variable checks it but you get it). My problem is, i throw a warning when you try to start an already started module, and since i also have an internal auto-start (incase the module gets interacted with but it has never been started), the problem comes down to this :
    When i have two scripts that require a module, 1 script starts the module and the other just does normal stuff, the warning would sometimes appear and sometimes not, since script 1 starts the module and script 2 has an internal autostart, it sometimes throws an error that the module has been started! Any way to fix this? Thanks!

    • @5uphi
      @5uphi  Год назад

      Make the start function private and simply call the function before you return the module no need for a variable to keep track

  • @noon1263
    @noon1263 2 года назад +1

    Could you explain and teach us how to use the TextChatService, there isn't really much info about it. I know its not fully realised, but i just want to know what it fully is and how it fully works, and what i can do.

  • @kif-zallrhat1870
    @kif-zallrhat1870 Год назад +1

    Right... I understand this already but I have no idea what I could use it for. My game has two scripts and a bunch of module scripts and parallel scripting doesn't allow me to use remote events and functions on top of all... Uses I can think of are, for example, multiple NPCs or something similar

  • @monoqqr
    @monoqqr 2 года назад +1

    could you cover up ways to use this as well as the difference of running thread-safe code to running code that is not safe to read

    • @5uphi
      @5uphi  2 года назад +1

      I hope to incorporate multiple threads in many of my future videos when it's feasible

  • @praneshbalaji8047
    @praneshbalaji8047 2 года назад

    Thank you!!!!!!1

    • @5uphi
      @5uphi  2 года назад

      Your very welcome

  •  2 года назад +2

    Should I use it instead of single thread on every scripts?

    • @5uphi
      @5uphi  2 года назад +1

      Most likely no

  • @hajka7887
    @hajka7887 2 года назад

    Thanks, I'd be really grateful if you did an introduction to coroutines

    • @5uphi
      @5uphi  2 года назад +1

      I personally never use coroutines but maybe if I got some extra time I can make a video about it

  • @reardoor
    @reardoor Год назад

    You briefly mentioned that CPU determines worker threads. Is there a max number?

    • @5uphi
      @5uphi  Год назад

      Don't think so

  • @lovableprogrammer2800
    @lovableprogrammer2800 2 года назад +1

    whats the point of syncronizing scripts? I feel like there's a performance benefit here but I need it explained

    • @5uphi
      @5uphi  2 года назад +1

      Not all properties can be set while desynchronized so you must synchronize to for instance set a parts name

    • @lovableprogrammer2800
      @lovableprogrammer2800 2 года назад +1

      @@5uphi can you give me an example

    • @5uphi
      @5uphi  2 года назад +1

      Like 98% of properties of anything can't be changed while desynchronized you need to check the documentation to find out what is safe to set while desynchronized for instance you can't set the parts name position size anchored cancollide etc.. all these properties can only be changed while synchronised

    • @lovableprogrammer2800
      @lovableprogrammer2800 2 года назад +1

      @@5uphi what the... why do i feel like i've been scripting games all wrong ;-;

  • @goreacraft
    @goreacraft 2 года назад +1

    I am trying to use parallel scripting for some ocean planes (plane mesh with bones) but i get an error "Property Bone.Transform is not safe to write in parallel" .. this is a bummer

    • @5uphi
      @5uphi  2 года назад +1

      Make sure to read the thread safety part of this article create.roblox.com/docs/scripting/scripts/parallel-scripting

  • @zuner1446
    @zuner1446 9 месяцев назад

    guys Is there I one who doesn't see script working?

  • @kokobroxd
    @kokobroxd 8 месяцев назад +1

    ctrl+p opens quick search

  • @toothinm9paste
    @toothinm9paste Год назад

    could this scripting method be useful for wave function generation, such as wave function terrain generation, and map generation?

    • @5uphi
      @5uphi  Год назад

      It's useful if you want to do a heavy task multiple times

  • @akzholtosamaeva117
    @akzholtosamaeva117 2 года назад

    😍😍😍😍😍😍😘😘😘

  • @cyberex5509
    @cyberex5509 Год назад

    for me i cant even find where the main thread is, for some reason the instead of it appearing as "Main" like in the video, mine is "Main/Render" and therefore when i look in this "Main/Render" thread it doesn't show up any scripts being executed. I've tried different ways to move the scripts into replicate storage, starter player,... but it doesnt seems to work. Please help

  • @yeah7689
    @yeah7689 2 года назад

    Can you make a grenade?

  • @Boi-ii2lm
    @Boi-ii2lm Год назад

    I dont understand the use for this really, example i have gertsner wave ocean lets say i would want to calculate all the bone data then synchronize and displace those bones, but how would i even transfer the data without yielding?

    • @5uphi
      @5uphi  Год назад

      you can use a bindableevent to send data

  • @mybisboetharium737
    @mybisboetharium737 Год назад

    so like.. say for, a chunk (voxel blocks) loading system, do i really have to make 64 actors with 64 individual scripts that do the same thing, to run the same function in parallel?.. also great informative video, i was having so much trouble understanding this parallel luau thing because the way people explain it was so alien.. except for this video, so amazing job :D

    • @5uphi
      @5uphi  Год назад

      You can make one actor then clone that actor

    • @mybisboetharium737
      @mybisboetharium737 Год назад

      @@5uphi Then keep firing the bindable events on each actor? and when all 64 are occupied, start firing on occupied ones?

    • @mybisboetharium737
      @mybisboetharium737 Год назад

      @@5uphi ?

    • @5uphi
      @5uphi  Год назад

      You could if you wanted to or you could clone more when there are no actors not occupied or you could wait until some of the actors are no longer occupied before doing more work

  • @soda35160
    @soda35160 Год назад

    U sound like turtle derp

    • @5uphi
      @5uphi  Год назад +1

      iv never heard turtle derp before

    • @soda35160
      @soda35160 Год назад

      @@5uphi he is an old minecraft youtuber i used to watch. He privated all of his videos a couple months ago