pouët.net

Go to bottom

how to decrease size of 4kb intro

category: code [glöplog]
Even if I never published any 4k, for a 256bytes nd a 64k I used overlapping floats. The trick is similar to the one cited above, http://tmd.freeshell.org/floats.h, but it consists in defining overlapping constants in memory, where the 16 lsb of a float constant are actually the 16 msb (sign, exponent and 7 bits of mantissa).
For meshes, they weren't THAT fucked up...
added on the 2009-08-29 16:24:08 by pan pan
Quote:
Speaking of what, nobody ready to make a serius stable and advanced offuscator and release it as demotool (a good one I mean which does tricks like the smoothstep one)?

Done.
http://pouet.net/prod.php?which=55176

If you have other tricks to share, I will be happy to add them in the tool!
(adding rewrite rules on the AST is very easy)
added on the 2010-06-15 23:42:15 by LLB LLB
just what i do normally is:
i check which function/variable gets called most often and name that one x/x()
second-most y etc...
as one very often uses variable.x and stuff.
so xyz is very common in shadercode !
also dont use .rgba, use .xyzw instead !
Quote:
i check which function/variable gets called most often and name that one x/x()

that works with shaders only.
added on the 2010-06-16 04:17:43 by xernobyl xernobyl
and javascript!
added on the 2010-06-16 08:20:37 by skrebbel skrebbel
just added some answers in that prod-page i think ppl should be aware of:

also i might add that no software ever was able to replace any human being !
4ks are humans prods made by humans and stripped down to few of bytes by humans !
DONNOT rely on software if you wanna obtain full control of what is going on ! ;)
added on the 2010-06-17 by hArDy./tRSi [hArDy./tRSi]
what i wanted to say is:
making 4ks is fun for coders, so dont spoil any fun by using any software, just do it by hand !
its worth the effort ! :D ( also you´ll teach yourself how to code your next 4k in a better way everytime you go through any stripdown-phase ! )
if you do 4ks you are seriously doing major-demoscenish stuff so dont cut yourself by taking the easy road !
added on the 2010-06-17 by hArDy./tRSi

SORRY, LLB ! good job and stuff but i guess most of the 4k-coders will rely on their own way: looking deep into their code and rename functions/variables in their ways how they think crinkler will work with em !
theres sth i made like onehundred of bytes with once:

i exchanged all the stuff to a, aa, aaa, aaaa, aaaaa, aaaaaa, etc !
unreadable forever but gives bytes ! so this is sth your tool could make it worth !
use X instead of A tho :p
also report here what it brought once implemented ;)
Quote:
also i might add that no software ever was able to replace any human being !
The tool is not designed to replace a human, but help him. Coders should write their code *cleverly*, pack it with a tool, check the generated code and try to improve it (that's why my tool generates indented code). I personaly don't consider that removing spaces is a fun job, people should focus on clever optimizations.

Quote:
so dont cut yourself by taking the easy road !
Is using Crinkler the easy road? Is using a C/C++ compiler the easy road?

Quote:
i exchanged all the stuff to a, aa, aaa, aaaa, aaaaa, aaaaaa, etc !
Thanks! I'll give it a try.
added on the 2010-06-17 08:56:17 by LLB LLB
I read somewhere that "crinkler does not cope well with large blocks of data". Better check with mentor and blueberry if such a "hack" would lead do smaller compressed code.
added on the 2010-06-17 10:23:27 by xTr1m xTr1m
why bother the helpers all the time ?
if i know its working you can easily redo it and see for yourself !
LLB: i know you are a helper aswell and i see you are doing your best ! thanx for that, eventho i wont use your util ! you made some points: using 4klang/crinkler is the easy road, but i think Rune L. H. Stubbe (Mentor/TBC) and Aske Simon Christensen (Blueberry/Loonies) made the job of doing an own packer/cruncher some idiotic task ! they invented/coded the best solution already and its working bugless/flawless and so on !
also 4klang is way more than it appears at first, i used it as one of the first, when gopher/alcatraz himself still released intros without using 4klang while he had some working versions already !
all i can say is: 4klang is an ingenious tool to make music for 4ks , i wouldnt be able to redo it in that way on only my own !
so ofcoz we rely on stuff did by others: protracker wasnt recoded by every scener aswell, altho every1 used it until the end, same is about "titanicscruncher decrunches while loading!" ( you see what i did here ! )
you know coding is a task taking way longer than drawing/composing, even if those jobs can take up to a month per piece aswell ! ;)
For the aaaa trick, I did try this with my shaderstrip but It was worse with crinkler than affecting single letter variable... so you should better check it every time you want to use it.

One reason that "crinkler does not cope well with large blocks of data" is for a code size optimization reason in crinkler decompressor. crinkler use a byte value to store probability counter (n0: number of expected bit "0", n1 number of expected bit "1"), so 2 bytes one for n0, one for n1... but this byte value is not limited when it reaches its maximum (255)... if next probability is rising this value, the counter will drop from 255 to 0. It's like having probability counters reseted every 256 consecutive bit of the same value. Meaning that if you have the byte "00" followed by 256/8 (32) "00", the probability for "00" followed by a bit at "0" will somewhat drop from .9999 to .0001 every 256 bit... Hopefully, this is not as dramatic as this, because different crinkler models will not hopefully drop from .9999 to .0001 at the same time, meaning that it will not reset completely other probability for larger history sequence like "0000" followwed by "0".

Moreover, the problem for repeating letter blocks is that It will screw up other probability : for example, let's say you have the sequence "a(" that is relevant in 80% of your code, and the sequence "aa(" that is relevant for 1% of your code, this "aa(" will hurt the probability of the "a(" sequence. At least the n0/n1 counter will be divide by 2, meaning that the probability for "a" followed by ")" can exponentially drop from .9999 to .0001 with "false pattern matching"...

Apart from that, I do agree with LLB, such tool are great to help with bored things like "space", and to respond to hArDy, at least for LLB, he didn't choose the easy way while developing a full glsl parser and AST optimizer... ;)
added on the 2010-06-17 11:02:23 by xoofx xoofx
(^just a note, when I say dropping from .9999 to .0001 its not as dramatic as this... more something like dropping from .9999 to .333)
added on the 2010-06-17 11:15:47 by xoofx xoofx
x is $78 in ascii-table !
if you just use the 26 small-letters ofcoz crinkler has a more easy job !
never use any BIG letters or sth ...itll stay at most 26 + the ten chars for numbers 0-9 !
Though it depends on the algorithm: Get a clue about compression...
added on the 2010-06-17 11:59:23 by raer raer
use md5
added on the 2010-06-17 18:18:50 by abductee abductee

login

Go to top