Module: FOG v1.00 - Create FOG in your AGS games!

Started by Dualnames, Fri 01/01/2010 17:49:19

Previous topic - Next topic

Shane 'ProgZmax' Stevens

You could give them different transparency amounts if you want (I've never tried using guis to do something like this).  The best way is to experiment until you get an effect you like with the different fog patterns moving at just the right speeds that they pass 'through' each other with an eye-pleasing result.  I look forward to seeing what you come up with.

Dualnames

I want to achieve the eye pleasantness of the water reflections in McCarthy chronicles. I just walked hours all over them! :D
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Ryan Timothy B

I finally had a chance to check out the castlevania intro (youtube wouldn't let me the last time I checked for some odd reason).  I personally don't like it.  It's way too fake looking.  Looks more like cartoon clouds than anything that resembles fog.

Like I said, I'd go with the gradient approach that I had shown earlier (I would just spend an extra few minutes on the gradient placement [Reed]  ;), like I said already).  You're right that the trunk should be of 'near' equal visibility as the top of the tree, but the only reason why it's heavier at the top is for the exact reason you've already pointed out, the top of the tree is further away than the base of the tree.  Also fog always appears more dense higher in the air, because: *ding* *ding* It's Further Away--and you're looking through more of it!  ;D

But if you're so keen on making it animate, there is one suggestion I have for you.  I'd use the Filter>Clouds in Photoshop.  Probably with medium gray and black, then set the layer's blending mode to Multiply.  That way the black areas go transparent and the mid-point between black and white would go translucent.  Then you lower the opacity and have that as a blanket, possibly as a GUI or a character with high Z order, and have it move from left to right with another 'character' blanket to come into place when the first blanket is going off screen.

I think it would be the best and most realistic looking approach AND with the least amount of work.

Dual, if you're interested in a quick AGS mockup to see what I'm talking about, I could probably make one in like 20 or so minutes total.  Let me know.

Dualnames

Here's what I've arrived to.

11 objects all at the same transparency.

This is JimReed's style of Fog.



EDIT: Ryan, I've sent you a PM.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Ryan Timothy B

Oh, I see.. you're going for the 'ground' fog.  Like you see a fog machine make for those creepy movies.  I don't know if my gradient fog will be of any use to you if you want this type of fog.. I'll have to think about it first.

Dualnames

Quote from: Ryan Timothy on Sat 02/01/2010 17:04:49
Oh, I see.. you're going for the 'ground' fog.  Like you see a fog machine make for those creepy movies.  I don't know if my gradient fog will be of any use to you if you want this type of fog.. I'll have to think about it first.

I'm going for fog. It might even work. As I said, I'm really out of my waters with this whole topic..
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Ryan Timothy B

#26
Sorry for the delay there, buddy.  I spent an hour longer than I intended making this, since I didn't know you were going for the 'ground' fog.  And I had fun playing around with Photoshop's gradients and whatnot to make it look as close to real as I could be arsed to do for this demonstration.

http://www.bryvis.com/entertainment/other/agsf/fog_dualnames.zip

There are 4 characters for the background fog, and 2 characters for the scrolling fog.  If you really wanted to (which I was almost tempted to do) was to make the individual 4 character fog's scroll as well at different speeds (by adding another 4 characters).  It would have been pretty interesting.

My computer obviously stays at around 40fps.  Shouldn't drop too much on the lower end computers, I think.

Edit: Oh I completely forgot.  Press TAB to view it with a black screen.

Dualnames

Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Ryan Timothy B

#28
Actually before I send the files over, which do you like better?

http://www.bryvis.com/entertainment/other/agsf/fog_dualnames_scroll.zip

This one moves with wind, and the more distant they are the slower they move.

Edit: Oops. for testing I had TAB remove the blanket layer of fog (which doesn't move now, since all the rest do), forgot to change it back to toggle the background.

Edit2: Actually I decided I kinda liked the blanket over top everything and moving as well (cause you see it on the character).  So I added it back.  ;D
On this file: http://www.bryvis.com/entertainment/other/agsf/fog_dualnames_scroll2.zip

Tell me which one you like the most and I'll send it on over. :P

Dualnames

Quote from: Ryan Timothy on Sat 02/01/2010 20:00:13
Actually before I send the files over, which do you like better?

http://www.bryvis.com/entertainment/other/agsf/fog_dualnames_scroll.zip

This one moves with wind, and the more distant they are the slower they move.

Edit: Oops. for testing I had TAB remove the blanket layer of fog (which doesn't move now, since all the rest do), forgot to change it back to toggle the background.

Second version seems better! Perfect to be honest!
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Ryan Timothy B

#30
http://www.bryvis.com/entertainment/other/agsf/fog_dualnames_files.zip

There you go Johnny-Joe.  I took the liberty to send you the 320x240 size sprites as well.  Also tossed in parts of the script in case you wanted/needed it.  If your game is 320x240 you'll have to divide all the x and y coords in half.  And if the depth of your background is different than the one I had in my demo, you'll have to change the 3 fog layers manually (1 and 2 are both at the bottom edge of the screen).

You'll have to create 10 characters (it's best if their numbers were all in numerical order 1-10 or 16-25, etc etc--that way you can use a while statement).

Also you'll have to flip every other image in AGS manually so the fog layers can seamlessly connect to each other.  I tossed in a pic that explains it (a picture is worth a thousand words).

Have fun--don't get into too much trouble!  ;D

Oh and if ya let me see what it looks like if you get it going, I'd be happy :).

edit: I guess I forgot to mention that this fog will only really work on backgrounds that you can see the horizon (or back wall, level) from left to right.  Otherwise it would look pretty wonky.  The speed was also amped up quite a bit just to show that they were all moving.  But speed could work for an evil monster lair like you have shown--but I'd test to see what it looks like at a slower speed first.

Dualnames

#31
Quote from: Ryan Timothy on Sat 02/01/2010 20:55:47
http://www.bryvis.com/entertainment/other/agsf/fog_dualnames_files.zip

There you go Johnny-Joe.  I took the liberty to send you the 320x240 size sprites as well.  Also tossed in parts of the script in case you wanted/needed it.  If your game is 320x240 you'll have to divide all the x and y coords in half.  And if the depth of your background is different than the one I had in my demo, you'll have to change the 3 fog layers manually (1 and 2 are both at the bottom edge of the screen).

You'll have to create 10 characters (it's best if their numbers were all in numerical order 1-10 or 16-25, etc etc--that way you can use a while statement).

Also you'll have to flip every other image in AGS manually so the fog layers can seamlessly connect to each other.  I tossed in a pic that explains it (a picture is worth a thousand words).

Have fun--don't get into too much trouble!  ;D

Oh and if ya let me see what it looks like if you get it going, I'd be happy :).

edit: I guess I forgot to mention that this fog will only really work on backgrounds that you can see the horizon (or back wall, level) from left to right.  Otherwise it would look pretty wonky.  The speed was also amped up quite a bit just to show that they were all moving.  But speed could work for an evil monster lair like you have shown--but I'd test to see what it looks like at a slower speed first.

Really nice code there! You're a lifesaver there! If you want it, I can implement this into a module. With or without your sprites, this will prove really useful to lots of people.

EDIT: Also, I've added this snippet on this part of the source to ensure it will be over the characters:

Quote

character.ChangeRoom(35);
character.x=160;
character.Frame=i-1;
character.Clickable=false;
character.Solid=false;

character.Baseline=i+600;

i++;


Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Ryan Timothy B

#32
Oh yeah sure, I left them the way they were so you could walk behind the individual depths of fog.  But whatever works for you. :P


And sure, whip up a fog module if you want to.  Just make it so people can set the height of the horizon so then the fog's y will be calculated accordingly. :P

Kinda like:
fog(int horizon, int speed, int direction, int characterStartNum);

The characterStartNum would be like: character# 1 to 10.  You'd also have to toss in a Loop frame count just to make sure they have the right amount of Fog sprites in the Loop.

And Direction, anything below zero would be left, anything above zero would be right, and zero would be static.

I can't think of anything else at the moment.  
Glad it works for you.

Joseph DiPerla

Joseph DiPerla--- http://www.adventurestockpile.com
Play my Star Wars MMORPG: http://sw-bfs.com
See my Fiverr page for translation and other services: https://www.fiverr.com/josephdiperla
Google Plus Adventure Community: https://plus.google.com/communities/116504865864458899575

Ryan Timothy B

Good work on the module Duals.

I noticed one thing though.  Instead of adding gamewidth to the fog character that jumps to the other side of the screen, you should check the character's sprite width and left character's X, and add that to the right's X.
Just in case anyone wants to add longer fog sprites, or even shorter.  Dummy proof :).

I also don't think you really need to do the speed for each layer of fog, which is quite daunting.  One master speed should do it (heck, the master speed could even determine direction, -1 would be left, +1 right, and 0 stop).  1 being slow, and higher being faster.  Then you set the wind speed for each layer of fog in the module to a slow speed, then multiply by the masterspeed like:
movex[0]=0.16*inttofloat(masterSpeed); //character 1+2 (1st Blanket)
movex[1]=0.08*inttofloat(masterSpeed); //character 3+4 (2nd)
movex[2]=0.04*inttofloat(masterSpeed); //character 5+6 (3rd)
movex[3]=0.02*inttofloat(masterSpeed); //character 7+8 (4th)
movex[4]=0.01*inttofloat(masterSpeed); //character 9+10 (5th)

And I figure using an Int would be less complicated, and I can't see someone wanting a masterSpeed of 1.5.
If it still doesn't work for them, they can go into the script and change it manually. :P

Also you forgot the direction!! ;D

Anyway those were just my thoughts--take 'em if you want.  I totally didn't expect you to want my files or script, I just wanted to make the AGS demo so you could understand what I meant.  But this works too.  :)

Dualnames

Quote from: Ryan Timothy on Sun 03/01/2010 17:42:32
Good work on the module Duals.

I noticed one thing though.  Instead of adding gamewidth to the fog character that jumps to the other side of the screen, you should check the character's sprite width and left character's X, and add that to the right's X.
Just in case anyone wants to add longer fog sprites, or even shorter.  Dummy proof :).

I also don't think you really need to do the speed for each layer of fog, which is quite daunting.  One master speed should do it (heck, the master speed could even determine direction, -1 would be left, +1 right, and 0 stop).  1 being slow, and higher being faster.  Then you set the wind speed for each layer of fog in the module to a slow speed, then multiply by the masterspeed like:
movex[0]=0.16*inttofloat(masterSpeed); //character 1+2 (1st Blanket)
movex[1]=0.08*inttofloat(masterSpeed); //character 3+4 (2nd)
movex[2]=0.04*inttofloat(masterSpeed); //character 5+6 (3rd)
movex[3]=0.02*inttofloat(masterSpeed); //character 7+8 (4th)
movex[4]=0.01*inttofloat(masterSpeed); //character 9+10 (5th)

And I figure using an Int would be less complicated, and I can't see someone wanting a masterSpeed of 1.5.
If it still doesn't work for them, they can go into the script and change it manually. :P

Also you forgot the direction!! ;D

Anyway those were just my thoughts--take 'em if you want.  I totally didn't expect you to want my files or script, I just wanted to make the AGS demo so you could understand what I meant.  But this works too.  :)


No idea how to add direction, if you show how's right I'll implement it. :D
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Matti

Thanks for the great stuff, guys. This is perfect for my game  :)

Dualnames

Quote from: Mr. Matti on Sun 02/05/2010 17:46:55
Thanks for the great stuff, guys. This is perfect for my game  :)

Oh, yes , indeed, Ryan helped me a lot, so I said, why not give the code out. Thanks goes to him. :D
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Wesray

Would have loved to test the module - it might come handy in a future game. Unfortunately the link in the first post references to 2dadventure.com and requires member authentification. :( Could you upload the archive somewhere else?
THE FAR CORNERS OF THE WORLD: Chapter 2 currrently in the works...

Dualnames

Quote from: Wesray on Mon 07/06/2010 09:56:28
Would have loved to test the module - it might come handy in a future game. Unfortunately the link in the first post references to 2dadventure.com and requires member authentification. :( Could you upload the archive somewhere else?

Okay done, check link on the first post. ;)
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

SMF spam blocked by CleanTalk