MODULE: Noisefilter

Started by Dualnames, Tue 14/01/2014 20:31:51

Previous topic - Next topic

Dualnames

NOISE FILTER MODULE

Basically, if you ever wanted to have a wonderful noise filter present in games such as Dakota, Wretcher, McCarthy Chronicles, and every ags game that's worth something, you now, can.
Plus it's all created inside AGS, so no need for adding images, no sir. This is handled entirely with this petty engine.

Anyhoo, download link. Import the module, using one line, have fun.

http://duals.agser.me/Modules/Noisefilter.zip

Example:
Code: ags
function Noise(bool enabled, GUI*noise_ui, int speed);


enabled: set true or false to enable or disable the effect/UI
noise_ui: assign a ui to the noise effect. Set the ui to clickable=false and transparency close to 90, for better effect.
speed: Animation delay between the noise frames.

Code: ags
Noise(true, gNoise, 4); // Place this whenever, and it will enable the ui.




LICENSE:
Basically, credit me somewhere if you want and send me a copy of your game (if commercial)
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)

Grim

I get this error:

Noisefilter.asc(17): Error (line 17): 'speed' is a global var; cannot use as name for local

Dualnames

Edited the int speed to noise_speed, as it appears to be clashing with a global variable, you have named, re-download and re-import.
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)

Crimson Wizard

#3
Quote from: Dualnames on Wed 15/01/2014 06:28:04
Edited the int speed to noise_speed, as it appears to be clashing with a global variable, you have named, re-download and re-import.
Sorry to barge in, but it's the reason for putting module's internal global variables into a struct, so decreasing a chance of name conflicts, because you may have only one (or few) struct objects there with distinctive names.

Dualnames

Agreed, but arguably I can't say I wanted to bother with fixing this more than I did. It could end up being less of a mess, but I can't say I wanted to bother really.
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)

Grim


Dualnames

Use the noloopcheck on the initializenoise function, I've only tested on 320x200.
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)

Grim

Yes, the noloopcheck works. Unfortunately, the noise filter, as amazing as it looks (especially in a higher res game) seems to cut fps down from 40 to 28... Is there any way to make it lighter on the system?

Dualnames

I've updated the module, so now it works in all resolutions, in my side of things the fps are 40 aka standard.
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)

Ghost

Lovely effect, well done! I can see this proving useful for quite a lot of games, really.

One tiny suggestion- in the Noise function "speed" is a bit midleading, since a higher number results in slower animation. Maybe make it "delay"?


kaput

Cool module. Thanks, Dualnames! Was using a GUI before and the slow down was awful.

Dualnames

#11
@Ghost: Will do when I change the version for something more important. :PP
@SunnyPenguin: Thanks, man.


Someone asked me over a pm, and while I'm at it, might as well, let anyone who is, or planning to use this. So here follows the license for this.

LICENSE:
Legalese is http://creativecommons.org/licenses/by-nc-sa/4.0/legalcode
In much simpler english: http://creativecommons.org/licenses/by-nc-sa/4.0/
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)

tzachs

Great module! Works perfectly!
Too bad I won't be able to use it because of the license... :~(

kaput

Quote from: tzachs on Fri 24/01/2014 08:55:53
Too bad I won't be able to use it because of the license... :~(

+1 ah well.

Calin Leafshade

A non-commercial license for an AGS module is a bit odd. Of course it is entirely Dualnames prerogative.

Dualnames

Basically, I may have thought of this a bit on the wrong side. Whatever I was thinking. So yeah, let me fix that.
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)

stu

Dead simple to use, and works really well. Thanks!

tzachs

Found a bug: since you don't provide a method to delete the dynamic sprites you created, if you reload the game, some weird stuff can happen.

Fixed this by adding the following method, and calling it before loading a game:

Code: ags

function CloseNoise()
{
  int i = 0;
  while (i < length)
  {
    if (nspr[i] != null) nspr[i].Release();
    if (noisespr[i] != null) noisespr[i].Delete();
    i++;
  }
}

SMF spam blocked by CleanTalk