• zr0@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    13
    ·
    14 hours ago

    It is actually very interesting to see what your code actually causes on the CPU. Nowadays you have quite large instruction sets which help you with many operations what were manual in the past. But even then, you at this point you start counting CPU cycles. Back then, a multiplication by 4, written in C, probably resulted in using 4 CPU cycles of additions, instead of just shifting the bits 2 places left in one cycle. So you just saved 3 cycles. Sounds like nothing, but with only one core at 33MHz and hundreds of such calculations, it will have a much larger impact.

    • luciferofastora@feddit.org
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 hour ago

      I started studying “technical IT” for two years before changing to a less technical version that I ended up enjoying more (physics is fun to learn, but I don’t wanna calculate that shit).

      One of the most valuable things to come out of it is one class where we worked our way up all the way from logic gates to the functions of an ALU and a rough look at CPUs and memory architecture. Probably would have gone deeper in a follow-up class I never ended up taking.
      Point of the course was that one of the focus options for that course featured micro-controllers and embedded systems, including low-level optimisation (the typical memory constraints might be getting more lax, but learning it isn’t a bad idea).

      I don’t remember most of the details, I’m afraid, but it was an interesting insight into the things I take for granted when working in higher level languages.

  • chunes@lemmy.world
    link
    fedilink
    English
    arrow-up
    22
    ·
    20 hours ago

    I dunno, I’m sort of underwhelmed.

    • use the smallest data type you need for a given purpose (which you don’t really need to worry about on modern hardware for integer types)
    • use bitwise arithmetic when possible
    • use fake pathfinding when possible (in this case random walk), and when not possible, limit search depth
    • don’t do collision detection on thousands of guests; allow them to phase through each other

    This is all fairly basic stuff I would hope any game dev would be aware of.

    • CileTheSane@lemmy.ca
      link
      fedilink
      English
      arrow-up
      7
      ·
      5 hours ago

      This is all fairly basic stuff I would hope any game dev would be aware of.

      The article was written for people who aren’t game devs.

  • pdxfed@lemmy.world
    link
    fedilink
    English
    arrow-up
    34
    ·
    22 hours ago

    Interesting article! You should cross-post to some retro gaming communities, I’m sure they’d love it. I still never okayed this game as it came out when there was too much heat in Sims in the 90s, but probably would have enjoyed it more than some of the sim games I did play.

    • NoSpotOfGround@lemmy.world
      link
      fedilink
      English
      arrow-up
      3
      ·
      7 hours ago

      That looks indeed awesome. I didn’t know Elite was developed for the BBC Micro… 22 kB for a 3D open-world fighting/trading/mining flight simulator using only 8-bit integer addition operations. I had no idea…