Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Must be a simpler way to produce falling snow

Author
Message
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 22nd Mar 2017 23:45 Edited at: 12th Apr 2018 20:45
Ive created this trying to get a falling snow effect


but it seems to be quite slow. The memblock functions aren't mine but CJB's

Has anyone got a better routine that they wish to share that has falling snow that builds up at bottom
fubar
tmu
7
Years of Service
User Offline
Joined: 2nd Feb 2017
Location:
Posted: 23rd Mar 2017 07:45
How about using particles for the falling snow?

Just change the image:
https://www.appgamekit.com/documentation/examples/particles/0_creating.htm

Don't know how to make snow build up. Also interested to hear ideas on that.
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 23rd Mar 2017 11:00
yeh me too its easy enuff to Leave a trail behind with particles which is great for fireworks etc but isn't really what snow does
It just falls and builds up I think you could get the same achievement with allot of hiding and drawing of sprites which I haven't
tried yet as I figured this was the better approach at the time.
fubar
Markus
Valued Member
19
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 23rd Mar 2017 11:47
made simple snow
AGK (Steam) V2017.02.28 : Windows 10 Pro 64 Bit : AMD (17.2.1) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 23rd Mar 2017 12:28
nice Parallax snow effect Markus

just wish it would build up when it hit the ground like real snow
fubar
tmu
7
Years of Service
User Offline
Joined: 2nd Feb 2017
Location:
Posted: 23rd Mar 2017 13:32
So this kind of relates to another question I have had in mind. How do you dynamically draw sprites in AppGameKit?

You could just put a wide sprite at the bottom, check for collision with the flakes and merge the flake sized rectangle/circle on the bottom sprite at those coordinates. If you know how to dynamically draw sprites in AGK. I don't.
Markus
Valued Member
19
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 23rd Mar 2017 14:57
Quote: "just wish it would build up when it hit the ground like real snow"

should be done with this commands
SetRenderToImage ( colorImage, depthImage )
SetRenderToScreen ()
CreateRenderImage ( width, height, format, mipmap )
AGK (Steam) V2017.02.28 : Windows 10 Pro 64 Bit : AMD (17.2.1) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
PSY
Developer
7
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 23rd Mar 2017 17:21
If you need realistic snow effects, rotating particles is the way to go

Here's a link to a 3D particle system I wrote some time ago in Blitz3D. It's based on DX7, so it might not run flawlessly on some operating systems ( sound isssues etc.).

It's guaranteed virus-free ( I'm the homepage owner). Press Y for fullscreen mode.

http://pheryllt.de/particlelabs-techdemo.exe


Snow effect is number 4
The effect can be WAY better, I just didn't put much effort in setting up the particle attributes for the snow
PSY LABS Games
Coders don't die, they just gosub without return
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 24th Mar 2017 01:22
I was actually more impressed by the waterfall example!

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
PSY
Developer
7
Years of Service
User Offline
Joined: 3rd Jul 2016
Location: Laniakea Supercluster
Posted: 24th Mar 2017 02:19
My favourite, too
PSY LABS Games
Coders don't die, they just gosub without return
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 22nd Apr 2017 22:20 Edited at: 12th Apr 2018 20:45
A snow that builds up using SetRenderToImage( colorImage, depthImage ) and CreateRenderImage( imageID, width, height, format, mipmap )
using 3 levels of parallax with slighter different shades for depth and colour collision detection.

to tmu and anyone else this should show you the render to screen commands.



I thought the following SetScissor command could be added in the pickcolor if statement to increase frame rates even more but that seems to slow it down a few frames
and causes a flicker every now and again.


but changing the set sync rate command to

gets some pretty good frame rates and works quite well just thought using the scissor command combined with rendertoimage would speed frame rates immensly
fubar
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 23rd Apr 2017 12:12 Edited at: 12th Apr 2018 20:42
The following produces snow with particle but without it building up

fubar
Xaby
FPSC Reloaded TGC Backer
16
Years of Service
User Offline
Joined: 17th Apr 2007
Location: Berlin
Posted: 25th Apr 2017 12:09
I had made one with scratch, you can see it and its code on the website
https://scratch.mit.edu/projects/827535/
Jack
19
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 25th Apr 2017 17:57 Edited at: 25th Apr 2017 18:04
Check out the current last page of the community shader thread,
there is a powerful but simple 2d snow shader with DOF effect.

The main advantage is, that the shader is computed on the GPU
and will always be faster than AppGameKit T1 code...

AGK T1 is slower than T2. But if you use T1 code to setup the enviroment for the shaders,
you will have a pretty good performance in T1.

[/url]
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 25th Apr 2017 22:22
thanks Jack fpr those wanting to see the shader thread ive provided the link

https://forum.thegamecreators.com/thread/214598?page=3
fubar
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 12th May 2017 04:03 Edited at: 12th Apr 2018 20:43
An example of two shaders
1 sun shader
2 snow shader

you will require a background image to get it to work proper

fubar
JohnStabler
AGK Bronze Backer
10
Years of Service
User Offline
Joined: 16th Aug 2013
Location: Cardiff, Wales, UK
Posted: 15th May 2017 12:23 Edited at: 15th May 2017 12:24
I notice in the OP that pickColor creates a memblokc from the image on each call. This can create a bottleneck between GPU and CPU, especially if it's a large image (like the size of the screen). That's because LoadImage() puts the textures on the GPU and memblocks are manipulated in main memory.

Creating memblocks should be done as infrequently as possible i.e. once per frame.

I created a bitmap destruction project a while back and found it best to chop the bitmap up into smaller ones and then only update the ones that change.

Login to post a reply

Server time is: 2024-03-29 12:29:04
Your offset time is: 2024-03-29 12:29:04