1. snow!
--------------C0EE317E73B4FB096C260BC3
It doesn't snow very often here, on the rainy west coast of Canada, so I
decided to make some of my own. Please, if you see anything that could
be improved, mention it!
It looks pretty good on my p400, 64mb ram. Change the variable "delay"
in the Delay() procedure accordingly.
Regards,
Greg Phillips
--------------C0EE317E73B4FB096C260BC3
name="snow.ex"
2. Re: snow!
Hey Greg
I liked your snow
I speeded it up so that it looked like rain. I'm from the West Coast too,
and it kind of looks like what's outside
I noticed that the snow piled up higher than the mean on the right edge, and
lower than the mean on the left edge, but that most of the screen has a
random distribution. Do you have a bit of wind happening?
Bye
Martin Hunt
simulat at intergate.bc.ca
----- Original Message -----
From: Greg Phillips <i.shoot at REDNECKS.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Saturday, December 18, 1999 12:35 AM
Subject: snow!
> It doesn't snow very often here, on the rainy west coast of Canada, so I
> decided to make some of my own. Please, if you see anything that could
> be improved, mention it!
>
> It looks pretty good on my p400, 64mb ram. Change the variable "delay"
> in the Delay() procedure accordingly.
>
> Regards,
> Greg Phillips
>
3. Re: snow!
simulat wrote:
> Hey Greg
> I liked your snow
Thanks!
> I speeded it up so that it looked like rain. I'm from the West Coast too,
> and it kind of looks like what's outside
My back yard is a giant mud puddle =)
> I noticed that the snow piled up higher than the mean on the right edge, and
> lower than the mean on the left edge, but that most of the screen has a
> random distribution. Do you have a bit of wind happening?
Strange! I get an even distribution on my new machine, and on my 120, the snow
piles up a lot more on the left and right, leaving the middle with less snow.
Must be an issue with rand(), I guess.
> Bye
> Martin Hunt
>
> simulat at intergate.bc.ca
> http://www.intergate.bc.ca/personal/simulat/Index.html
>
Greg Phillips
4. Re: snow!
From: simulat <simulat at INTERGATE.BC.CA>
> Hey Greg
> I liked your snow...
>
> I noticed that the snow piled up higher than the mean on the right edge,
and
> lower than the mean on the left edge, but that most of the screen has a
> random distribution. Do you have a bit of wind happening?
Your monitor is not level.
Irv
5. Re: snow!
>
> > Hey Greg
> > I liked your snow...
> >
> > I noticed that the snow piled up higher than the mean on the right edge,
> and
> > lower than the mean on the left edge, but that most of the screen has a
> > random distribution. Do you have a bit of wind happening?
>
> Your monitor is not level.
>
> Irv
>
You mean if I tap on the glass it'll level out?
Martin
6. Re: snow!
On Sat, 18 Dec 1999 11:50:34 -0800, simulat <simulat at INTERGATE.BC.CA> wrote:
>>
>> > Hey Greg
>> > I liked your snow...
>> >
>> > I noticed that the snow piled up higher than the mean on the right
edge,
>> and
>> > lower than the mean on the left edge, but that most of the screen has a
>> > random distribution. Do you have a bit of wind happening?
>>
>> Your monitor is not level.
>>
>> Irv
>>
>You mean if I tap on the glass it'll level out?
>Martin
Just don't shake it too much or it will erase!
7. Re: snow!
>From: Jason Borgmann <kyricc at DAGOBAH.INEBRASKA.COM>
>Reply-To: Euphoria Programming for MS-DOS <EUPHORIA at LISTSERV.MUOHIO.EDU>
>To: EUPHORIA at LISTSERV.MUOHIO.EDU
>Subject: Re: snow!
>Date: Sun, 19 Dec 1999 02:13:37 -0500
>
>On Sat, 18 Dec 1999 11:50:34 -0800, simulat <simulat at INTERGATE.BC.CA>
>wrote:
>
> >>
> >> > Hey Greg
> >> > I liked your snow...
> >> >
> >> > I noticed that the snow piled up higher than the mean on the right
>edge,
> >> and
> >> > lower than the mean on the left edge, but that most of the screen has
>a
> >> > random distribution. Do you have a bit of wind happening?
> >>
> >> Your monitor is not level.
> >>
> >> Irv
> >>
> >You mean if I tap on the glass it'll level out?
> >Martin
>
>Just don't shake it too much or it will erase!
Pick up your monitor and shake it vigorously to scatter the settled snow and
watch it fall again.
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
8. snow!
Greg Phillips wrote:
> =
>It doesn't snow very often here, on the rainy west coast of Canada, so I=
>decided to make some of my own.
Hey... How about making us some sunshine? Most of us could use a little=
. =
(This should ideally be programmed by somone who has actually _seen_
sunshine, automatically disqualifying many of you BC types, not to mentio=
n
Jiri...)
Colin
9. Re: snow!
- Posted by jiri babor <jbabor at PARADISE.NET.NZ>
Dec 19, 1999
-
Last edited Dec 20, 1999
Colin wrote:
>>>Hey... How about making us some sunshine? Most of us could use a
little.
(This should ideally be programmed by somone who has actually _seen_
sunshine, automatically disqualifying many of you BC types, not to
mention
Jiri...)<<<
I thought *you* would be sick of sunshine, moving all the time, as you
do, in the cocaine territories. And what do you know, we had a cracker
of a Sunday, glorious sunshine all day. Windy Wellington is an
anachronic label.
But the truth is, those BC boys obviously do not even know their snow.
So I decided to teach them a lesson :). It is attached. jiri
-- <snip>
-- xmas.ex jiri babor 99-12-19
include graphics.e
include machine.e
constant
n=200,
textscreen=allocate(64000),
foreground=allocate(64000),
background=allocate(64000)
object o, flake, fallen
atom t, et
integer r, x, y, frame
procedure init()
text_color(YELLOW)
position(11,16)
puts(1, "Merry Xmas")
position(13,19)
puts(1, "and")
position(15,14)
puts(1, "Happy New Year")
mem_copy(textscreen,#A0000,64000)
mem_copy(background,textscreen,64000)
for i=1 to n do
flake[i]={rand(319), rand(200)-1, rand(3)} -- {x,y,speed}
end for
end procedure
procedure snow()
mem_copy(foreground, background, 64000)
for i=1 to n do
x=flake[i][1]
r=rand(20) -- add tumble / jitter
if r=1 and x<319 then
x+=1
flake[i][1]=x
elsif r=11 and x>1 then
x-=1
flake[i][1]=x
end if
y=flake[i][2]+flake[i][3]
if y<fallen[x] then
poke(foreground+320*y+x, BRIGHT_WHITE)
flake[i][2]=y
else
if x>1 and fallen[x-1]>fallen[x] then
x-=1
end if
if x<318 and fallen[x+2]>fallen[x] then
x+=2
end if
y=fallen[x]-1
poke(background+320*y+x, BRIGHT_WHITE)
fallen[x]=y
flake[i]={rand(319), -1, rand(3)}
end if
end for
end procedure
-- main --------------------------------------------------------------
tick_rate(200)
o=graphics_mode(19)
flake=repeat({}, n)
fallen=repeat(200,319)
init()
frame=0
et=time()
t=time()+0.03
while get_key()=-1 do
snow()
while time()<t do end while
frame+=1
if and_bits(frame, #3FFF)=0 then -- reset background
mem_copy(background,textscreen,64000)
fallen=repeat(200,319)
end if
mem_copy(#A0000, foreground, 64000)
t=time()+0.04 -- speed control: 33.3 fps
end while
et=time()-et
o=graphics_mode(-1)
printf(1, "%6.2f fps\n", frame/et)
10. Re: snow!
I like your snow, Greg. In fact it inspired me briefly to a creative
fervour. I wondered how the effect might be made more realistic, and
the wind idea sounded good as a start..
I never have much luck hacking existing code so I began anew. It ended
up becoming more like rain, so I pursued that concept instead. Behold!
My two cents.
----------------------
include graphics.e
include machine.e
--Declare globals
constant spd = 1, pos = 2, col = 3
object max
sequence rain, pal
integer gust, drops, speed
atom air, wind
--<<-----------== User parameters ==----------->>--
--number of droplets
drops = 1000
--rain falling speed
speed = 600
--wind speed (reluctance of wind to settle..)
wind = 100000
--strength of gusts
gust = 20
--<<-------------------------------------------->>--
--Delay
--tick_rate(100)
procedure delay(atom x)
atom t t = time()
while time() < t + x do end while
end procedure
--Map background function
function back(sequence pos)
atom colour
colour = pos[2] / max[2] * 4 - 3
colour *= (colour > 0) * 150
return colour
end function
--Assign random variables to new droplet
function new_drop(integer init)
atom rate
rate = rand(speed) / 100
return {rate, {rand(max[1]), rand(max[2]) * init}, rate / (speed /
100) * 254}
end function
--Set video mode
max = graphics_mode(#13)
max = video_config()
max = max[5..6]
--Make and set greyscale palette
pal = {}
for colour = 1 to 256 do
pal &= {repeat(colour / 4, 3)}
end for
all_palette(pal)
--Draw background
for x = 0 to max[1] do
for y = 0 to max[2] do
pixel(back({x, y}), {x, y})
end for
end for
--Prepare working variables
air = 0
rain = {}
for drop = 1 to drops do
rain &= {new_drop(1)}
end for
while get_key() = -1 do
--delay(.02) --Delay (if
needed..)
for drop = 1 to drops do --Sweep through
drips
pixel(back(rain[drop][pos]), rain[drop][pos]) --Erase old droplet
rain[drop][pos] += {air, 1} * rain[drop][spd] --Move droplet
rain[drop][pos][1] = --Horizontal
wraparound
remainder(rain[drop][pos][1] + max[1], max[1])
if rain[drop][col] <= back(rain[drop][pos]) or --When drop hits
bottom,
rain[drop][pos][2] > max[2] then
rain[drop] = new_drop(0) -- make it new top
drip
end if
pixel(rain[drop][col], rain[drop][pos]) --Draw new drop
air += ((air < 0) - (air >= 0)) / wind --Decelerate air
air += ((gust / 2) - rand(gust) + .5) * .001 --Add random gust
end for
end while
--
Nick Metcalfe <metcalfn at alphalink.com.au>
http://www.alphalink.com.au/~metcalfn