Why is there a load() at all?

  • Klaymore
    link
    fedilink
    arrow-up
    9
    ·
    edit-2
    1 year ago

    load() just loads things as soon as it’s called, so it can be used if you’re making an open-world game and don’t want the whole map loaded into ram at once, or if you switch from one level to another maybe you want to load some new assets and unload the previous ones to save memory. If you’re not worried about that you can just use preload() yeah.

    • Sethayy
      link
      fedilink
      arrow-up
      2
      ·
      1 year ago

      I personally have a ‘game launcher’ for all my separate projects which I’ll usually only launch one from, so I exclusively use load()

      • Rodeo@lemmy.ca
        link
        fedilink
        arrow-up
        3
        ·
        1 year ago

        Why did you do that? I’ve always just used the project manager. Is it that version manager plugin that was posted here a while ago?

        • Sethayy
          link
          fedilink
          arrow-up
          1
          ·
          1 year ago

          Ngl cause all my code is a mess and I have a lot of ‘addons’ that I don’t want to separate out but also haven’t been finished independently yet. Its my ADHD workflow but it works for me, its all just one disgustingly large project

  • I Cast Fist@programming.dev
    link
    fedilink
    arrow-up
    6
    ·
    1 year ago

    For a personal project, I’m using load() because I don’t know which file I’m supposed to load when the scene starts. Also, said file can change during game runtime.

    In my case, I’m changing textures. With the game paused, the player can change some stuff, like the character’s hair. I don’t need to preload all of them, and maybe a preloaded one might not be the one that should actually be loaded in the end.