Object Destruction & Pooling with C# Composition, Inheritance & Interfaces [Andromedoom Dev Log 5]

Поделиться
HTML-код
  • Опубликовано: 5 июл 2024
  • 👾Welcome to the Andromedoom dev logs!
    In episode 5, I'm following on from the previous tutorial where we covered object creation at runtime, and focussing on object destruction. This will involve two different methods of destruction, one using Godot's Free() or QueueFree() methods, and one using object pooling using C# generic queue structures. In addition, I will be showing you a comparison of how this behaviour would be implemented using composition vs inheritance, and finally how and why to use C# interfaces.
    In the dev log, I will be presenting the city building models I pulled together for the remaining four cities in the Asia-Pacific region: Hong Kong, Shanghai, Seoul, and Tokyo.
    I hope you enjoy this video series and stick around for the game's development! 👋
    ⏱️ Timestamps:
    0:00 Intro
    1:00 Summary of the scenes and minor changes
    3:52 Scripting - Implementing the destructible class with composition
    7:00 Scripting - Destroying projectiles after a certain time
    8:56 Scripting - Preparing the alien and setting the projectile collisions
    10:55 Scripting - How do we know if objects are destructible? Interfaces.
    14:18 Composition vs inheritance
    15:35 Scripting - Implementing the destructible class with inheritance
    17:39 Scripting - Destroying the buildings/shields
    18:40 Changing meshes at runtime for destruction effects
    23:00 Object pooling using C# queue data structures
    24:10 Scripting - Object pool for projectiles
    27:40 Debugging the object pool
    28:50 Dynamically setting the pool size
    32:33 Conclusions on interfaces, inheritance and extending pooling
    36:20 Dev log - The Fossilators! a.k.a Diesel Death Robots.
    39:38 Dev log - Model materiality
    41:45 Conclusion
    📻 Addenda:
    1. Note that in my main project, I favoured composition over inheritance for destructible objects. It proved more easily extensible, with inheritance used for other abstract properties i.e. player ships and aliens have super classes for the specific types Alien and Ship, with each alien and ship having its own script that derive from these super classes. The super classes implement Destructible. This greatly reduced the amount of code reuse.
    2. Yes, I misspelled destructible*.
    3. Instead of using EnterTree(), you can call RequestReady() on the projectile. This will call the Ready() method again when the projectile re-enters the scene tree.
    🎶 Music tracks from:
    - Flitz&Suppe - Yokai
    - Provided by Lofi Girl
    - Listen: fanlink.to/YokaiEP
    __________________________________________
    You can also visit me at:
    WEBSITE 🌏 polysthetic.com
    THREADLESS 🕶️ polysthetic.threadless.com
    DRIBBBLE 🏀 dribbble.com/polysthetic
    RUclips 🎥 / polysthetic
    AUDIOMACK 🎼 audiomack.com/polysthetic
  • ХоббиХобби

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

  • @Polysthetic
    @Polysthetic  Год назад +3

    📻 Addenda:
    1. Note that in my main project, I favoured composition over inheritance for destructible objects. It proved more easily extensible, with inheritance used for other abstract properties i.e. player ships and aliens have super classes for the specific types Alien and Ship, with each alien and ship having its own script that derive from these super classes. The super classes implement Destructible. This greatly reduced the amount of code reuse.
    2. Yes, I misspelled destructible*.
    3. Instead of using _EnterTree(), you can call RequestReady() on the projectile. This will call the _Ready() method again when the projectile re-enters the scene tree.

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

    epic