pouët.net

Chromatic Distortion by Resource [web] & Logicoma [web]

chromatic distortion 

another 4K intro for the Plus/4

by resource + logicoma

credits:

oswald         - code (effects, cordic implementation, texture generation, possibly other stuff)
edhellon       - code (eveything else)
h0ffman        - music and "stream" music player
poison         - script, palettes, design
ferris         - packer (custom build of admiral p4kbar)

thanks:

tobylobster    - fast sqrt https://github.com/TobyLobster/sqrt_test/blob/main/sqrt/sqrt1.a
cordic authors - atan2 and sinus algo https://www.eit.lth.se/fileadmin/eit/courses/eitf35/2017/CORDIC_For_Dummies.pdf
murphy         - original screen reduction prototype code
bubis          - original zoom4 routine
jiminy	       - "smallest I can" font which we shamelessly took, expanded to 2x2 and added a drop shadow.
lman           - much needed nudge to take the time off from other projects to actually do this

random notes from a very tired coder

After "chromatic admiration" I was sure we had to continue our journey on the Plus/4. This time
I really wanted to start in time and actually had started with the first timing prototypes already
in last October as it was clear this time we want to go for zoom4 and a "widescreen" feeling.

Then of course nothing happened until roughly one month before Revision, due to various things but
mainly due to both Oswald and me being heavily preoccupied with another project that should see 
the light of day soon hopefully.

Of course we reused quite some tech from last year's 4K like the stream music player or the cordic
algorithm, although this time we went all in and even the sine tables are generated by cordic.

The depack and precalc time in the end came to be slightly more than 50 seconds, which is long,
until you consider how much data is generated and how much math is used from atan2 to sqrt. There
was a version which actually needed 24 bit precision but we realised about 4 days ago that the 
effect which needed this precision won't fit in so we can go with 16 bit precision everywhere. The
24 bit version originally was almost 2 minutes of precalc time which we felt was too much and a lot
of code was written to exploit symmetries in the data (which is not as trivial as it sounds) only
to throw it away later. I don't think we ever did a project with so many dead ends and code that
was thrown away. When we seriously started on the intro about one month before Revision we envisioned
a completely different tech and effects. We even had (somewhat) working prototypes but realised about
3 weeks ago that we simply won't make it in time so we quickly came up with a plan B to use various 
distortion maps (hence the name) and salvaged some of the math stuff we already had in place. We worked
reasoably quickly but various setbacks and dead ends meant the scripting support was only fully ready
around Wednesday. H0ffman also delivered the final version of the tune on Wednesday, but unfortunately
it was roughly 200 bytes larger (packed) than the version a day ago and we decided to run with the earlier,
less polished version. We even had to ditch support for on the fly texture generation (even though it was
absolutely functional) because it needed about 40 bytes packed and Poison thought the 8 texture slots we
had memory for (each texture is stored for both nibbles and repeated so one texture costs us 2 kbytes - but
generated just from a 7 byte description at startup). The script actually takes quite some bytes (and took
quite some time to write) but compared to our previous 4K it's a lot more flexible. Oh, we also rewrote
the script "engine" twice in the hope of saving some bytes but the original implementation turned out to
take the smallest amount of bytes, which given the regularity of the rewritten versions is rather surprising.

We actually had a version of the intro which was around 4040 bytes and feature complete apart from the script
which was only finished on Saturday. Once that was included it unfortunately pushed the size to over 4200 bytes
so basically we spent Saturday afternoon frantically shaving bytes. Luckily we stumbled on some significant
savings very quickly, but the last few bytes seemed to take forever to get and in the end we got a bit lucky
that it even went slightly below the 4096 byte limit.

Time to pack this up and upload the entry and rejoin the party - back in the E-WERK!

See you soon!

- edhellon

final words

It was much more rushed and hectic then our previous effort on the Plus/4 but that's life I guess.

Poison says "meet you at Arok!"

Resource and Logicomacorp signing off.