Crossfade: buffer is null attempting transition

Started by EnterTheStory (aka tolworthy), Wed 23/06/2010 22:18:44

Previous topic - Next topic

EnterTheStory (aka tolworthy)

I often get this crash when loading a saved game:
Code: ags
Crossfade: buffer is null attempting transition


This was mentioned a couple of years ago but I can't find any reference to a solution. I use eTransitionCrossfade as the default screen fade, so I imagine that is the problem?

I've tried calling 'SetNextScreenTransition(eTransitionInstant)' before saving a game but it makes no difference. Any ideas what I should do?

barefoot

#1
Do you use the SetNextScreenTransition(eTransitionInstant); just before you put changeroom?

eg
Code: ags

SetNextScreenTransition(eTransitionInstant);
cEgo.ChangeRoom(3);


Including all the code you put would help.

Maybe you have put something in Before Room Loads rather than After Fade in and thats causing the problem...?

barefoot
I May Not Be Perfect but I Have A Big Heart ..

EnterTheStory (aka tolworthy)

#2
Edit: that's a good idea. But rather than spending more time bug tracking I replaced the built in fade code with custom fade code (that I wrote for the other games) and it all works perfectly now.

Pumaman

I was never able to reproduce this problem. Do you have a way of reliably reproducing the crash?

EnterTheStory (aka tolworthy)

#4
Quote from: Pumaman on Fri 25/06/2010 14:01:57
I was never able to reproduce this problem. Do you have a way of reliably reproducing the crash?

I can upload the previous build of my game if you like - but it would be several hundred MB. In the latest build I don't use crossfade, so it's not really urgent for me any more. But if it would help anyone else I'd happily upload everything, code and all.

Pumaman

Don't worry about it, if it's that big. I'll try to find another way of reproducing it.

bbalint85

I think I isolated the problem. I'm drawing multiple dynamic sprites on the background, implementing a dirty footprint. So at any point the background is covered with some dynamic sprite-graphics. As I save in this state, then restart the game and loading, I get the Crossfade: buffer is null attempting transition error, altough I'm using Instant transitions.

The core of the code is the following:
Code: ags

function repeatedly_execute_always()
{
    int loop = character[0].Loop;
    ViewFrame *vf = Game.GetViewFrame(VFOOTPRINT, loop, character[0].Frame);
    DynamicSprite* dsf  = DynamicSprite.CreateFromExistingSprite(vf.Graphic, true);

    int w = (character[0].Scaling*dsf.Width)/100;
    int h = (character[0].Scaling*dsf.Height)/100;
    
    DrawingSurface *bgSurf = Room.GetDrawingSurfaceForBackground();
    bgSurf.DrawImage(character[0].x - w/2, (character[0].y - character[0].z), dsf.Graphic, Ego.Transparency, w, h);
    dsf.Delete();
    bgSurf.Release();
}


I also tried using a global variable dynamic sprite, but the result was the same. I think the restoring problem is with the dynamic sprites, the background can't be restored without the sprites in the memory.

Any suggestions keeping the background or at least avoiding errors at loading?

Timeless Journey

Pumaman

Interesting, thanks for the detail. I'll investigate it further.

bbalint85

I tried to reproduce it in a blank game, and had the following conclusion: the problem only occurs on the following:
-the default transition must be set to something other then crossfade (instant for example)
-the transition should be set during the game (SetNextScreenTransition or SetScreenTransition)
-dynamic sprites on the background should be involved.
-saving/loading

The most basic code I can think of producing the error message:
Code: ags

function oTest_AnyClick()
{
	SetScreenTransition(eTransitionCrossfade);
}
function room_AfterFadeIn()
{
	DrawingSurface *surface = Room.GetDrawingSurfaceForBackground();
	surface.Clear(14);
	surface.DrawingColor = 13;
	surface.DrawCircle(160,100,50); 
	surface.Release();
}


after clicking on the test object, saving, restarting the game and loading the error occurs.

After I realized this, I changed all the crossfades, and there are good workarounds, but I think it's good to know this anyway...

Timeless Journey

Pumaman

Thanks for the info!

I've found the problem -- it happens if the current screen transition is Normal/Instant, and you try to restore a save game that was saved when the transition was Crossfade/Dissolve.

In this situation it does a Normal/Instant fade-out, and tries to Crossfade/Dissolve for the fade-in, which gets confused and crashes.

I'll get it fixed.

Iliya

Yesterday this bug appears in my game. I upgraded AGS to 3.2.1. Problem is solved now.

SMF spam blocked by CleanTalk