Author Topic: Silly question about internal function fadeIn-out - SOLVED  (Read 159 times)

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.
« Last Edit: 13 Jul 2018, 09:23 by rmonic79 »

Crimson Wizard

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: Silly question about internal function fadeIn-out
« Reply #1 on: 09 Jul 2018, 17:21 »
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.
« Last Edit: 09 Jul 2018, 17:55 by Crimson Wizard »

Re: Silly question about internal function fadeIn-out
« Reply #2 on: 09 Jul 2018, 17:28 »
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.

Crimson Wizard

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: Silly question about internal function fadeIn-out
« Reply #3 on: 09 Jul 2018, 17:35 »
i'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)?

Re: Silly question about internal function fadeIn-out
« Reply #4 on: 09 Jul 2018, 17:48 »
v3.4.0, March 2017, direct 3d9

Code: Adventure Game Studio
  1. //END OF PREVIOUS ROOM
  2.  
  3.           Wait(60);
  4.           aPioggia.Stop();
  5.           SetScreenTransition(eTransitionInstant);
  6.           FadeOut(1);
  7.           cEgo.ChangeRoom(3);
  8.          
  9.           OCCHISEGUONOPERSONAGGIO=true;
  10.           PALPEBRESEGUONOPERSONAGGIO=true;
  11.           SPEECHSEGUETESTA=true;
  12.           cAnimazioniOcchi.UnlockView();
  13.           cEgoPalpebre.Transparency=0;
  14.           OCCHITRASPARENZAAUTOMATICA=true;
  15.           cAnimazioniOcchi.UnlockView();
  16.           cEgoBraccia.UnlockView();
  17.           cEgoBraccia.Transparency=100;
  18.           cEgo.UnlockView();
  19.          
  20.          
  21.          
  22.          
  23.          
  24.    }
  25.  
  26. //NExtROOM
  27. function room_Load()
  28. {
  29.  
  30.  
  31.   closeUp[0]=cGen1;
  32.   closeUp[1]=cGen2;
  33.   closeUp[2]=cGen3;
  34.   closeUp[3]=cGen4;
  35.   closeUp[4]=cGen5;
  36.   closeUp[5]=cGen6;
  37.   closeUp[6]=cGen7;
  38.  
  39.  
  40.   for(int i; i<7; i++)
  41.    {
  42.      //closeUp[i].Transparency=100;
  43.      closeUp[i].ChangeRoom(3);
  44.      closeUp[i].x=320;
  45.      closeUp[i].y=360;
  46.      closeUp[i].ManualScaling=true;
  47.      closeUp[i].Scaling=100;
  48.      closeUp[i].Clickable=false;
  49.      closeUp[i].FaceDirection(eDirectionDown, eBlock);
  50.      closeUp[i].IgnoreLighting=true;
  51.      closeUp[i].SetGetlightlevel(0);
  52.    }
  53.    
  54.   cGen1.ChangeView(77);
  55.   cGen1.Baseline=1001;
  56.  
  57.   cGen2.ChangeView(78);
  58.   cGen2.Baseline=1002;
  59.  
  60.   cGen3.ChangeView(1);
  61.   cGen3.Baseline=1003;
  62.  
  63.   cGen4.ChangeView(2);
  64.   cGen4.Baseline=1004;
  65.     cGen5.ChangeView(5);
  66.   cGen5.Baseline=1000;
  67.  
  68.   cGen6.ChangeView(3);
  69.   cGen6.Baseline=1006;
  70.   cGen6.x=cGen1.x-150;
  71.   cGen6.Scaling=90;
  72.   cGen6.Transparency=100;
  73.  
  74.   cGen7.ChangeView(6);
  75.   cGen7.Baseline=1005;
  76.   cGen7.SpeechView=6;
  77.  
  78.  
  79.   cGen3.Loop=1;
  80.   cGen3.Frame=1;
  81.  
  82.  
  83.   //cGen3.Animate(0, 3, eRepeat, eNoBlock, eForwards);
  84.  
  85.   if (player.PreviousRoom==1)
  86.   MUSICA=aStanzaLovecraftColpi.PlayFrom(MUSICA.Position, eAudioPriorityHigh, eRepeat);
  87.   INVENTARIOPOPOUP=false;
  88.   cAbdul.ScaleMoveSpeed=true;
  89.   cAbdul.SetWalkSpeed(1, 1);
  90.   cEgo.y=300;
  91.   cEgo.ChangeView(10);
  92.   cEgo.SpeechView=17;
  93.   cAbdul.x=-20;
  94.   cAbdul.y=270;
  95.   cAbdul.ManualScaling=true;
  96.   cAbdul.Scaling=80;
  97.   cAbdul.Baseline=1;
  98.   cEgo.FaceDirection(eDirectionDown, eBlock);
  99.   cEgo.SetIdleView(0, 0);
  100.      FadeIn(1);
  101. }
  102.  
  103.  

Crimson Wizard

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: Silly question about internal function fadeIn-out
« Reply #5 on: 09 Jul 2018, 17: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.

Re: Silly question about internal function fadeIn-out
« Reply #6 on: 09 Jul 2018, 17:55 »
Tried both same results
Maybe when i'll return home i can post you a comparing video
« Last Edit: 09 Jul 2018, 17:57 by rmonic79 »

Crimson Wizard

  • AGS Project Tracker Admins
    • Best Innovation Award Winner 2013, for spearheading the AGS 3.3.0 project
    •  
    • Lifetime Achievement Award Winner
    •  
    • Crimson Wizard worked on a game that was nominated for an AGS Award!
      Crimson Wizard worked on a game that won an AGS Award!
Re: Silly question about internal function fadeIn-out
« Reply #7 on: 12 Jul 2018, 11:23 »
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.

« Last Edit: 12 Jul 2018, 11:26 by Crimson Wizard »

Re: Silly question about internal function fadeIn-out
« Reply #8 on: 13 Jul 2018, 09:23 »
Good to know Crimson so i'll go on gui black to be safe, thanks as always.