Adventurer #15
31 июля 2004

Tutorials - More colours!!! Description packer color video from the demo "Weed".

<b>Tutorials</b> - More colours!!! Description packer color video from the demo
More colours!!!

Poisoned Cyberjack//TriebkraftNE

Trying  to  do  something  impressive for the 'weed', I haven't
expected  such  a good results. A lot of people asked me at the
party  'is it multicolour?'. Meanwhile, it is all that simple -
this   is   just  packed  fullscreen  animation.  Packed  well,
indeed...

Outrage  of  colour,  seen  at the screen, is not the result of
engine's   work,   but   a  correctly  done  original  picture.
Gd//tbk//4d  is  the  one  to  answer  how it could be done, he
rendered it in lightwave 7.5. After that I converted avi files,
using  bmp2scr_1.75  by  LCD.  I  worked  only with the screens
received from such a conversion.

That's  all  I  had  to tell you :). But because of a good mood
I'll speak about the packer itself...

The  demo  features 198 coloured screens, shown within a little
amount  of  time.  This  occupies 1.368.576 bytes in not packed
form.  290k  in zip (hrust does nearly the same). Laser compact
packed  it  takes  a  little  less space, but it still makes no
sense because of huge size. That's why original packer was used
to  compress it all in 80k, i.e. Each screen is about 400 bytes
long!!! And who cares about quality loss :)

Diver//4d  brought  up this idea long time ago in 2001. Why not
combine  hi-res  and  low-res, pixel graphics and attributes in
the  engine itself, to obtain a lot of colour and high speed. I
didn't fulfil it in full scale, still, but it would be a lie to
say that I'm trying to do this from dusk till down.

And now, a bit of history... Two years ago diver came with idea
to  make  a  demo, absolutely unprecendental on speccy. To make
the  hardware  do  its  maximum  without multicolour technique,
everything  have  to  be  done  using  perverse combinations of
low-res and hi-res, attrs and pixels. Don't forget, this is the
main  powerful  feature  of speccy, otherwise it could lose the
other    computers,    released   later   and   having   better
specifications  at  start. Because of averagely high resolution
of  coloured  screen  and  very  high  speed of screen updating
(maybe  not  so, but the size of screen data is small), western
authors  released  games  till  the  middle  of  nineties, when
majority  of the other home computers were almost dead. For now
this  feature  is  practically  out  of use - either people are
working  with  pixels  (vectors,  dots,  chunks  4x4),  or with
attributes, but the same way as with chunks (8x8, various forms
of  multicolour).  The  real combining is never used - it's too
hard to code and the purposes of use are far too specific.

But diver is a keen minded person ;) he invented a lot of ideas
(more  than  a  half of which is unrealisable as I see it ;) we
doesn't  succeed with that demo, being busy with other projects
(harm  demo,  moorhuhn  game),  and  because  of  diver's  army
service...

I  didn't forget those ideas, but there was no time to shape it
out.  And  finally  I  came  to  it  only  this year, making up
detroYt.  There was no effect in the middle, I had an idea, but
was  pressed  by  the  lack of time and there was no memory for
animation.  Thinking  for a while, I found my old chunk engine,
cut everything about real-time calcs, fixed bugs, redone it for
2  colours  and  got  a part with a flying pinions as a result.
Just to mention - 230 screens occupied 22.5k.

Nearly  this  time  in  April  I've  got an idea to do a colour
animation.  But  confronted  with difficulties - it was hard to
make   detroYt's  engine  use  colours,  packing  was  bad  and
decompression  speed was below 5 frames (the threshold we set).
That's why I spit upon all this tortures with chunks depacking,
shit  with  c2p,  and did everything as simple as it could be -
just  compressed  all screens. But, truly saying I used chunks,
therefore something left from the old method...

An  idea  behind  this  mythical engine is simple, although its
perverse.  We  are  building  a  screen  in a chunk buffer (not
dealing  with  screen addressing problems or working with bits)
1x1  or 2x2 (I've chosen this variant as it is optimal by speed
and  amount  of stored data - chunks 2x2 roxx!!!). But it can't
be  done as it is (don't ask me why - its clearly seen), that's
why  I used some tweaking - processed the screen in two passes.
On  the  first  we  are  counting only height's colours - 33x25
chars  grid.  For the massive coloured objects there would be a
lot  (more  than a half) chars, where all four heights have the
same  colour. Such chars c2p fills with this colour and forgets
about it. The rest has to be detailed - we count edges of chars
(2  pixel step in my case), after that we find the needed chunk
(or sprite if its easier to understand), and finally putting it
in  a  char cell on the screen. It's more complex with colour -
but  I  decided  to use colours of first two heights and forget
about it... This is the short explanation of an idea behind the
new  wonderful coloured engine, that is not realised till today
:)))

There  wasn't  time, nor desire to complete it (laziness is the
main  reason :) one thing I did till the end - drawn all chunks
(it  could  be  generated, but 'handmade' is our main principle
:).  The  main problem is the second pass on the chunk screen -
its  too abstruse :((( therefore there is no blasting real-time
in our last demos - just very cool crunching...

How  it  was done in detroYt: at first, depacks the colour grid
for  the  char's  heights,  then, using the four heights of the
char,  the  type  of  the sprite is defined. We got 16 types of
sprites, 2 of it were not drown at all (black filled chars were
instead  of  it :), and the next two are just chars filled with
paper=ink.  12 types left, for everyone of them I have drawn 16
sprites  by  hand.  Number  o sprite (4 bits) is taken from the
packed  data.  I'll not explain what is what :) the screen with
the  sprites  is  applied. If someone is extremely interested -
contact me.

'Weed' features no grid and no sprite definition. We get colour
for every char and the number of sprite, if needed, right after
depacking. I just couldn't understand how to redraw sprites and
took  it  from  the previous product. Because of that there are
163  of them, not 256 :) why not 192? Some are the same, I just
erased it...

Definition  of  type  and sprite number at the packing stage is
simplified too. No attention paid to the char's heights colour,
everything  counts  with the banal moving through all variants.
Sprite,  having  minimal  differences  is the needed one. It is
logical  if  we  are talking about machine logics - human would
choose the form appropriating one...

You  will find two sources in attachment. My_batch - my private
source  designed  to  assemble the demo. It was used exactly in
this  form.  No comments, everything was done specially for our
needs. Colourful - source designed to be understood (as much as
it  could). I wrote comments these days, so not laugh too much.
Also,  do  not pay attention at the awful code - it just works,
that counts. I really didn't know that someone would need it :)

Both  are  in storm assembler format. I don't know how users of
the other asms would convert it - practically it is impossible.
And I just can't write the other way now :(((

Don't be confused by the multiple repeats of some lines in some
places  :)  unwarping  of  the inner loops adversely affect the
amount  and  modification ability of the code, but very good on
readability  and  speed,  simplifies  the  coding at last - and
sometimes I am just running out of registers...

'Check'  procedure is called before packing, it sets the screen
in the state, consumed by the packer - all empty chars coloured
ink=paper.  Due  to  a  distinctive  feature  of  pc  converter
bmp2scr,  completely  filled  chars  are  not being looked for,
because it never happens.

There  is  another trick... In some chars only 1-2 pixels could
be  set.  Fitting  (wisely) sprites are not being found all the
time,  resulting  bugs  on  the  screen. At the moment of party
version  I went through this, adding 2 sprites - one completely
filled,  and  second  -  empty. That not really helped - can be
approved by peculiar people who have seen it. After the party I
wrote  normal optimiser, it just cleans such chars out. 'Optim'
procedure  is  doing  that.  P_min  parameter  sets quantity of
threshold  pixels to clean the char. Checking goes for the less
and  for  the  larger  quantity of pixels (1-2 and 62-63 pix if
p_min=2).  Setting  this  parameter  to 32 turns the picture to
clean attributes. Some people like it that way :)))

'Check'  and  'optim'  are doing overlapping work, but I didn't
correct it.

Also a simple rle packer with the strange logic was used. Block
of  packed  data represents itself as a continuously bit field,
where  commands and arguments are placed. Commands consist of 2
bits, accordingly to that there could be 4 of them:

00  - new colour, 3b - colour code 01 - new sprite, 8b - number
of sprite 10 - chain, 4b - chain length 11 - one filled char

More detailed...

Work  with  colour  is  going  like that - we have two colours,
paper  and  ink.  'New  colour'  command sets new value of ink,
while  paper  becomes equal to an old value of ink. That scheme
proved to be more appropriate and optimal.

Sprite...  Draws sprite with the right number, colour is set by
the current values.

One filled char - ink=paper_current, paper=paper_current, while
current colours are not changing.

Chain  - sequence of filled chars. Length is set by the 4 bits,
that  number  was  chosen by the experimental way, more or less
was found unprofitable.

I  described  the packing algorithm, depacking is the same. All
work  is  going on with structured data, being described above.
It  could be written the other way, I would not be surprised if
it  would  be simplier and faster than my version. We just were
convenient  with  this  work  - speed of compression isn't that
high,  but  there  is  no need to compress something too often,
decompression  is  better - confines in 3 frames, opposingly to
our delay - 5.

Except  of  the  sources,  mentioned  above,  you can find some
screens  for  testing  in  attachment.  And  a  small  program,
demonstrating this method, for those, who haven't seen our demo
:)))

wbw, poisoned cyberjack//triebkraf



Другие статьи номера:

Editorial - elph: предлагая себя...

Editorial - elph: offering myself...

Editorial - alff: перемены это воздух которым мы дышим...

Editorial - alff: Changes... is air...

Editorial - miguel: ...title ..title by myself

Editorial - chasm: Кстати, вы читали правила cc04?

Editorial - создатели журнала.

News - актуальные новости от: Research, Arhon, Gasman, Fatal Snipe, Skrju, ZX Time team, Newart, Elph.

News - actual news from: Research, Arhon, Gasman, Fatal Snipe, Skrju, ZX Time team, Newart, Elph.

News - c-jeff о причинах закрытия музыкального проекта "emphasis".

News - взгляд Moran/CPU на текущее состояние дел в группе СPU.

News - sq: "я включил ZX-Stag, отошeл на несколько метров, сел на колени на ковeр и начал..."

News - sq: news around us.

Scene - Elph'a удивляется появлению Demo работ, не несущих в себе не то что глубин, а хотя бы попыток исследования своих чувств и размышлений.

Scene - Emotional consumerism .

Scene - Бунтующий демосценер.

Scene - Demoscene rebel.

Scene - History of making demo "WeeD".

Scene - отчет Miguel/CPU о CAFe'2003.

Scene - Шшшшш - БУМ! это где это я? аха на CAFe'2003.

Scene - CAFe'2003 report from Chasm.

Scene - отчет буржуя Pyromaniac о поездке на русское пати CAF'e 2003.

Scene - pyromaniac CAF'e 2003 report.

Scene - От пати до пати: репортажи с CAFe'03 и FOReVer 5 и их сравнение.

Scene - from party to party Cafe'03 and FOReVER 5 party reports and comparision.

Scene - отчет о концерте в Варшаве группы AY Riders.

Scene - рассказ Gasman'a о том как он знакомил британских обывателей с демосценой на Notcon 2004.

Scene - Notcon 2004 report from Gasman.

Scene - рассказ о выставка группы GALZA.

Scene - GALZA exhibition 2004.

Scene - Moran затевает графический конкурс черно-белых картинок.

Scene - Dive Into Monolith (GFX compo).

Interface - Реакции Спектрумистов на Adventurer#14: вопросы и ответы.

Interface - Музыка бывает разная. Каждый из нас понимает ее по-своему, у нас разные вкусы...

Interface - AS C-major...

Interface - интервью с рыбинским музыкантом Ahim.

Interface - interview with Ahim.

Interface - Moran/CPU interview.

Interface - интервью с рыбинским кодером и музыкантом Moran/CPU.

Interface - интервью с музыкантом C-jeff.

Interface - c-jeff interview.

Interface - интервью с британским музыкнтом Gasman/Raww.

Interface - Gasman interview.

Interface - интервью с пермским музыкнтом Kej-Jee.

Interface - Kej-Jee interview.

Interface - интервью с рыбинским музыкантом и художником Miguel/CPU.

Interface - Miguel/CPU interview.

Interface - интервью с Alone Coder.

Interface - Alone Coder interview.

Interface - интервью с краснодарским музыкантом Nik-O.

Interface - Nik-O interview.

Interface - интервью с чайковским музыкантом Riskej.

Interface - Riskej/OCA interview.

Interface - Yerzmyey/HPRG interview.

Interface - интервью с польским музыкантом Yerzmyey/HPRG.

Scene - опрос производителей игр "Что вас заставляет делать игры для спектрума в это странное время?"

Interface - gamemakers questionnarie.

Interface - интервью с издателем кассетных игр Cronosoft.

Interface - gaming like it used to be! (cronosoft interview)

Interface - Alex Xor о положеннии дел игровой индустрии на ZX Spectrum.

Interface - Analizing ZX Spectrum games 2003 year.

Interface - elph: "игры, в которые я не играл".

Interface - elph: games, i haven't played.

Interface - moran: "Почему я играю".

Interface - Confessions of a serial gamer.

Reviews - обзор демок 2003 года: Detroyt, Why?, Extazy, Microcosm, Wirne, Alienate, Sailor, The Source, Evenless, Fuck You Scene, Caprize, Resurrection, demo22, Weed, China Restaurant.

Reviews - demo 2003 review: Detroyt, Why?, Extazy, Microcosm, Wirne, Alienate, Sailor, The Source, Evenless, Fuck You Scene, Caprize, Resurrection, demo22, Weed, China Restaurant.

Reviews - История развития игровой индустрии на постсоветском пространстве: 1991-1999 года.

Reviews - История развития игровой индустрии на постсоветском пространстве: 1999-2004 года.

Reviews - Development of exUSSR games (1991-2004 years).

Reviews - Тенденции развития спектрумовской игровой индустрии.

Reviews - Tendencies of ZX Spectrum game industry development.

Tutorials - Больше цвета!!! Описание паковщика цветного видео из демки Weed.

Tutorials - More colours!!! Description packer color video from the demo "Weed".

Tutorials - hewle splines - программ для создания сплайновых кривых.

Tutorials - hewle splines.

Ottyag - ничего.

Software - втоpая веpсия схемы IDE-HDD адаптеpа для ZX Spectrum.

Interface - интервью с пермским музыкантом Siril/4D.

Scene - AY Riders live in Warsaw.


Темы: Игры, Программное обеспечение, Пресса, Аппаратное обеспечение, Сеть, Демосцена, Люди, Программирование

Похожие статьи:
Программистам - Быстрый поиск в текстовом файле.
От автора - В школе каникулы...
Хобби - сочинение сетевиками стихов по мотивам творчества Толкина.
Юмор - новогодние анекдоты.
Чудо техники - Десять байт.

В этот день...   19 апреля