Multi Thread, Parallel Scripts, MicroProfiler - Roblox Scripting Tutorial

Поділитися
Вставка
  • Опубліковано 23 лис 2024

КОМЕНТАРІ • 76

  • @CSHorseBobJoe
    @CSHorseBobJoe Рік тому +54

    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 4 місяці тому +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!

  • @CodeProto
    @CodeProto 6 місяців тому

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

  • @calamitydoggo6973
    @calamitydoggo6973 2 роки тому +3

    great tutorial, learned a lot about the micro profiler

  • @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

  • @rodeveloperro
    @rodeveloperro 9 місяців тому

    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.

  • @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

  • @exhydraboy2429
    @exhydraboy2429 6 місяців тому +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  6 місяців тому

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

  • @hlflifeenjoyer6176
    @hlflifeenjoyer6176 7 місяців тому

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

  • @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.

  • @wrello
    @wrello Рік тому +5

    Thanks!

    • @5uphi
      @5uphi  Рік тому +2

      Your very welcome and thank you for the support :)

  • @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 Рік тому

    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

  • @lyptical7868
    @lyptical7868 2 роки тому

    Incredible video

  • @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

  • @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

  • @gabrioche6757
    @gabrioche6757 Рік тому

    Thanks, very interesting

  • @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.

  • @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

  • @cyberex5509
    @cyberex5509 11 місяців тому

    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

  • @rodeveloperro
    @rodeveloperro 9 місяців тому

    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

  • @zuner1446
    @zuner1446 7 місяців тому

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

  • @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

  • @kokobroxd
    @kokobroxd 6 місяців тому +1

    ctrl+p opens quick search

  • @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

  • @getmanovich377
    @getmanovich377 Рік тому

    Parallel Luau looks unpredictable

  • @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

  • @the_pr0fessorRBXL
    @the_pr0fessorRBXL 2 роки тому

    🙌

  •  2 роки тому +2

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

    • @5uphi
      @5uphi  2 роки тому +1

      Most likely no

  • @lovableprogrammer2800
    @lovableprogrammer2800 Рік тому +1

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

    • @5uphi
      @5uphi  Рік тому +1

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

    • @lovableprogrammer2800
      @lovableprogrammer2800 Рік тому +1

      @@5uphi can you give me an example

    • @5uphi
      @5uphi  Рік тому +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 Рік тому +1

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

  • @costo.
    @costo. 2 місяці тому

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

    • @MeatMake
      @MeatMake 25 днів тому

      same, did u find a solution?

  • @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

  • @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

  • @praneshbalaji8047
    @praneshbalaji8047 2 роки тому

    Thank you!!!!!!1

    • @5uphi
      @5uphi  2 роки тому

      Your very welcome

  • @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

  • @yeah7689
    @yeah7689 2 роки тому

    Can you make a grenade?

  • @akzholtosamaeva117
    @akzholtosamaeva117 2 роки тому

    😍😍😍😍😍😍😘😘😘

  • @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