Live data from Hacker News

Flappy Bird in 1000 lines of C

github.com

1–10 of 59 posts

Re: Flappy Bird in 1000 lines of C

#3
I 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

Re: Flappy Bird in 1000 lines of C

#5

I 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 when you can't do keyboard or mouse input in C without library and/or kernel support.

Re: Flappy Bird in 1000 lines of C

#6
post #4

It uses SDL. Not saying that's good or bad, but it's the first thing I wondered about.

Yeah, it still seems like a reasonable choice if you're going to write a simple game in C.

I’d imagine it will remain a reasonable choice for quite some time since it’s just a bunch of primitive operations.

Re: Flappy Bird in 1000 lines of C

#7
post #5

I 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…

I wonder what the smallest assembly implementation would look like to provide the minimal graphics API necessary.

Re: Flappy Bird in 1000 lines of C

#8

I 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

You might also like “Cramming Solitaire onto a Nintendo E-Reader card” https://mattgreer.dev/blog/cramming-solitaire-onto-a-nintend...

Discussed lately on HN: https://news.ycombinator.com/item?id=42010136

Re: Flappy Bird in 1000 lines of C

#9
post #5

I 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…

> 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 :)

Post reply on HN