How many lines of code are there in a typical Two Tribes game? Let's find out!

Two Tribes Code Statistics

Lately I’ve seen some developers share code statistics; e.g., Unity, Prison Architect and Ronimo. I thought I would do the same for our games at Two Tribes. Let’s start with something all of our games share: our proprietary in-house cross-platform engine and library. We don’t have a name for our engine, but we call the whole collection TTDev.

Our games usually also use some third party libraries which are not included in this count. The engine runs on Windows, Mac OS X, Linux, Wii U, PS4 and iOS. In the past it also supported the Nintendo DS, DSi and Wii, but we removed those because we’re no longer making games for those platforms. For those of you familiar with those platforms, yes we supported the DS, PC and Wii at the same time. These platforms are quite different. For example, on DS you use fixed point numbers instead of floats and the Wii GPU had its own way to do shading. Still we managed to keep most of our code shared between all platforms.

Engine + Libraries = TTDev

Number of files:1,478
Total Lines:319,611
Code Lines:219,635
Comment Lines:35,616
Blank Lines:64,360
Total Size:9.40 MiB (9,859,647 bytes)
Average lines per file:216.25
Percentage comments:11.14%
Percentage blank lines:20.14%

Language files blank comment code
C/C++ 594 41545 21877 160374
C/C++ Header 857 20865 11763 53941
Objective C++ 27 1950 1976 5320
Total 1478 64360 35616 219635

On to the games! Let’s start with our newest game: Toki Tori 2+

Toki Tori 2+

Number of files:567
Total Lines:141,427
Code Lines:96,027
Comment Lines:17,550
Blank Lines:27,850
Total Size:4.37 MiB (4,584,476 bytes)
Average lines per file:249.43
Percentage comments:12.41%
Percentage blank lines:19.69%

Language files blank comment code
C/C++ 256 19643 13975 71328
C/C++ Header 308 8178 3569 24560
Objective C++ 2 29 6 137
Total 567 27850 17550 96027

With Toki Tori 2+ we moved a lot of our game logic to script. (We used the Squirrel language for this.) Here are the stats for that:

Toki Tori 2+ Squirrel Script

Number of files:294
Total Lines:37,793
Code Lines:29,293
Comment Lines:2,106
Blank Lines:6,394
Total Size:883.53 KiB (904,737 bytes)
Average lines per file:128.55
Percentage comments:5.57%
Percentage blank lines:16.92%

Language files blank comment code
Squirrel .nut 294 6394 2106 29293

And finally the statistics for our classics (Toki Tori, EDGE and RUSH) which we’ll be releasing for Wii U soon. (Toki Tori is already available.)

Toki Tori

Number of files:246
Total Lines:63,949
Code Lines:40,323
Comment Lines:11,033
Blank Lines:12,593
Total Size:1.70 MiB (1,777,846 bytes)
Average lines per file:259.96
Percentage comments:17.25%
Percentage blank lines:19.69%

Language files blank comment code
C/C++ 113 9195 9701 31853
C/C++ Header 128 3173 1261 7714
Objective C++ 5 225 71 756
Total 246 12593 11033 40323


Number of files:169
Total Lines:41,903
Code Lines:28,475
Comment Lines:5,547
Blank Lines:7,881
Total Size:1.20 MiB (1,256,978 bytes)
Average lines per file:247.95
Percentage comments:13.24%
Percentage blank lines:18.81%

Language files blank comment code
C/C++ 78 5652 4925 22911
C/C++ Header 88 2116 598 5138
Objective C++ 3 113 24 426
Total 169 7881 5547 28475


Number of files:363
Total Lines:80,653
Code Lines:50,989
Comment Lines:13,677
Blank Lines:15,987
Total Size:2.17 MiB (2,278,513 bytes)
Average lines per file:222.18
Percentage comments:16.96%
Percentage blank lines:19.82%

Language files blank comment code
C/C++ 178 11835 12632 40492
C/C++ Header 182 4026 1021 10044
Objective C++ 3 126 24 453
Total 363 15987 13677 50989

Unfortunately I don’t have the statistics for our older games. I remember Worms: Open Warfare 2 having over 250K lines (game + engine), but that’s all I have.

And there you have it. Some, hopefully interesting, code stats from some of our games.

Eelke, Tuesday November 12 2013