pouët.net

Go to bottom

Help with 4k

category: offtopic [glöplog]
Hi guys,

I'm trying to put together a 4k intro (it's my first prod). It uses IQ's OpenGL framework + GNU rocket + 4klang. It's actually going pretty good as long as I ignore the 4096 bytes limitation :)

I'm pretty OK with the 3D development aspect, but I'm in a little trouble making it compact (I'm probably 1000-1400 bytes over).
It would be really cool if someone feels like giving me a helping hand with the size issue...

If you feel like helping, google talk me. user: ed-ore-shef-at-gma-il-dot-c-om (remove dashes)

Thanks..
added on the 2013-01-04 23:28:39 by TLM TLM
Looking at your, stack mayb something like Crinkler could help?

Good luck on your journey <3
added on the 2013-01-04 23:36:18 by mog mog
mog,
I wish it was that simple - I'm already using crinkler :(

thanks anyway
added on the 2013-01-04 23:41:04 by TLM TLM
So I guess you tried shrinking Strings like models, greetings and everything else beyond readability as well? Bet you did, so maybe approximate instead of writing good good code?

Darn, I'd wish I could actually help you :\
added on the 2013-01-04 23:53:04 by mog mog
Maybe use shader minifier if you haven't done so already?

~1k over is a lot. How do you store your data?
added on the 2013-01-04 23:54:17 by Preacher Preacher
while gnu rocket is awesome tool it may not be very good for 4k. usually it is better idea to try to be more creative with the synchro instead of using keyframe based sync data.

some hints: time everything as beats not as milliseconds. try to find patterns in the song - usually thing happen on every 8 / 16 / 32 beat. i usually store only major features of the song (=part/fx) as keyframes. all of the other sync i do is based on some patterns in the song or 4klang sync features.

in4k.untergrund.net contains some nice general tips and tricks. also reading the provided source code from open sourced 4ks might help.

one thing that really helps is to set yourself a deadline. do something during that and release it as your firstie and use that experience to improve your next release.

added on the 2013-01-04 23:55:11 by rale rale
in4k.untergrund.net seems down :(
added on the 2013-01-05 00:00:42 by vectory vectory
Preacher, yep, shader minifier is used (for now with "--no-renaming --no-sequence" flags that I will be removed towards the end).

Regarding your question, there is not a lot of data, most of the content is run time generate (generating code is probably around 300-450 bytes).

I think things started to go out of control when I started working with FBO to have post processing effects (bloom etc) - there must be a simpler way to do those...

rale:
first, I guess you're right about the gnu rocket :(
second, I'll look into in4k, thanks.

Few questions:
1. I'm using visual studio 2010, is there should be a diffrent between the VS versions?
2. In the 4klang there are those "#pragma code_seg(".initsnd")", do those help compression?
3. I'm currently using the default 4klang sample song, it's size is around 1.4kb, is this song is considered big or small?
4. on avaerage, what should be the balance between the size of the diffrent parts of the intro (code, shader, music and other data)
5. how do I size optimize? do you just dig into the map files?
added on the 2013-01-05 00:13:46 by TLM TLM
> 1. I'm using visual studio 2010, is there should be a diffrent between
> the VS versions?
yes but nothing major. i have used msvc6 and 2008 but '10 should be fine

> 2. In the 4klang there are those "#pragma code_seg(".initsnd")", do
> those help compression?
yes. read crinkler manual - those are mentioned there. but it does not really help you that much..

> 3. I'm currently using the default 4klang sample song, it's size is
> around 1.4kb, is this song is considered big or small?
you should not be size optimizing if you do not have the final content. artists can pretty much do any sized songs as long if you can get them to live with less instruments - you will have to figure out how much space you can leave for the artists. the default song is good for reference and starting point..

> 4. on avaerage, what should be the balance between the size of the
> diffrent parts of the intro (code, shader, music and other data)
all parts < 4kb :P .. it depends on what you think you will give you best benefit when the intro is live on the big screen. this is something that you will master with time. i think it is impossible to answer this

> 5. how do I size optimize? do you just dig into the map files?
this is how you learn how: set crinkler settings to fast compression - move stuff around, compile and see how the exe shrinks or grows. this is good hands on way to get idea how it is done :)
added on the 2013-01-05 00:34:27 by rale rale
Crinkler can output you diagnostics of which section compresses best/worst. I don't remember the switch anymore but it's there in the dox.
added on the 2013-01-05 01:55:24 by Gargaj Gargaj
Of course it all depends if you want to do more noise than flashing the audience or viceversa, but in general a good starting point would be:

* 1 kilobyte for the framework (windowing, gl setup, sound system setup, render loop, ESC KEY PLEASE, etc),
* 1 kilobyte for the music,
* 1 kilobyte for the visuas/effects/rendering,
* 1 kilobyte for the scripting/choreography.

I tend to underestimate the painful truth of the 1k choreography/scripting, and it always bites me back right in my ass the week before the deadline.

1.4 kilobytes can be easy to optimize away, but also 14 bytes can be a pain to optiize away, it depends how far you are in the "ok, now lets be clever and get this thing to fit" process. There are SO Many tricks you can do to optimize things. It's basically impossible to help much without actually seeing the code, or getting a detailed description of how you are doing things.
added on the 2013-01-05 03:01:43 by iq iq
When doing my first modern 4k, I stumbled on a 4klang 3.0 bug, which prevented me from having any non-trivial modulations in the song. After the party I studied this some more and was able to fix the bug, see this thread http://www.pouet.net/topic.php?which=8811.

I tried to report the bug to the authors, but haven't heard anything, and the version on the untergrund site seems to be the same.
added on the 2013-01-05 04:10:20 by yzi yzi
rale:
Quote:
you should not be size optimizing if you do not have the final content
I guess that's the first lesson I should have learned, I'm still not in this point. Since this is my first 4k, I'm still unsure how much code and scripting can I squeeze in. I'm pretty clueless here... :) The idea of just code away and worry about size at the end is very tempting, but I'm afraid I'll carried away with my expectations...

iq: when you say "1k for music", does this include the synth?

yzi & Gargaj: Thanks for the tips.
added on the 2013-01-05 08:13:00 by TLM TLM
Quote:
you should not be size optimizing if you do not have the final content

My experience is usually the opposite: You don't know what the final content is until you are done size optimizing. You never know exactly how much you have space for until you have tried. Better to aim a little too high and then cut away the least essential feature than to produce a 3.9k intro that could have been better. ;)

For the big size reductions, experiment with your data layout. If you have a long list of interleaved items of different kinds, try separating them into multiple lists - one for each kind of item. That is sometimes smaller.

A few Crinkler tips:
- Use the /REPORT option to see what takes up the space and how well it compresses.
- Define your own entry point (using the /ENTRY option).
- Read the manual. Try every option. :)
added on the 2013-01-06 19:11:26 by Blueberry Blueberry
one thing noone mentioned so far:
dont use precompiled shaders.
better approach is to put the shader-code as an ascii-array into the project, then compile shaders at runtime. (there are functions to do so, no idea about GLSL, doing DirectX here, but google should help) ASCII crinklers away way better than precompiled bytecode.
Also dont forget to minify your shader-code ("n" instead of "normal" as a variable name f.e. ...you can use shader-minifier, i personally prefer doing that by hand), before you havent done so, you cant get any clue of the final filesize anyway.
(just keep an unminified-version of the shader-code in a seperate file if that helps you with readability and working on the project.)
the obfuskation of the shader-code is still yielding the biggest jumps in filesize here ;)
Quote:

> 1. I'm using visual studio 2010, is there should be a diffrent between
> the VS versions?
yes but nothing major. i have used msvc6 and 2008 but '10 should be fine

Using the Pro vs. the Express version compiler (and/or linker?) DOES make a difference! I noticed that here on a commercial project and VS2008/2010. The Express-compiled version was a lot bigger...
added on the 2013-01-07 11:04:13 by raer raer
raer: Not that I know anything specific about this since I never used express, but were both compilers on the same patch level? I remember that e.g. MFC applications made with vanilla VS2008 were a lot smaller than VS2008 SP1 applications because they restructured some code (to the worse). Of course MFC isn't available with the Express version, but things like that could also cause a size jump.
I have been able to create 1k and 4k intros with VS 2010 Express. I tried a friend's intro source and was able to produce an end result that was 1 byte smaller than he did with an older Pro VS version. If I recall correctly. Anyway, I say that the Express version is just fine. You do not need to buy the full version or use warez.
added on the 2013-01-07 14:37:48 by yzi yzi
Would it make sense to push your code to a private Github account (or similar), give some of the experts access to it, and let them comment what they see here, so we all learn?

I don't have experience with 4kb executables so I can't help much, but I'm sure understanding what Crinkler compress better could help. Working with compressors can be a bit counter-intuitive, and some times hand-size-optimized code can be bigger than longer code that is better suited for the concrete compressor (like, maybe, longer code that results in repeated patterns on it).
added on the 2013-01-07 15:02:25 by texel texel
I wasn't saying that it makes a difference for 1k/4k. We have a multi-megabyte application here. The two can produce different code though...
added on the 2013-01-07 16:50:17 by raer raer
Not both were VS2008 non-SP1 afair.
added on the 2013-01-07 16:51:21 by raer raer
Guys, thanks the tips.
At first I thought I might have asked this question a little too early as I'm the middle of the implementation phase, but I'm happy that I'm getting your feedbacks and able to implement things right from the first time.
Thanks!
added on the 2013-01-07 23:06:00 by TLM TLM
no prob, dude!
just present us with some kickass-4k once done with Declaration!
forget about the "kickass", just make a 4k for now. we´ll give you further instructions in the comments to the prod then :) constructive thumb-downing ;)
TLM,

did you get something finished?

I'm also _trying_ to use Gnu Rocket with 4klang. I partly succeeded already, but am unable to pause and play from certain point (needed for the sync-handles). TLM, which methods you call from 4klang-object?

Thanks,
oo
added on the 2013-08-08 11:48:20 by oo oo

login

Go to top