• sunbeam60@feddit.uk
    link
    fedilink
    arrow-up
    29
    ·
    23 hours ago

    Been there, so many times.

    Late in Perfect Dark Zero’s development (a complete shitshow to get launched for X360 day 1) we added something called “kill planes”, behind which all entities would get nuked. The aim was that you would physically move through the world and eventually get to “no turning back” points, behind which we could remove all entities to save some cycles.

    Turns out there were a large amount of places that assumed that once they had a pointer to an entity that pointer would remain valid.

    So yeah, code that was like “I’ll just flip this bit on this entity I kept track of” was now flipping random bits on memory.

    These were fun to chase down.

    In the end we inplemented NoTaD pointers (“notified on target destruction”, essentially weak pointers but this was back in the day when weak pointers and smart pointers weren’t really well defined) that would discover when the thing they took a precious pointer to was actually no longer valid.

    • CanadaPlus@lemmy.sdf.org
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      10 hours ago

      In the end we inplemented NoTaD pointers (“notified on target destruction”, essentially weak pointers but this was back in the day when weak pointers and smart pointers weren’t really well defined) that would discover when the thing they took a precious pointer to was actually no longer valid.

      It’s weird to me that programming practice has changed that much in 20 years. That’s still closer to today than to Dennis Richie doing his thing.