Earlier quoted context omitted.
Yeah, it still seems like a reasonable choice if you're going to write a simple game in C.
raylib might be an option for consideration as well: https://www.raylib.com/
Flappy Bird in 1000 lines of C
31–40 of 59 posts
Re: Flappy Bird in 1000 lines of C
#32I like these challenges, where people rebuild stuff low level and “line efficient” (not saying this is a good idea in general). This makes me curious and I can learn a lot from these examples. I was a bit disappointed though to see that this code used SDL for sprites and more stuff though. That’s not 1000 lines anymore imo. Still the code was an interesting read. Thank you OP
It's impossible to do graphics in pure C, so what are the alternatives? Whatever you do at whatever level of abstraction/portability (SDL, OpenGL, Metal, Vulkan, Unity, ...), you're leveraging zillions of lines of other people's code. The only way arguably you could do it in pure C (with undefined behavior) is in enviroments that let you write straight to graphics framebuffers without any abstraction layer and even w…
Re: Flappy Bird in 1000 lines of C
#33Earlier quoted context omitted.
It's impossible to do graphics in pure C, so what are the alternatives? Whatever you do at whatever level of abstraction/portability (SDL, OpenGL, Metal, Vulkan, Unity, ...), you're leveraging zillions of lines of other people's code. The only way arguably you could do it in pure C (with undefined behavior) is in enviroments that let you write straight to graphics framebuffers without any abstraction layer and even w…
> It's impossible to do graphics in pure C, so what are the alternatives? Back in the days of DOS I used to do this all the time :)
Re: Flappy Bird in 1000 lines of C
#34Earlier quoted context omitted.
> It's impossible to do graphics in pure C, so what are the alternatives Plenty of other comments have already disputed this. It's a reasonable mistake to make, especially if your experience is with more recent technologies and languages. All the same if reminds me of this perennial quote from a man who really couldn't just use C for everything; > On two occasions I have been asked, — "Pray, Mr. Babbage, if you put i…
Yes indeed, if the project were targetting a simpler machine without an operating system and windowing system in the way, then doing the whole thing - graphics presentation and all - in a thousand lines of C would be perfectly feasible > I'm acutely aware how it's not turtles all the way down (as the logophiles believe) De Chelonian Mobile
Re: Flappy Bird in 1000 lines of C
#35Re: Flappy Bird in 1000 lines of C
#36Earlier quoted context omitted.
Yes indeed, if the project were targetting a simpler machine without an operating system and windowing system in the way, then doing the whole thing - graphics presentation and all - in a thousand lines of C would be perfectly feasible > I'm acutely aware how it's not turtles all the way down (as the logophiles believe) De Chelonian Mobile
It uses a sprite sheet png file. I am curious how you would target a simpler machine without a bunch of code to display those. I am having trouble picturing this.
Re: Flappy Bird in 1000 lines of C
#37Earlier quoted context omitted.
> It's impossible to do graphics in pure C, so what are the alternatives Plenty of other comments have already disputed this. It's a reasonable mistake to make, especially if your experience is with more recent technologies and languages. All the same if reminds me of this perennial quote from a man who really couldn't just use C for everything; > On two occasions I have been asked, — "Pray, Mr. Babbage, if you put i…
The idiot there is Babbage -- the politician, more well trained in general thinking, clearly observed that thinking-things can correct mistakes against a background of common understanding. eg., "Q. Who is the king of france?", "A. France has no king, did you mean who was the last king of france?"
Re: Flappy Bird in 1000 lines of C
#38Re: Flappy Bird in 1000 lines of C
#39Earlier quoted context omitted.
> It's impossible to do graphics in pure C, so what are the alternatives? Back in the days of DOS I used to do this all the time :)
Didn't you still rely on the DOS HAL (by using system libraries)? The C IDEs came with a lot of graphics util libraries too (e.g. Turbo C).
Borland's dev tools came with "BGI" (Borlands Graphics Interface), but that's not necessary and wasn't really used for many games -- it provides abstract high-level drawing routines, like lines, circles, etc... that can be made to work on different graphics devices (CGA, VGA, ...). This was not necessary for direct graphics card access that most games used.
Re: Flappy Bird in 1000 lines of C
#40I like these challenges, where people rebuild stuff low level and “line efficient” (not saying this is a good idea in general). This makes me curious and I can learn a lot from these examples. I was a bit disappointed though to see that this code used SDL for sprites and more stuff though. That’s not 1000 lines anymore imo. Still the code was an interesting read. Thank you OP
It's impossible to do graphics in pure C, so what are the alternatives? Whatever you do at whatever level of abstraction/portability (SDL, OpenGL, Metal, Vulkan, Unity, ...), you're leveraging zillions of lines of other people's code. The only way arguably you could do it in pure C (with undefined behavior) is in enviroments that let you write straight to graphics framebuffers without any abstraction layer and even w…