Adventure Game Studio | Forums

AGS Support => Beginners' Technical Questions => Topic started by: rmonic79 on Mon 09/07/2018 17:00:40

Title: Silly question about internal function fadeIn-out - SOLVED
Post by: rmonic79 on Mon 09/07/2018 17:00:40
Sorry Guys i'm using ags about four years from now and i'm feeling a little stupid about this question :) But...
With my prevoius game i fought with it without ask, now i'd like to clarify something. On change room to have a long fade out in i had often the problem that first image appears than the screen become black and fadeIn, with a prevois version making ScreenTransition instant solved the problem (but not all the time)  but now with a new one i had the problem described above anyway. Are there some rules to avoid that so i don't have to make black object in every room or entire screen black character that change room to have this effect?
Thanks and sorry for noob question.
Title: Re: Silly question about internal function fadeIn-out
Post by: Crimson Wizard on Mon 09/07/2018 17:21:06
When and how exactly you are calling fade-in/out?

Normally you should perhaps call FadeOut in "Room Leave" event, then FadeIn on "Room After Fade In".

Regarding using black object, even if you'll come to such necessity, you could use GUI instead, that would make things much easier.
Title: Re: Silly question about internal function fadeIn-out
Post by: rmonic79 on Mon 09/07/2018 17:28:56
usually before change room and in room before fade in. Thanks a gui it's a good workaround but i'd like to understand the usage of internal functions, and why behave this way, just for curiosity.
Title: Re: Silly question about internal function fadeIn-out
Post by: Crimson Wizard on Mon 09/07/2018 17:35:11
Quote from: rmonic79 on Mon 09/07/2018 17:28:56i'd like to understand the usage of internal functions, and why behave this way, just for curiosity.

This may be a bug too. Which version of AGS are you using, and how exactly do you set it up? You said that transition is set to Instant. Can you post an example of your fade-out/in script?

Does this depend on which renderer you choose in setup (Software, Direct3D, OpenGL)?
Title: Re: Silly question about internal function fadeIn-out
Post by: rmonic79 on Mon 09/07/2018 17:48:07
v3.4.0, March 2017, direct 3d9

Code (ags) Select

//END OF PREVIOUS ROOM

          Wait(60);
          aPioggia.Stop();
          SetScreenTransition(eTransitionInstant);
          FadeOut(1);
          cEgo.ChangeRoom(3);
         
          OCCHISEGUONOPERSONAGGIO=true;
          PALPEBRESEGUONOPERSONAGGIO=true;
          SPEECHSEGUETESTA=true;
          cAnimazioniOcchi.UnlockView();
          cEgoPalpebre.Transparency=0;
          OCCHITRASPARENZAAUTOMATICA=true;
          cAnimazioniOcchi.UnlockView();
          cEgoBraccia.UnlockView();
          cEgoBraccia.Transparency=100;
          cEgo.UnlockView();
         
         
         
         
         
   }

//NExtROOM
function room_Load()
{
 

  closeUp[0]=cGen1;
  closeUp[1]=cGen2;
  closeUp[2]=cGen3;
  closeUp[3]=cGen4;
  closeUp[4]=cGen5;
  closeUp[5]=cGen6;
  closeUp[6]=cGen7;
 
 
  for(int i; i<7; i++)
   {
     //closeUp[i].Transparency=100;
     closeUp[i].ChangeRoom(3);
     closeUp[i].x=320;
     closeUp[i].y=360;
     closeUp[i].ManualScaling=true;
     closeUp[i].Scaling=100;
     closeUp[i].Clickable=false;
     closeUp[i].FaceDirection(eDirectionDown, eBlock);
     closeUp[i].IgnoreLighting=true;
     closeUp[i].SetGetlightlevel(0);
   }
   
  cGen1.ChangeView(77);
  cGen1.Baseline=1001;
 
  cGen2.ChangeView(78);
  cGen2.Baseline=1002;
 
  cGen3.ChangeView(1);
  cGen3.Baseline=1003;
 
  cGen4.ChangeView(2);
  cGen4.Baseline=1004;
    cGen5.ChangeView(5);
  cGen5.Baseline=1000;
 
  cGen6.ChangeView(3);
  cGen6.Baseline=1006;
  cGen6.x=cGen1.x-150;
  cGen6.Scaling=90;
  cGen6.Transparency=100;
 
  cGen7.ChangeView(6);
  cGen7.Baseline=1005;
  cGen7.SpeechView=6;
 
 
  cGen3.Loop=1;
  cGen3.Frame=1;
 
 
  //cGen3.Animate(0, 3, eRepeat, eNoBlock, eForwards);
 
  if (player.PreviousRoom==1)
  MUSICA=aStanzaLovecraftColpi.PlayFrom(MUSICA.Position, eAudioPriorityHigh, eRepeat);
  INVENTARIOPOPOUP=false;
  cAbdul.ScaleMoveSpeed=true;
  cAbdul.SetWalkSpeed(1, 1);
  cEgo.y=300;
  cEgo.ChangeView(10);
  cEgo.SpeechView=17;
  cAbdul.x=-20;
  cAbdul.y=270;
  cAbdul.ManualScaling=true;
  cAbdul.Scaling=80;
  cAbdul.Baseline=1;
  cEgo.FaceDirection(eDirectionDown, eBlock);
  cEgo.SetIdleView(0, 0);
     FadeIn(1);
}

Title: Re: Silly question about internal function fadeIn-out
Post by: Crimson Wizard on Mon 09/07/2018 17:53:53
First of all, I would try to move "FadeIn(1);" into "After fade-in" event. I have a feeling that if you call it from "room_Load" which is "Before fade-in", then AGS can do fade-in twice: first at your command, then on its own.
Title: Re: Silly question about internal function fadeIn-out
Post by: rmonic79 on Mon 09/07/2018 17:55:37
Tried both same results
Maybe when i'll return home i can post you a comparing video
Title: Re: Silly question about internal function fadeIn-out
Post by: Crimson Wizard on Thu 12/07/2018 11:23:19
I made some tests, and it looks like between "Room before fade-in" and "Room after fade-in" AGS forcedly removes fade effect even if you set one yourself.

If you do FadeOut(64) (this is instant fadeout) in "before fade-in" event, fade is instantly removed anyway.
If you do FadeOut(64) in "after fade-in", then there will be 1 frame where all the room is seen, before screen becomes black.

Only calling FadeIn in "before fade-in" (the way you do in the script you've posted) prevents screen from flashing instantly. I guess that's because fade-in is blocking and it performs before next room event takes place, so you never notice engine is also clearing the screen.

But you say that does not work for you?

Anyway, the fact that AGS overrides fadeout when changing rooms makes it hard to invent anything with Fade functions. Perhaps, using GUI is a best solution here in the end.

Title: Re: Silly question about internal function fadeIn-out
Post by: rmonic79 on Fri 13/07/2018 09:23:34
Good to know Crimson so i'll go on gui black to be safe, thanks as always.