Hacker News new | past | comments | ask | show | jobs | submit login

Awesome game. Good to see the code is authentically bad for an indie game of that era.



Authentically bad is a good way to put it. My favorite part is the 3300 line Game::updatestate() function and its gigantic switch statement.


I think it's pretty charming. Games have so much abstraction these days it feels like there's no way to truly understand what it is they're even doing.

One can spend months agonizing over the true nature of things and how ideas and concepts relate to each other and eventually distill it all into some object oriented organization that implements not just your game but all possible games.

One can also just cycle the game's state machine in a big function, haha switch statement go brrr. Reminds me of the old NES games which would statically allocate memory for game objects, very much in the "structure of arrays" style, they too had game logic just like that.

Also reminds me of old electromechanical pinball machines. You can literally see the machine cycle.

https://youtu.be/ue-1JoJQaEg

https://youtu.be/E3p_Cv32tEo


Holy... all wrapped in an if statement too!


> case 4099:

lol!

Also I like that every function starts with:

>jumpheld = true;


It was originally written in flash, then ported to C++ which would explain some (not all) of the badness.


I find the code genuinely inspiring. A lesson that being precious about code quality is not always the best way forward.


Yeah, code is a means to an end.


There's nothing wrong with this code. It's called loop unrolling and it keeps the game performant.


Hah. Unroll your loops manually to give the compiler a break!


Exceelnt sgugstion




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: