Object-Oriented Programming in Roblox Studio!

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

КОМЕНТАРІ •

  • @v3rtix477
    @v3rtix477 9 днів тому +1

    Everyone, it is better to use Entity Component System (ECS) when making games. Such as matter and jecs for luau.
    With OOP, you have to make your property behavior turn off can_fall for it to not fall, but with ECS. You have to just remove the Acceleration component of the entity and the system will never touch that entity again
    Note that ECS should be data driven and not event driven means something like signals should never exist in a system
    Eitherway if you want something more structured and flexible. You can try using ECS but its up to your choice

  • @AlteFore
    @AlteFore 9 місяців тому +33

    OOP can be useful but there are cases where it might not be necessary, and luau OOP can be particularly hacky or hard to read. Be sure you know when and where to use it!

    • @Spez_art
      @Spez_art 8 місяців тому +3

      I'm making a game that needs to instantiate TONS of physics parts and NPCs that have slight variations on each client and replicate its whereabouts and activities to other players as quickly as possible without creating any physical objects on the server, so it'd be easier to explain where NOT to use it in my case lmao

    • @workindad
      @workindad 8 місяців тому +1

      I've been trying to learn OOP for about 3 months now and while I can most of the time follow along I just can't seem to recreate it with my own projects.

    • @nikos4677
      @nikos4677 5 місяців тому

      ​@@workindadI have the opposite proble.I just naturally use OOP

    • @baconheadhair6938
      @baconheadhair6938 2 місяці тому +1

      @@nikos4677cause you are such a silly person buddy

  • @Captan40000
    @Captan40000 9 місяців тому +28

    didnt want to buy your course (costs for me about 9x more than this dono) because i already know scripting, but never knew this type of stuff. keep up the work, you never know what you can learn daily.

    • @crusherfire1
      @crusherfire1  9 місяців тому +6

      Thanks for the support! Much appreciated.

  • @Sir_Pixelated
    @Sir_Pixelated 9 місяців тому +4

    Finally I understand just what the difference between . And : and what self is, thank you so much!

  • @Not_Flood
    @Not_Flood 9 місяців тому +4

    I'm already familiar with classes in general and OOP in roblox, tho this video really made me understand the concepts more and learn few new stuff. I really appreciate the work u put in these vids.

  • @Cogni7962
    @Cogni7962 4 місяці тому +1

    W channel bro. Idk what I would do without u fr❤

  • @Raphealt
    @Raphealt 7 місяців тому +1

    11:55 I usually require the clone of the module, or delete and repaste the module.

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

    Object-Class in a Module script allow's you to reuse that Object anywhere if you require it in a ServerScript

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

    Dude i love your videos, please make more! ❤🎉

  • @HueJanus-s2h
    @HueJanus-s2h 8 місяців тому +2

    how would I make a property of an object like color that would for example change the color of a model. In this video you only read the value of the properties.

  • @corruptghxst
    @corruptghxst 8 місяців тому +1

    Amazing, out of every tutorial I've tried it has always confused the crap out of me. You made Lua OOP and metatables nice and easy to understand!
    I have one question, is it possible to make the indexed metatable methods show up in autocomplete?
    Edit: Realized my studio was just bugged, ignore that!
    Really helpful tutorial though, got my module working :)

    • @crusherfire1
      @crusherfire1  8 місяців тому

      Yes, you would have to use the Vect2 table as the metatable itself instead of having two separate tables. Though, I'm not sure exactly why you would want to access the metamethods from objects created by the class?
      The purpose of having the two separate tables was to uphold the OOP principle of abstraction, where you hide unnecessary implementation details (like the metamethods) from the person who is using the class & objects.

    • @corruptghxst
      @corruptghxst 8 місяців тому

      @@crusherfire1 Oh sorry I may have mislabeled what I was trying to convey. I mean when I create an object, its methods won't show up in autocomplete.
      So for example if I used Vect2.new(), the :Dot() needs to be manually typed out and it will not show up in autocomplete as it does in your video.
      Edit: Realized my studio was just bugged, ignore that!
      Really helpful tutorial though, got my module working :)

  • @Kitsune_Dev
    @Kitsune_Dev 9 місяців тому +1

    Can you do a video on Functional programming next for the Functional Bros?

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

    Can you talk about Test driven development and TestEz?

  • @snicker2619
    @snicker2619 9 місяців тому +1

    Have you ever thought of going into components?

  • @RedstonePotion
    @RedstonePotion 9 місяців тому +1

    OOP is amazing! But how do you actually see tables properly in the output please tell mee

    • @TheVerseer
      @TheVerseer 9 місяців тому +1

      there should be a setting in the output
      In the output, Click the 3 dots in the top right, then disable "Show memory address for expandable tables"

  • @Sir_Pixelated
    @Sir_Pixelated 9 місяців тому +1

    I have a question, is there a problem with directly attaching a function to the table instead of using metatables? Because I usally just do somthing like function Object:Explode() or somthing like that and I wanted to know if I should go back and fix all of my modules.

    • @crusherfire1
      @crusherfire1  9 місяців тому +5

      If you create the functions within the objects themselves, you'll end up using more memory with the more objects you create. With metatables, all of your object functions refer back to the one place they were declared, which saves on memory.

    • @baconheadhair6938
      @baconheadhair6938 2 місяці тому

      @@crusherfire1are you sure?

  • @Collman_fff
    @Collman_fff 9 місяців тому +1

    How u setup your modules? i saw alot of devs make one script named start and multiple modules?. (I hope u see my comment)

    • @crusherfire1
      @crusherfire1  9 місяців тому +1

      Yeah, they usually have 1 script that goes through and requires a bunch of modules. After it requires all the modules, then the modules typically have an :Init() function to initialize them, then a :Start() function to execute any code after the initialization of the modules

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

      thanks for helping

    • @baconheadhair6938
      @baconheadhair6938 2 місяці тому +1

      @@crusherfire1do you believe in gods

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

    Can you explain what the difference between "typeof" and "type" is? I have always used type because its less letters.

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

      type() is the built-in type checking function for Lua, while typeof() was specifically made for Luau. It helps you check for non-native data types in the game engine like CFrames, Vectors, Color3s, etc.

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

      @@crusherfire1Oh right, so typeof should be used most of the time?

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

      @@Noon1263 Yup, because it also allows you to check for those custom data types. If you used type() on Vectors, CFrames, etc, it would only return "userdata"

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

      @@crusherfire1 i wish i knew this, thank you

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

      @@Noon1263 if you want to do a completely unneeded micro-optimization you can do type() for things that arent native to the engine and save micro-seconds

  • @PumpyGT
    @PumpyGT 5 місяців тому

    I love you

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

    Is your course on Udemy more discounted?

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

      You can use the code in the description for 33% off!

  • @CheeseY420
    @CheeseY420 8 місяців тому

    what font do you use

  • @firepalmmy5933
    @firepalmmy5933 4 місяці тому

    can't understand anything

    • @lem0ndadedcorner994
      @lem0ndadedcorner994 3 місяці тому

      Learn Python, then learn how memory works while interpreting Python
      Then come back to lua, it will sound much easier like 1000x easier

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

    reminds me of Trump