Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

[LEARNING] Well-written open source codebases

Name: Anonymous 2013-02-14 17:59

ITT we post examples of well-written open source codebases to learn or draw inspiration from. Please restrict your suggestions to codebases that you have actually spent some time reading.

I'm fond of reading bits of the earlier, C-based idTech engines, and they're often held up by others in the blogosphere as an example of good C, so they'll be what I'm recommending.

https://github.com/id-Software

This guy has written some pretty detailed code reviews of the engines that serve as excellent high-level introductions before you start peeking in the source, if you'd like to study the techniques used by the engines themselves and not just the structure of their code.

http://fabiensanglard.net/

I'm interested in seeing some recommendations for dynamic languages like Lua. My idea of how to properly structure a program is limited to idiomatic C at the moment, which makes writing Lua programs feel somewhat awkward to me.

Name: Anonymous 2013-02-15 20:50

>>8
The Linux kernel mainline is probably the highest quality open C codebase of its size, anywhere. Unlike the id engines, it wasn't written by people working on a tight deadline and cleaned up later, so it has fewer warts. Its feature set is also large, which gives more insight into solving complex problems than a deliberately limited system like Plan 9. Finally, the kernel sources use many different styles of C programming (looking past superficial things like indentation) so reading them will expose you to more diverse ways of thinking.

Name: Anonymous 2013-02-15 21:28

>>25
Finally, the kernel sources use many different styles of C programming (looking past superficial things like indentation) so reading them will expose you to more diverse ways of thinking.
Could you give some good starting points?

Name: Anonymous 2013-02-15 21:57

>>26
Not >>25-san, but you could try reading the O'Reilly Understanding the Linux Kernel then diving right in, reading whichever part you want (scheduler, device drivers, process management, etc.). That's what I did.

Name: Anonymous 2013-02-15 23:16

few little bits n pieces (all C)
ftp://ftp.ntua.gr/mirror/technotronic/denial/

Name: Anonymous 2013-02-16 2:06

Why not learn some ultra-theoretical pure mathematics and then invent a new form of computing where you then invent a new kind of computer and which then you invent a new kind of programming concept and which then you invent a new kind of language.

Name: Anonymous 2013-02-16 2:17

>>25
Finally, the kernel sources use many different styles of C programming
lol, it's C, how many different styles are there?

Name: Anonymous 2013-02-16 2:26

>>30

A lot more than in seeples.

Name: Anonymous 2013-02-16 2:30

>>29
I did that, but I don't have the billions of Jew dollars I need to put it in silicon.

Name: Anonymous 2013-02-16 2:37

If you want clean C, I'd go with Plan 9. It's very simple and easy to read, but also powerful.

Name: >>25 2013-02-16 6:43

>>26,27
The best way is to just look at parts of the kernel that perform distinctly different functions. There is a lot of complex stuff in the kernel, too much for any one person to understand, so you will find a lot of domain specific variations in style. For instance, arch boot code is usually so utterly procedural that even the C portions read like macro assembly. By contrast, the most complex driver stacks are heavily OO, with plenty of layering to separate logical and physical buses and subdevices.

Name: Anonymous 2013-02-16 19:37

>>9,16
Most game engines are horrible messes of software. In comparison, the id Tech engines are very well designed and consistent. Since most engines are obviously going to be closed source forever, the id Tech engines are possibly the best we have to study.

Perfect example, the guy who did the id Tech code reviews just did one for the Build Engine (Duke Nukem 3D). It did amazing things for its time, but god damn what a hideously designed program it is.

http://fabiensanglard.net/duke3d/index.php
https://github.com/fabiensanglard/chocolate_duke3D

Name: Anonymous 2013-02-16 21:13

>>35
All game engines suck. I checked these "photorealistic" GTA4 videos (http://www.youtube.com/watch?v=rrGfyZxysb4) and they look nothing like photoreal rendering (i.e. no ambient lights or reflections), people do with pathtracing http://www.youtube.com/watch?v=CZ1IRQTqMMY

why wont they attach such renderer to GTA and sell it as pay-for-hour cloud service? I'm sure 8x boards aint that expensive for server side.

Name: Anonymous 2013-02-16 22:03

>>36
I'm making games to run on Android and iOS and really don't care about industry state-of-the-art buzzword compliance, just that it runs smoothly and looks sharp. I think chasing photorealism is silly, because both a technically inferior game with stylish and imaginative artwork or even a graphically minimal one with compelling gameplay is going to get more attention (from non-geeks, at least.)

I recently played one of those ultrarealistic war games on an XBox for the first time, don't know which one, they all look the same to me- and realized, for all the gee-whiz eye candy, this is  still pretty much just CounterStrike. So you can see ripples in all the puddles on the ground. Awesome. Wait, I can go outside and do that. Or, I can play CounterStrike from 12 years ago and get the same gameplay experience.

Name: Anonymous 2013-02-17 14:05

The official Lua implementation is a really high quality ANSI C codebase. The average /prog/rider should be more than capable of digging into it:

~/lua-5.1.5/src$ cloc ./
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
C                               32           2014            742          11081
C/C++ Header                    23            827            793           1506
make                             1             36             12            134
-------------------------------------------------------------------------------
SUM:                            56           2877           1547          12721
-------------------------------------------------------------------------------


LuaJIT is also a fascinating implementation (and probably the program to study if you want to write a fast interpreter/JIT), but all of the platform-specific assembly and whatnot makes it a lot more difficult to comprehend.

Name: Anonymous 2013-02-17 14:10

>>38
It's a particular example of terrible idea but excellent implementation (leading to a shit result).

Name: Anonymous 2013-02-17 14:12

>>39
lemao ebing u tel em ;))))

Name: Anonymous 2013-02-17 14:58

>>40
What? Do you happen to enjoy arrays that start indexing on 1 and Javashit clones?

Name: Anonymous 2013-02-17 17:09

>>41
ahaha u dont know shit about programming!!

Name: Anonymous 2013-02-17 21:46

>>38
cloc
Oh shit, that's vastly superior to
find . \( -name \*.c -o -name \*.h \) -exec cat {} + | wc

Name: Anonymous 2013-02-18 7:48

>>43
Just found it the other day myself. Pretty damn useful.

Name: Anonymous 2013-02-20 0:45

bampu pantsu.

Name: Anonymous 2013-09-01 13:52



     _ ,ヘ_,. --──- 、    /  /   | ``
   く `ヽゝ!_,..--─- 、 ヽ、 / /     !__ノ
   ,.'くゝィ'´    ,  、 ヽ、ヽ.          つ
  ,'  !/  /  ハ  ハ_, ! ', !       十
  i  ,' , /!ゝ、! L.!rト!_ハ_」」   i  ヽ,  └‐、
  !.  Lハ_!イr_,j  └' ! |    レ     --'
  .! i ! ! "  ,.-‐、 .从|      つ    や
   ヽハヘハヽ、 !___ノイ/     -─ァ   _i_  、、    
     , '⌒ヽ!ヘ}><{`ヽ  、    (_ .  | `!ヽ
    !  ___,.〉 Y !_r〉      十___   ' _ノ
    /ヘr'´ ヽ. ! ,イ |   \  / 、___

Name: Anonymous 2013-09-01 15:23



              ,..::'"´ ̄ ̄`ヽ、           /   誰
             /::::::::::::::::`:::、::::::ハ           /    ぞ
           .,:':、::::::::::::::::::::::::::::\:::|          |     :
          /::::::\::::::::::::::_;;;;::::-┤            |     :
          /ー==ニ,>─-、___:::::__|           '、     :
       ,. -- '/`ヾ´      \ `ヽ::!          \
      /   /    \       ヽ  Y⌒ヽ-===- 、   ` ̄ ̄ ̄
    /    {    .ト、_`ニ.、    ,  ハ   ∨    l|    ,. -──
     {   /  |ト 、  |'´ ん「ハY   | ;   ';\  ';    /   /    .我
    ゝ |.  T__ \ | 弋_zソハ   | |  | | `''┼====-、   ふ・ が
     .ソ|  |「lハ ヽ|   ´ "" } ,ハ |  | |.   |  l|    l」.  と.・
    < ;   八.り ,      ノ,イ レ'   ' ;   |  ||   .|    い・
      ∠.,,_イ |    , - 、    ./ |  | ./ /   |  l」    |   と
        |人   '、 _) /  / // , '     |      |   申
      ∠、 > 、   / __イ./´ /,'     |      |   し
        { / /` ー 个´, -‐ `ヽ'  / ,    ;        |    た
        ∨レ'   _r//      \' /|  ./      '、   か
         ,. -===r':::7´        ∨ ;  ,.'          \
       / |    く::/{          ト、/           ` ̄ ̄
      l|   、  `7  、          、 \
      l|   \r'::}   |ト、            \
       l」    `7   .|| \           'ヽ、
           /   /  /:::ム、_,,.. -─ 、   }  ';
          ./   {{  {/          ,イ   }
          /   __,.> ´             , ' |  /
        / _r「 l」             /  |/
       / /´ | | r               /
     ,rヘ/   | | l」              /
     /  {/  __| |  _            /、
    ;   し'´ ヽヽ | |          ./::::ヽ
     |      | ト、\          /:::::::::::\

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List