3 ms·
Examples?
by edflsafoiewq 7mo ago
Examples?
- andai 7mo agohttps://en.wikipedia.org/wiki/Nuclear_Gandhi https://en.wikipedia.org/wiki/Nuclear_Gandhi From what I heard, there was a Civilization game which suffered from an unsigned integer underflow error where Gandhi, whose aggression was set to 0, would become "less aggressive" due to some event in the game, but due to integer underflow, this would cause his aggression to go to 255, causing him to nuke the entire map. The article says this was just an urban legend though. Well, real or not, it's a perfect example of the principle!
- luaKmua 7mo agoIndeed an urban legend. Sid Meier himself debunked in his memoir, which is a pretty great read.
- mrguyorama 7mo agoIt's fascinating to live through the entire lifecycle of: Weird thing happens. People make up reasons why. One reason is possible. That becomes THE reason, and spread wildly, without confirmation, as an accurate explanation. "Actually that's not true". Now that not being the reason is widely disseminated and if we are lucky the original meme dies out! But it took 30 years. For a very meaningless rumor.
- Waterluvian 7mo agoNot really an example that proves any point, but one that comes to mind from a 20-year-old game: World of Warcraft (at least originally) encoded every item as an ID. To keep the database simple and small (given millions of players with many characters with lots of items): if you wanted to permanently enchant your item with an upgrade, that was represented essentially as a whole new item. The item was replaced with a different item (your item + enchant). Represented by a different ID. The ID was essentially a bitmask type thing. This meant that it was baked into the underlying data structures and deep into the core game engine that you could never have more than one enchant at a time. It wasn't like there was a relational table linking what enchants an item in your character's inventory had. The first expansion introduced "gems" which you could socket into items. This was basically 0-4 more enchants per item. The way they handled this was to just lengthen item Ids by a whole bunch to make all that bitmask room. I might have gotten some of this wrong. It's been forever since I read all about these details. For a while I was obsessed with how they implemented WoW given the sheer scale of the game's player base 20 years ago.
- hcs 7mo agoNot the same thing but I was reminded of a joke about the puzzle game Stephen's Sausage Roll: > I have calculated the value of Pi on Sausage Island and found it to be 2. https://web.archive.org/web/20240405034314/https://twitter.com/ianmaclarty/status/723848396675506177 https://web.archive.org/web/20240405034314/https://twitter.c...
- mort96 7mo agoI think Minecraft's lighting system is a good example: there are 16 different brightness levels, from 0 to 15. This allows the game to store light levels in 4 bytes per block. Similarly, redstone has 16 power levels: 0 to 15. This allows it to store the power level using 4 bits. In fact, quite a lot of attributes in Minecraft blocks are squeezed into 4 bits. I think the system has grown to be more flexible these days, but I'm pretty sure the chunk data structure used to set aside 4 bits for every block for various metadata. And of course, the world height used to be at 255 blocks. Every block's Y position could be expressed as an 8-bit integer. A voxel game like that is a good example of where this kind of efficiency really matters since there's just so much data. A single 1616256 chunk is 65.5k blocks. If a game designer says they want to add a new light source with brightness level 20, or a new kind of redstone which can go 25 blocks, it might very well be the right choice to say no.
- tosti 7mo agoI don't think Minecraft would be considered a cornerstone of optimal programming.
- kulahan 7mo agoThe entire program doesn't need to be a cornerstone of optimal programming for this one example to hold true.
- helterskelter 7mo agoThe 4 bit stuff is a hangover from Mojang having to squeeze every bit of perf from their Java based engine that they could. Their original sound engine was so sketchy that C418's (music composer) minimalist sound is partly because it really couldn't handle much more than what got released. MS has been loosening up on the 4 bits limit and have created a CPP variant of Minecraft which performs better, but they've also introduced their unified login garbage that has almost made me give up Minecraft completely.
- Pannoniae 7mo agoHey, this isn't entirely accurate! The 4-bit stuff is a hangover from Notch doing this (I'd maybe even say a similar-calibre programmer to Chris Sawyer...). The sound has nothing to do with technical limits, that's a post-facto rationalisation. The game never played midi samples, it was always playing "real" audio. The style was an artistic choice, many similar retro-looking games were using chiptune and the sorts. It's a deliberate juxtaposition... The CPP variant doesn't really perform better anymore either.
- ErroneousBosh 7mo agoGoing way back into history, the Alesis MIDIVerb reverb unit had a really simple DSP core made out of discrete logic chips. It could add a memory location to an accumulator and divide it by two, invert it, add it and divide it by two, or store it in ram either inverted or not and divide the accumulator by two. Four instructions, in about eight chips. By combining shifts and adds Keith Barr was able to devise all the different filter and delay coefficients for 63 different reverb programs (the 64th one was just dead passthrough).
- bombcar 7mo agoRead all of the Factorio Friday Facts https://factorio.com/blog/ https://factorio.com/blog/ - a number of the more obscure bug/performance issues come down to making something fit naturally into a value the CPU can handle.
- plopz 7mo agoOne of the main issues with Kerbal Space Program is instability caused by floating point numbers. I know Starcraft 2 was built upon integers.
- Gigachad 7mo agoFloating point issues are less a problem of performance here but one of precision. Particularly being a space game, the coordinates can be massive resulting in the precision deteriorating enough to cause issues.