4kb's and line codes

category: general [glöplog]
I'm curious. How long are your 4kb's, in lines of code?
added on the 2009-03-19 21:02:43 by xernobyl xernobyl
It's all about how good your code packs, but it's not that many lines. Keep it simple, keep it real.
added on the 2009-03-19 21:06:36 by quisten quisten
it depends on your coding style. you can easily format it to be just one single line...
added on the 2009-03-19 21:32:37 by pohar pohar
...fine, how many ; of code.
added on the 2009-03-19 22:16:40 by xernobyl xernobyl
Syntax error in Line 1.
added on the 2009-03-19 22:32:43 by raer raer
xernobyl: I tried to tell you that the relevance of code lines and size of executable doesn't matter. Partly because you'll end up spending some space on data.

But still, you can have quite a few k.
added on the 2009-03-19 22:55:31 by quisten quisten
someone just realized that the less there is space the less there is code, and why 4k coding is so trendy nowadays :p
added on the 2009-03-19 23:08:53 by nystep nystep
The reason I'm asking is that I was having a discusion about code complexity and the amount of code you need to have something on the screen. I pretty much know how code compression works. Not compression, but I suck at math :)
added on the 2009-03-19 23:12:36 by xernobyl xernobyl
Well, i guess the question then is, what do you want to see on the screen :) then for a specific scene, we can discuss the technic that is the most straightforward to acheive the visual result..

raytracing related technics are quite interresting, as you can render scenes of a relativelly non-boring complexity in very few bytes of code/shadercode.
added on the 2009-03-19 23:21:01 by nystep nystep
I know the reason there are a lot of 4kbs nowadays is because they're easier to make with the resources available and until very recently any kind of shit was easily accepted just because it's tiny.
added on the 2009-03-19 23:44:42 by xernobyl xernobyl
I certainly wouldn't say easier, but your definition of "easy" here is very important. Sure, any doorknob can get an exe down to 4k but expectations for quality are MUCH much higher than they used to be. So it's much less a matter of that you got it that small and more of how intelligently you used your space.

All in all I'm saying it's not necessarily easier, just different.
added on the 2009-03-20 00:05:58 by ferris ferris
And to answer your question, around 1200 or so lines in my current project and counting ;)
added on the 2009-03-20 00:08:40 by ferris ferris
it's alot more fun (just ask spookysys :) and challenging.
added on the 2009-03-20 00:11:06 by quisten quisten
it's alot more fun (just ask spookysys :) and challenging.
added on the 2009-03-20 00:11:06 by quisten quisten
Agreed :) Much more time is spent getting it to fit and more spent on actual content...at least imo
added on the 2009-03-20 00:13:28 by ferris ferris
My last demo (Stripped by Rebels) has 404 + 323 (gfx + synth with music) lines of code. Some code parts are totally commented out, but they are not that large. Code contains a lot of comments. Sample piece of code:
Code: // Returns currently playing note volume (channel number is negative, starting from -1) float GetNote ( char channel ) { for ( int rowNum = g_timeNorm, i = 0; rowNum >= 0 && i < 16; rowNum--, i++ ) { g_patternNo = ( rowNum >> 4 ); g_patternRowNo = ( rowNum & 0xF ); if ( GetFixedOrStreamValue ( channel ) ) return 1.0f / ( 1.0f + (g_time - rowNum*ROW_LEN_SEC)*10.0f ); } return 0; } // GetNote
added on the 2009-03-20 07:26:56 by stan_1901 stan_1901
clue: comments don't COUNT :D
added on the 2009-03-20 07:39:14 by quisten quisten
I think the reasons for the increased popularity of 4k's are obvious:

1) No need for a big team (usually), the coder can play around much more and there is less red tape.
2) The good-ol' challenge-element. It's always more fun to do something challenging than something easy (if you're a coder)
added on the 2009-03-20 08:28:58 by gloom gloom
i dont think lines of code is a good measure or guideline anyway.
it would be more interesting to compare uncompressed compiled code/data size plus their compression rates.
added on the 2009-03-20 10:53:25 by gopher gopher
no one implied that LOC is a measure of anything. answer the question or gtfo.
added on the 2009-03-20 11:07:09 by grusbanan grusbanan
... relax grusbanan, relax

added on the 2009-03-20 11:41:58 by gopher gopher
10kb of shader code, ran through a custom tool to make it 4kb big, and through crinkler crunched it down to 1,3kb. Are lines of code still worth mentioning? :) Look out for a shader battle in BP :)
added on the 2009-03-20 12:16:39 by xTr1m xTr1m
since we're on it:
what's usually smaller when compressed? GLSL or ARB asm shaders?
added on the 2009-03-20 14:38:22 by xernobyl xernobyl
My experience tells me that ASCII compresses better (~33%) than bytecode (~55%)
added on the 2009-03-20 15:16:49 by xTr1m xTr1m