Adventure Game Studio

AGS Support => Modules, Plugins & Tools => Topic started by: Dualnames on Tue 14/01/2014 20:31:51

Title: MODULE: Noisefilter
Post by: Dualnames on Tue 14/01/2014 20:31:51
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) Select
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) Select
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)
Title: Re: MODULE: Noisefilter
Post by: Grim on Tue 14/01/2014 21:23:36
I get this error:

Noisefilter.asc(17): Error (line 17): 'speed' is a global var; cannot use as name for local
Title: Re: MODULE: Noisefilter
Post by: 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.
Title: Re: MODULE: Noisefilter
Post by: Crimson Wizard on Wed 15/01/2014 08:10:57
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.
Title: Re: MODULE: Noisefilter
Post by: Dualnames on Wed 15/01/2014 14:04:52
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.
Title: Re: MODULE: Noisefilter
Post by: Grim on Wed 15/01/2014 15:29:14
Nope. Here's the error:

(http://i.imgur.com/p3T4dbU.jpg)
Title: Re: MODULE: Noisefilter
Post by: Dualnames on Wed 15/01/2014 16:18:15
Use the noloopcheck on the initializenoise function, I've only tested on 320x200.
Title: Re: MODULE: Noisefilter
Post by: Grim on Wed 15/01/2014 22:22:26
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?
Title: Re: MODULE: Noisefilter
Post by: Dualnames on Thu 16/01/2014 07:10:00
I've updated the module, so now it works in all resolutions, in my side of things the fps are 40 aka standard.
Title: Re: MODULE: Noisefilter
Post by: Ghost on Thu 16/01/2014 17:46:01
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"?

Title: Re: MODULE: Noisefilter
Post by: kaput on Fri 17/01/2014 07:05:00
Cool module. Thanks, Dualnames! Was using a GUI before and the slow down was awful.
Title: Re: MODULE: Noisefilter
Post by: Dualnames on Thu 23/01/2014 21:31:21
@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/
Title: Re: MODULE: Noisefilter
Post by: tzachs on Fri 24/01/2014 08:55:53
Great module! Works perfectly!
Too bad I won't be able to use it because of the license... :~(
Title: Re: MODULE: Noisefilter
Post by: kaput on Fri 24/01/2014 13:04:06
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.
Title: Re: MODULE: Noisefilter
Post by: Calin Leafshade on Fri 24/01/2014 15:19:55
A non-commercial license for an AGS module is a bit odd. Of course it is entirely Dualnames prerogative.
Title: Re: MODULE: Noisefilter
Post by: Dualnames on Fri 24/01/2014 16:43:45
Basically, I may have thought of this a bit on the wrong side. Whatever I was thinking. So yeah, let me fix that.
Title: Re: MODULE: Noisefilter
Post by: stu on Sat 08/02/2014 18:28:41
Dead simple to use, and works really well. Thanks!
Title: Re: MODULE: Noisefilter
Post by: tzachs on Sat 01/03/2014 21:52:10
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:


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