Adventure Game Studio | Forums

AGS Support => Advanced Technical Forum => Topic started by: cat on 22 Jan 2012, 19:33

Title: Game crash - There was an error drawing object1.
Post by: cat on 22 Jan 2012, 19:33
Maybe solved!
Doc_Savage found a possible solution to this problem. As I was not able to reproduce the problem, I cannot verify if it helps.
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=45945.msg617135#msg617135 (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=45945.msg617135#msg617135)

Hi!

Selmiak reported an error in my game:
"There was an error drawing object1. It's current sprite, 56, is invalid."

(http://i.imgur.com/2HjN0.jpg)

He used 2x antialiased filter. I can't reproduce it and the error did not reoccur when he restarted the game.

Another player reported the same error but with completely different screen settings (fullscreen, no filters).

Both were using Direct3D 9 (I set this as default because in direct draw mode the music stuttering happens on room change)

Additionally I have to say that all sprites use alpha channel.

There is no line number in the error message but I think this lines cause the problem:

Code: [Select]
      oBowlEmpty.Visible = true;
      Wait(40);
      oUdder.Graphic = 56;
      Wait(20);
      oUdder.Graphic = 100;
      Wait(20);
      oUdder.Graphic = 56;
      Wait(20);
      oUdder.Graphic = 100;
      Wait(20);
      oUdder.Graphic = 55;

Any idea what this could be?

Edit: Forgot to mention - I use AGS Editor .NET (Build 3.2.1.111)
v3.2.1, March 2011
Title: Re: Game crash - There was an error drawing object1.
Post by: Dualnames on 23 Jan 2012, 08:17
Does sprite 56 exist?
Title: Re: Game crash - There was an error drawing object1.
Post by: cat on 23 Jan 2012, 08:19
Yes it does. For me it always works, I can't reproduce the error. Also, in Spritemanager the properties of 56 look ok to me.
Title: Re: Game crash - There was an error drawing object1.
Post by: Gilbert on 23 Jan 2012, 11:05
Hmmm. Just a quick guess. Is sprite #56 of the same colour depth as the game's?

Also, did the error reported by the other player involve the same sprite?
Title: Re: Game crash - There was an error drawing object1.
Post by: Ponch on 23 Jan 2012, 16:25
When this bug was first reported, I tried every combination of resolution, filter, and setting. I can't get the game to crash.

Very strange.   :-X
Title: Re: Game crash - There was an error drawing object1.
Post by: on 23 Jan 2012, 16:33
Same here, I tried it out this morning. No crash at all.

And by its description this sounds like a bug that should always happen- an object's sprite doesn't change its colour depth or attributes at runtime, after all. I can't break your game, cat!
Title: Re: Game crash - There was an error drawing object1.
Post by: cat on 23 Jan 2012, 17:27
Thanks guys for testing!

Hmmm. Just a quick guess. Is sprite #56 of the same colour depth as the game's?
Yes, all 32 bit.
Quote
Also, did the error reported by the other player involve the same sprite?
Just got the confirmation from Tabata (she is the other person) - yes it is the same sprite. Luckily she has offered to help me reproducing and finding the error.

She also mentioned that before the crash the cursor vanished but got visible again after rightclick (deselect inv item).
Title: Re: Game crash - There was an error drawing object1.
Post by: selmiak on 23 Jan 2012, 22:35
ZOMG, I think I played the german translation, and tabata probably too, so further investigation there might lead to another imagefile with a translation on it. Or the cow should moo in german and this crashed the game ;)
Title: Re: Game crash - There was an error drawing object1.
Post by: cat on 24 Jan 2012, 08:17
I tried the German translation too but couldn't crash it. Tabata did use the German translation, but wasn't able to reproduce it either.

Actually, the reference pic for the cow was a photo I took in Switzerland a few years ago, so the cow will indeed moo in German  ;)
Title: Re: Game crash - There was an error drawing object1.
Post by: tzachs on 24 Jan 2012, 12:33
Just a few thoughts.
- Are you using sprite 56 anywhere else in the code?
- Try and reproduce it by running it a lot of times. Change (temporarily) the code to this:
Code: [Select]
oBowlEmpty.Visible = true;
Wait(40);
int i = 0;
while (i < 1000)
{
      oUdder.Graphic = 56;
      Wait(20);
      oUdder.Graphic = 100;
      Wait(20);
      i++;
}
oUdder.Graphic = 55;


Title: Re: Game crash - There was an error drawing object1.
Post by: cat on 25 Jan 2012, 18:47
Nope, only usage of this sprite. And even turbo milking with only Wait(5) didn't result in an error.

There is nothing more for me to do than hoping it doesn't happen again...