Depth of field - DOF, and Parallax scrolling with AGS

Started by Filipe, Thu 17/01/2019 14:55:24

Previous topic - Next topic

Filipe

Hi guys,

I'm trying to simulate Depth of Field or DOF.

DOF mean that when the player is  getting closer to the camera, and therefore bigger, the background turns increasingly blurred, and the DOF, shallowed.

I thought by doing this using  backckgrounds. I mean, I define shall we say, 3, or 4 regions, and if the player is in one of those regions the game loads a different background. With different stuff present on the background blurred (using photoshop), accordingly to the player position twords the "camera".

Is it possible to call a function associated with a region, which then, changes the background? How? Is what I trying to do here already been done?  Is it already implemented, like the scaling thing?

By the way, is it possible to do Parallax Scrolling with AGS? How, or

where can I load the plug in?

Thanks :)

Slasher

You can indeed change the Background image by triggering a region..
Just make sure the room loads the correct Background frame in Room Load.

Read manual about Region Events.

First Background is always 0, then 1, 2 etc

Parallax Scrolling module.
https://www.adventuregamestudio.co.uk/forums/index.php?topic=33142.0



Crimson Wizard

#2
Only for the reference, if it's only about room backgrounds I'd rather recommend to do this slightly differently:

1) Instead of relying on regions you could check player's Y coordinate in "repeatedly execute" function and change backgrounds depending on the player.y value (of course different rooms may have different rules regarding this).

2) Idk if you want to have this DOF effect in every room, but if yes then it may be more optimal to modify backgrounds dynamically (repaint pixels right during the game) using some algorithm. This of course would require searching for a blurring algorithm and converting one to AGS script. But in return you don't need to have multiple versions of same background, and may have smoother transitions (especially combines with the p1).


But I would like to note that this way you won't blur other characters and objects, which may make the whole scene look weird. So maybe this is not a good way to do DOF at all.

Be prepared that as AGS is a strictly 2D engine it does not support any modern 3D effects, so if you will want more of these you'll have to do lots of scripting.

Frankly speaking, since you had trouble scripting more basic things recently, maybe it's too early to start with effects like DOF. IMHO visual effects that are non-critical for gameplay are better left for the latter times when you have some working game already.

Filipe

Quote from: Slasher on Thu 17/01/2019 15:06:54
You can indeed change the Background image by triggering a region..
Just make sure the room loads the correct Background frame in Room Load.

Read manual about Region Events.

First Background is always 0, then 1, 2 etc

Parallax Scrolling module.
https://www.adventuregamestudio.co.uk/forums/index.php?topic=33142.0

Thanks Slasher :)

I try looking in the manual, and found this function:SetBackgroundFrame (https://www.adventuregamestudio.co.uk/manual/) Is this the one you refering to? It says:

SetBackgroundFrame (int frame)

Locks the background to frame number FRAME of an animating-background screen. (Values for FRAME are from 0 to 4). This allows you to use the animating backgrounds feature for another purpose...Pass the frame as -1 to return to the default behaviour of automatically cycling through all the background frames.

So as I understood, you create your backgrounds, and then using this function enables you too use them diferently, without having them changing as normal. Right?

Now for what  Crimson Wizard said, I guess you are right, but you see, I love video. I was taking coffee, and then, I have this vision... I think it will turn the game more imersive, specially in little rooms...

PS: I wonder why Khris doesn't say anything... I miss him :(

Slasher

Yes, if you don't set the background frame it will cycle through them (animating).

By setting the background frame it will cease animating.

Filipe

And I can associate this script to any region, right?

By the way, Slasher, can you show me any game you have made with AGS?

In the meantime... where is khris?!??!?! LOL :) I just hope he isn't still mad at me for being a newbe :(

Thanks agsain:)

SMF spam blocked by CleanTalk