Re:Open source is democratizing video game development
by sirtomato on Thursday October 20, 2022 @09:21AM
(#33274287)
Yep, absolutely. A lot of game code has really big files. Although not exactly the gold standard for code style, the Source Engine does have a significant level of even though almost every file is 1k+ SLOC.
Here's the base Source Engine movement code for example: https://github.com/VSES/SourceEngine2007/blob/master/src_mai...
Re:Open source is democratizing video game development
by torginus on Thursday October 20, 2022 @01:16PM
(#33277773)
I mean, stuff like this isn't really defensible:
switch (index)
{
case 0: return sound0;
case 1: return sound1;
case 2: return sound2;
case 3: return sound3;
case 4: return sound4;
}
Re:Open source is democratizing video game development
by 32gbsd on Thursday October 20, 2022 @10:35PM
(#33283787)
Look perfectly readable and easy to understand.
Re:Open source is democratizing video game development
by chii on Friday October 21, 2022 @12:05AM
(#33284381)
only because there's no `default` case.
You could argue that having `sound` as an array, and index into that array is better, but once again, what does "better" mean here?
this code works as is, you will not get an array index out of bounds error. If this is quick and easy to write, what else could you ask for?
that's because these best practices aren't geared towards producing something good - it's geared towards making something easy to understand for someone else, and easy to maintain when requirements change.
It is also designed for the lowest common denominator programmers - so that many can work on the same code base, over a long period of time.
For games, none of these goals matter at all.