Bizarre 'untracable' error

Started by bx83, Yesterday at 12:37:26

Previous topic - Next topic

bx83

I've once again gone back to completing my loooooong overdue game. I've tracked the problem down to an error which happens in room 301, the title screen. At first it was working, then something somewhere changed, now it's throwing this error:

Code: ags
---------------------------
Illegal exception
---------------------------
An exception 0xC0000005 occurred in ACWIN.EXE at EIP = 0x00421C10; program pointer is +32, engine version 3.6.2.11, gtags (9762,241)

Please help. I have the associated dump file.

Seems to be an error inbetween the room_Load() and room_AfterFadeIn() functions:

Code: ags
function room_Load()
{
  cJulius.Transparency=100;
  gIconbar.Visible=false;
  cJulius.x=2000;
  cJulius.y=2000;
  mouse.Visible=false;
  
  object[0].Transparency=100;
  object[1].Transparency=100;
  object[2].Transparency=100;
  object[3].Transparency=100;
  object[4].Transparency=100;
  
  object[6].Transparency=100;
  object[7].Transparency=100;
  object[8].Transparency=100;
  
  bool AreSaveGames=false;
  for (int cnt=1;cnt<=50;cnt++) {
    if (File.Exists(String.Format("$SAVEGAMEDIR$/agssave.%03d.lociv",cnt))) {
      AreSaveGames=true;
      break;
    }
  }
  
  BlockStartMenuLoadButton=!AreSaveGames;
  
  oSmoke.SetView(345); <-- exception here, or
}


function room_AfterFadeIn()
{
  oSmoke.Animate(0, 2, eRepeat, eNoBlock, eForwards); <-- here, or
  FadeInControls_startup();  <-- here, depending on the compiler's mood
  mouse.Visible=true;
}

Crimson Wizard

#1
Hello. The errors that display a "Illegal exception" text are caused by the mistakes in the engine, not script mistakes. They have to be fixed in the engine.

"program pointer is +32" is a secret code that tells that the error happens when trying to draw a room object.

I assume that there's something unusual in the View 345 that you are trying to animate.

1. Does the view exist?
2. How many loops does it have and do these loops have valid frames?
3. Do you have regular sprites in this view, or do you assign dynamic sprites to it?

If you have a crash dump, I will need both the dump and also your game's exe file in order to read it. Sometimes it's enough to understand the problem, but sometimes that will still require additional investigation.

bx83

1. Yes.
2. One loop, about 8 frames.
3. Regular object, no dynamic chicanery going on.


It's an object called oSmoke. It has always worked. It's a few frames of animation. It was produced in Photoshop and is high quality full colour images with transparency/alpha channel. I've checked the options, there's support for high quality images.

It all seems to be in order, but I don't know if I'm getting something tiny wrong.

How do I get the dump file and EXE to you?

Crimson Wizard

Quote from: bx83 on Yesterday at 23:08:14How do I get the dump file and EXE to you?

You can upload them to a file hosting such as google drive, dropbox, etc, and then PM me a download link.
I never distribute other peoples game files, only use them for the engine debugging.

Crimson Wizard

#4
@bx83, I tried the game that you sent me.

So, there's definitely some mistake in the engine, but what appears to be triggering this is that you have a enormous "sprite cache size" in config set to 16 GB (!). You do not need a sprite cache that big ever, and especially since AGS 3.6.1 has a texture cache which is more important, and uses your video card's memory instead (VRAM). Also, since the engine is a 32-bit program and it can only load 3 GB in memory at once (and that includes not only sprites, but other things too).

I suggest changing cache sizes to some reasonable amount, like 500 MB or 1 GB tops for the texture cache, and maybe half of that for the sprite cache.

Meanwhile I'll investigate what is exactly happening. But I suspect that the engine gets confused by a big number and some math overflows...

bx83

Mistake in my programming of code run by the engine; or an error in the engine? I don't quite understand.

Changed sprite cache size to 2048MB/2GB and Texture cache size as 1024MB/1GB; it instantly works :P problem solved, thankyou very much!

Crimson Wizard

#6
Quote from: bx83 on Today at 09:32:29Mistake in my programming of code run by the engine; or an error in the engine? I don't quite understand.

It's a mistake in the engine which is triggered by too high "sprite cache size" number in config

Quote from: bx83 on Today at 09:32:29Changed sprite cache size to 2048MB/2GB and Texture cache size as 1024MB/1GB

Do you really need a sprite cache so big? Usually texture cache is more important, because in the end Direct3D / OpenGL graphic drivers use textures. Sprite cache is used as a backup.

Do you encounter real issues if you make sprite cache smaller?

There is a "Old Skies" game released recently by Wadjet Eye company, their game resolution is 1920x1080, and their default settings are 1GB for both sprite cache and texture cache. Your game is 1366x768, so in theory may work with lower values (unless you have many long repeating animations).

SMF spam blocked by CleanTalk