Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Klytos on Mon 22/08/2005 11:52:37

Title: Out of memory error (FIXED)
Post by: Klytos on Mon 22/08/2005 11:52:37
CJ,

Got a major problem happening with my game. I keep getting this error code

---------------------------
Adventure Game Studio
---------------------------
An internal error has occured. Please note down the following information.
If the problem persists, contact Chris Jones.
(ACI version 2.70.861)

Error: Out of memory: failed to allocate -492 bytes (at PP=155)

---------------------------
OK   
---------------------------

I haven't changed the code for this room or the global script and it previously worked perfectly. I've tracked it down to a portion of the code where this crash is caused but I can't see why it would happen, as I said nothing's been changed. Thanks for your help!

Klytos

Here's the code for the room (it's in the first time a player enters screen dialog)...

int job=Random(3);

Wait(20);
StopMoving(EGO);
character[BADDY].room = character[EGO].room;
character[BADDY].x = 87;
character[BADDY].y = 93;
PlaySound(5);
AnimateCharacterEx(BADDY, 4, 0, 0, 0, 1);
ReleaseCharacterView(BADDY);
FaceCharacter(BADDY, EGO);
Wait(100);

// *************************************************************
// THIS IS WHERE THE PROBLEM OCCOURS, WHEN THE RANDOM INT KICKS IN...

if (job == 0) {
   DisplaySpeech(BADDY, "&1 What are you doing out here?");
   SetGlobalInt(1, 1);
   SetGlobalInt(3, 0); }
   
if (job == 1) {
   DisplaySpeech(BADDY, "&2 That's it! You're dead meat!");
   SetGlobalInt(1, 1);
   SetGlobalInt(3, 1); }

else if (job == 2) {
   DisplaySpeech(BADDY, "&3 Die you little tree-hugger!");
   SetGlobalInt(1, 1);
   SetGlobalInt(3, 2); }
else if (job == 3) {
   DisplaySpeech(BADDY, "&4 Fuck off you little shit!");
   SetGlobalInt(1, 1);
   SetGlobalInt(3, 3); }

// *************************************************************
// *************************************************************

SetGlobalInt(2, 1);
Wait(10);
PlaySound(6);
AnimateCharacterEx(BADDY, 4, 0, 0, 1, 1);
Wait(1);
character[BADDY].room = -1;
PlayMusic(6);

Title: Re: Error in AGS
Post by: Kweepa on Mon 22/08/2005 22:08:51
I don't see why this shouldn't work.
Did you try it without the voice files (remove the &1, &2 etc from the DisplaySpeech commands)?
Title: Re: Error in AGS
Post by: Klytos on Tue 23/08/2005 07:52:38
Good idea, I tried that but still no luck. Any other suggestions?
Title: Re: Error in AGS
Post by: Gilbert on Tue 23/08/2005 11:34:10
So, did you mean the game works if your comment out that part in question?
Title: Re: Error in AGS
Post by: Klytos on Tue 23/08/2005 12:44:49
Yes, if I remove the code between the
// ***************************************
then it works fine. And that's what I don't understand because it used to work fine and I went to play that room the other day and it just didn't work. I tracked it down to that bit of code by commenting out everything then putting bits back in till it crashed again.
Title: Re: Error in AGS
Post by: Gilbert on Tue 23/08/2005 12:50:58
How many lines does the whole script of that room contain?
Title: Re: Error in AGS
Post by: Pumaman on Tue 23/08/2005 19:04:44
The script looks reasonable to me. Does the crash happen every time? If so, any chance you could upload the game with instructions on how to cause the problem, so that I can take a look?
Title: Re: Error in AGS
Post by: Gilbert on Wed 24/08/2005 02:15:06
I have a thought, maybe it's a graphics problem.
Do you have talking views for the characters? Also, are they LARGE (or have many frames)?
I'm aware that it may possibly be some memory problem when displaying the talking views.
Try increasing the sprite cache in setup and see if that helps.
Title: Re: Error in AGS
Post by: Klytos on Wed 24/08/2005 07:25:23
Gilbot, you've solved my problem.

Originally I had QFG4-style dialog, so the portraits were full screen (320 x 200). Recently I changed that back to Sierra Style with Window. A quick change to the character settings and the problem is all fixed. It was simply that character hadn't had his talking animation changed yet.

Thanks for all your help everyone. It's appreciated.

Klytos
Title: Re: Error in AGS (SOLVED)
Post by: Pumaman on Fri 26/08/2005 18:33:58
So this problem happened when you had a full-screen-sized sprite set as the character's talking view? Interesting, thanks for the info.

Edit by strazer: Supposedly fixed in AGS v2.71 Beta 4.