Memory Allocation Optimization (HUGE)

Поделиться
HTML-код
  • Опубликовано: 8 сен 2024
  • Main Channel: / kazebg0
    🥰 Patreon: / kazestuff
    🐦 / kazeemanuar
    MERCH: kazemerch.mysp...

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

  • @SMWssaamm
    @SMWssaamm Месяц назад +135

    It's crazy that optimization seemingly has no plateau. You never get to the point of "OK, there is literally nothing left".

    • @Mireneye
      @Mireneye Месяц назад +34

      And another aspect that gets harder and harder is profiling. It becomes increasingly difficult to build test cases where you can see the marginal gains, and see their actual effect across all the various gameplay scenarios.

    • @MichaelPohoreski
      @MichaelPohoreski Месяц назад +15

      (Exponential) *Decreasing returns.*

    • @therealjones-o6x
      @therealjones-o6x Месяц назад +14

      The very end of optimization must be when the code gets just too convoluted and is not manageable anymore

    • @stanley8006
      @stanley8006 Месяц назад +3

      scp 79 but in real life

    • @SMWssaamm
      @SMWssaamm Месяц назад +3

      @@therealjones-o6x the only end is when there is no code

  • @Reaperman4711
    @Reaperman4711 Месяц назад +112

    At the current rate of 'huge optimizations,' the mario 64 engine will be running crysis about mid next year.

    • @LamantinoElettronico
      @LamantinoElettronico Месяц назад +6

      "But can it run Crisis"... How old is that joke anyway? Feels like yesterday

    • @stanb1455
      @stanb1455 Месяц назад +1

      Unlikely, maybe Far Cry?

  • @micnor14
    @micnor14 Месяц назад +83

    Are you saying you've freed an entire megabyte of RAM? The N64 only has 4MB of RAM. That's 25% more memory for the game to use. This sounds like the absolute largest N64 optimization ever!!

    • @KazeClips
      @KazeClips  Месяц назад +107

      i'm using 8mb of RAM since im using the expansion pak, but it's only .8mb or so - so 10% i'd say

    • @sefayildirim3775
      @sefayildirim3775 Месяц назад +37

      ​@@KazeClips still huge, you're achievements in optimization are amazing nonetheless!

    • @noname-gp6hk
      @noname-gp6hk Месяц назад +6

      Is it possible for somebody to design a larger memory expansion pack, or is something hard coded to only support the +4MB the OEM expansion pack had? Seems like an opportunity for a larger expansion pack PCBA to be developed and dropped in.

  • @Mireneye
    @Mireneye Месяц назад +43

    WOW 1 MB is HUGE!

    • @blossomcherrypink
      @blossomcherrypink Месяц назад +8

      This sounds both sarcastic and serious to me

    • @Mireneye
      @Mireneye Месяц назад +12

      @@blossomcherrypink I meant it in the context of the N64 so def serious. But in hindsight I see how it can sound sarcastic af ^^

    • @Kniffel101
      @Kniffel101 Месяц назад +5

      1MB is a million bytes (well, 1024²), so yes it is a lot.
      Though Kaze wrote it's closer to .8 MB.

  • @ParrotTheNotParrot
    @ParrotTheNotParrot Месяц назад +52

    Do the Mario go zoom zoom now?

    • @fjhskd34u21h3
      @fjhskd34u21h3 Месяц назад +21

      if rambus go vroom vroom, mario go zoom zoom. so yes, exactly

    • @mirabilis
      @mirabilis Месяц назад +6

      Mushroom, room.

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

      @@fjhskd34u21h3yayyyy

  • @Sad_Cirno
    @Sad_Cirno Месяц назад +32

    You love to see another Kaze optimization video

  • @Minty_Meeo
    @Minty_Meeo Месяц назад +18

    I saw this on Twitter as well. The AllocDeallocPoolState struct you showed on there, at first I thought it had a sub-optimal layout (8 bytes of padding), but then I thought maybe it was like that to align to page boundaries? (32 bytes large)
    Also, will we get a video about that sine function anonymously emailed to you that managed to out-perform the one SilasLock created?

  • @tumbleweb
    @tumbleweb Месяц назад +18

    You inspire me to learn things about programming I thought were once impossible

    • @tumbleweb
      @tumbleweb Месяц назад +11

      That being said I have no idea what is going on

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

      @@tumbleweblmfao

  • @Pandore123
    @Pandore123 Месяц назад +8

    Can't wait to run mario galaxy on the N64

  • @mirabilis
    @mirabilis Месяц назад +18

    I wonder if this is the most optimized N64 game ever. By one person, on top of that. And he hasn't even been a programmer for that long, relatively speaking.
    What I want to say is, I'm very impressed what you've accomplished.

    • @The111Primagen
      @The111Primagen Месяц назад +7

      Kaze got to be a savant. It's insane how good he is at coding

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

      @@The111Primagen he's a natural!

    • @metroid031993
      @metroid031993 Месяц назад +18

      It's worth noting that Kaze chats with plenty of smart people, who have directly given him or helped with the optimizations he's done to the engine, talked with him about how the hardware works, etc. Not to say Kaze isn't smart, but his optimizations aren't just him doing it all on his own in isolation, but a large community effort that ends up implemented in his engine, built from the knowledge from the community

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

      @@metroid031993 It's great that there are communities that let people like kaze shine!

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

      @@metroid031993 I'm a programmer and I use the internet too.

  • @fautmedireenclair
    @fautmedireenclair Месяц назад +25

    Vroom Vroom

  • @RiverReeves23
    @RiverReeves23 Месяц назад +3

    I have several ideas how to utilise this extra RAM. 1) increased texture variety (approximately 100 * 32 x 32px textures fit in 800KB RAM) 2) increase LOD levels from 2 to 3, specifically to reduce triangles at a medium draw distance. 3) increase the variety of player/enemy animations 4) provide enemies with different facial expressions (neutral, angry, sad) using different textures 5) going against your optimisation approach of gradient backgrounds, this would allow for a 512 x 512px skybox at 524KB of RAM.

  • @ScarfKat
    @ScarfKat Месяц назад +1

    That's like 4x more memory than you had before. That's a HUGE optimization! Congrats dude

  • @Rodrigo-xf2oe
    @Rodrigo-xf2oe Месяц назад +7

    Let's see if I understood. The optimization in this video is that you better split the memory accesses across multiple memory segments? You were doing that before, but you could not split optimally because the memory allocator implementation that SM64 uses (glibc's malloc?) only allows a single contiguous region of memory? But now you work around that by making your own implementation? Or maybe your implementation also splits allocations across memory segments, and that is an optimization too?

    • @KazeClips
      @KazeClips  Месяц назад +9

      yeah thats the gist of it. idk what glibc's malloc is though

    • @Rodrigo-xf2oe
      @Rodrigo-xf2oe Месяц назад +5

      @@KazeClips malloc is a function from the C standard library for allocating memory. glibc is the implementation of the C standard library by the GNU project, which includes a memory alocator implementation, used by the malloc function. I just guessed that SM64 uses the glibc in the game, but I in reality I have no idea.

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

      ​@@Rodrigo-xf2oehe was joking about not knowing obviously, it's just that malloc is too general purpose to be fast in SM64

  • @taviethestick
    @taviethestick Месяц назад +22

    Is this not like the 18th "huge" optimization this y e a r 💀

    • @trashtrash2169
      @trashtrash2169 Месяц назад +3

      Are you complaining?

    • @taviethestick
      @taviethestick Месяц назад +17

      @@trashtrash2169 no no, just... just impressed really

  • @sanderbos4243
    @sanderbos4243 Месяц назад +2

    Very cool! I am kind of surprised that stuff is dynamically allocated, cause couldn't the game just use static arrays for everything? Or is there a downside to that that I haven't thought of?

    • @KazeClips
      @KazeClips  Месяц назад +7

      it has to load memory banks in each level, if you can't relocate those, you'd run out of memory fast

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

    Now only held back by the structure of the mario engine itself

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

    finally, mario 65

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

    You’re an inspiration.

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

    Great work kaze!

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

    Great stuff

  • @theabsolutecat915
    @theabsolutecat915 Месяц назад +5

    Someone explain this in TF2 terms

  • @A_Person_64
    @A_Person_64 Месяц назад +3

    Waiting for you to both reverse engineer and remake Super Mario 64 from scratch

    • @pukalo
      @pukalo Месяц назад +10

      That's what the SM64 decompilation project essentially is.

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

    lol omg how much optimizations can you still get out of the n64?

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

    pooling

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

    Mupen64 Plus FZ seems to not have any overclock options available...Any idea how to do that?
    Are you emulating on PC mostly? I think that is the case, as you mentioned project64 in the past a lot...
    Whatever the case, yeah, i cant find overclocking in any of the options in settings of m64plusfz...Might be my exynos chipset that is to weak...Your romhacks do tend to hit 40mb margin and up
    Cheers Kaze! P.S. when is this game going out? You said that your life is quite busy with baby and stuff, but any rough schedule where it can be expected? end of the year, summer 2025? Any ideas?

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

      Mupen FZ DOES have overclocking options
      Select your game, then go into settings, then go to the bottom of the list and click advanced
      Then set count per operation to 1 and overclocking factor to 5

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

      @usernamesareweird4880 in my version of the emulator there is no overclocking, nor is there any settings option when i enter the game
      All the settings i choose, i choose in the main menu of the emulator and then i configure everything...But even here i have no overclocking or anything remotely similar.
      whatever the case, thanks for the advice
      Maybe i have the "wrong" version of the emulator...Mupen64plus FZ Pro version does not have anything you are talking about
      Maybe you can share some link where you downloaded your own version, on discord or something...Again, thanks for the response kind stranger!

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

    You are the slightest bit sharp, but you aren't the sharpest tool in the shed. Tell me, how is Rosalina so popular if all she does is sit around near where Mario is after he comes back from a galaxy? She doesn't speak, she doesn't sweep, and she doesn't eat. No really, she is almost stoic, how is this?

    • @KazeClips
      @KazeClips  Месяц назад +5

      Its because of her story book and mommy aura

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

    Downvote just for trhe unclear title of the video. At least tell us it's for the N64. I don't follow this channel. Give us something :D

    • @stanb1455
      @stanb1455 Месяц назад +7

      you will only get n64 stuff here silly

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

      @@stanb1455 On RUclips.. or the Internet? As I said, I don't follow this channel :)

    • @LuigiXHero
      @LuigiXHero Месяц назад +3

      It takes 12 seconds for him to mention the N64 it's not like he waited halfway through the video.

    • @KazeClips
      @KazeClips  Месяц назад +5

      This applies to every rdram, but im focussed on n64

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

      who do you think you are, my 7th grade english teacher?