• Wilzax@lemmy.world
    link
    fedilink
    English
    arrow-up
    127
    arrow-down
    5
    ·
    21 hours ago

    Your game will actually likely be more efficient if written in C. The gcc compiler has become ridiculously optimized and probably knows more tricks than you do.

    • dejected_warp_core@lemmy.world
      link
      fedilink
      English
      arrow-up
      40
      ·
      19 hours ago

      Especially these days. Current-gen x86 architecture has all kinds of insane optimizations and special instruction sets that the Pentium I never had (e.g. SSE). You really do need a higher-level compiler at your back to make the most of it these days. And even then, there are cases where you have to resort to inline ASM or processor-specific intrinsics to optimize to the level that Roller Coaster Tycoon is/was. (original system specs)

      • KubeRoot@discuss.tchncs.de
        link
        fedilink
        English
        arrow-up
        2
        ·
        3 hours ago

        I might be wrong, but doesn’t SSE require you to explicitly use it in C/C++? Laying out your data as arrays and specifically calling the SIMD operations on them?

        • dejected_warp_core@lemmy.world
          link
          fedilink
          English
          arrow-up
          1
          ·
          45 minutes ago

          Honestly, I’m not 100% sure. I would bet that a modern compiler would just “do the right thing” but I’ve never written code in such a high performance fashion before.

        • acockworkorange@mander.xyz
          link
          fedilink
          English
          arrow-up
          1
          ·
          2 hours ago

          There’s absolutely nothing you can do in C that you can’t also do in assembly. Because assembly is just the bunch of bits that the compiler generates.

          That said, you’d have to be insane to write a game featuring SIMD instructions these days in assembly.

    • s_s@lemm.ee
      link
      fedilink
      English
      arrow-up
      5
      arrow-down
      8
      ·
      18 hours ago

      Write it in Rust, and it’ll never even leak memory.