Posted: 5th Sep 2011 13:54
I'm trying to track down a bug that causes my program to crash. It may be related to how many sprite commands I'm using, or might be just the number of lines.

So - how many lines of code, approximately, does your program have?

And would you say you have a large percentage of sprite commands (CreateSprite, SetSpriteDepth, SetSpriteVisible, etc.)?

My test program crashes at around 2,128 lines of sprite commands.
Posted: 5th Sep 2011 14:06
I'm at 1472 and that includes all comment lines and blank lines between stuff.

I have a reasonable number of sprite commands, and I loop through quite a few sprites to check stuff (like collisions, visibility, prep for deletion) pretty much all the time.

In fact I've just written a little bit of code to draw 360 1x1 pixel sprites around my player in a circle and I update those as the player moves. No issues yet - at least on my desktop.
Posted: 5th Sep 2011 14:34
Does your app crash or the compiler? If it's the app what size is the bytecode file?
Posted: 5th Sep 2011 16:28
I'm way below your number Rich, but if you think your game is crashing for something related to sprites, why not create a simple application that loads an image and do a lot of sprite operations. Of course it doesn't replicate the complexity of your game, but if it is something related you should be able to reproduce using a big loop doing CreateSprite, etc...

Cheers
Posted: 5th Sep 2011 17:18
why not create a simple application that loads an image and do a lot of sprite operations


Ummm...



That's what I did. I think it's the number of commands, not the number of sprites, though.

@empty - The error message that pops up is "AGK Compiler has stopped working" so I guess it's the compiler. The .byc file is 881k and the SourceCode.agc and the .dbpro files are both left behind.


The compiler log window shows

Compiling: main.agc
Broadcasting app...(click Abort to end broadcast)
Process terminated with status -1073741819 (0 minutes, 5 seconds)

When I use these two commands

+ Code Snippet
temp = CreateSprite(0)
SetSpritePosition(temp, 0, 0)


repeated for a total of 1,361 commands, no blank lines, no comments, and a simple sync loop at the end, the program runs.

If I add one more SetSpritePosition, then it crashes, but it takes two more SetSpriteDepth commands to crash it.

I've attached the project, if anybody would care to try it and report back the results.

Also, I've reported this in the new bug forum on Google
Posted: 5th Sep 2011 17:55
Well it's not related to number of sprites, I tried this...

+ Code Snippet
FOR lp = 1 TO 2000
    CreateSprite(lp,0)
    SetSpritePosition(lp, 0, 0)
NEXT lp

DO
 Sync()
LOOP


...and it works perfectly.

I then did what you suggested and created a program that had each sprite created manually rather than in a loop and it failed to compile; the compiler gave the following error.

Compiling: main.agc
Process terminated with status -1073741819 (0 minutes, 13 seconds)

So it does indeed seem like there is an issue with filesize/number of lines.

Red.
Posted: 5th Sep 2011 18:46
I am currently at 2040 lines although that is less than it was last night. I had a crashing problem, or to be more precise, non compiling. I had to delete some (thankfully) uneeded code I had left in from the start of the project to get it to run again.
The rather unhelpful error message read along the lines "-1073741819 (0 minutes, 10 seconds)"
I just posted a query in my WIP also, but saw this thread and thought it might be along the same lines as what happened to my project.
BTW, there was no problems with the code I deleted, it was simply unneeded and not even being run anymore. It still stopped the game from compiling, if I didn't rem it out or delete it.

From my investigations last night I concluded it to be the program size, rather than anything else but I could be wrong. I do have a fair amount of sprites in my game.

I notice my error message is practically the same as yours although for some reason my comp takes 10 seconds, rather than 5 to mess up lol.
Posted: 5th Sep 2011 19:02
Rich..........

Is this lines of code in one file or you have also tryed to split up the code in to multiple files with an combined amount of lines from that?

I have alot of lines of code but split it in to multiple files.

Hmmmmmm....
Counted my lines of code in all files and iam only at 1556 lines.

But good to know if it happens to me
Posted: 5th Sep 2011 19:10
My first game came in around 800

My second game is at 1100 and counting, but it is nearly finished. (today or tomorrow)

My only unexplained crashes are when I use 6 or more sound files.
So, now I am creating my sounds in a way that I can combine them for more unique effects by playing 2 or more at the same time.
Posted: 5th Sep 2011 19:12
My only unexplained crashes are when I use 6 or more sound files.

I use 8 so that cant be an bugg?
Posted: 5th Sep 2011 19:15
Well, I saw another post about it and I get the same results.

On the 6th LoadSound I get crashes.
If I comment any of them out, then it works.
I am not the only one, so, yes it is a bug, but obviously tied to something else.
We just haven't figured that out yet.
Posted: 5th Sep 2011 19:18
I have also hit the "-1073741819" compiler crash and my program has also grown (too) long with 2325 rows.

As far as I have discovered, it seems to be related to the size of the generated bytecode file. As long as the bytecode doesn't exceed around 1024000 bytes it compiles without problems.

It doesn't seem to be affected by what kind of commands used (sprites, text, loop, functions) but more with how large the generated code is.

I have my program split up into several .agc files but also tried to join the program into one single main.agc file and the compiler crash shows up in both cases.
Posted: 5th Sep 2011 19:47
Nuts, I was hoping splitting it up may solve it, glad I waited for more info though.
Posted: 5th Sep 2011 20:03
Looks like time to optimize and shrink the code then

Seams the tgc didt expect people to write to large apps with the agk or something ?

e just haven't figured that out yet.


Wath sound format do you use ?

I simply use the same as the space shooter sample to load my sound and it works for me.

function CreateMusic( )
LoadMusic ( 1, "space/track1.mp3" )

SetMusicSystemVolume ( 70 )

PlayMusic ( 1, 1 )

LoadSound ( 1, "space/Chp_Lazer3.wav" )

LoadSound ( 2, "space/Chp_Boom.wav" )
LoadSound ( 3, "space/Chp_Boom2.wav" )
LoadSound ( 4, "space/Chp_Boom3.wav" )

LoadSound ( 5, "space/Chp_Boom3.wav" )
LoadSound ( 6, "space/Chp_CheckPoint3.wav" )
LoadSound ( 7, "space/Chp_PickUp2.wav" )
LoadSound ( 8, "space/Chp_Alien.wav" )
SetSoundSystemVolume( 60 )
endfunction
Posted: 5th Sep 2011 20:07
Yah, it's looking like it's not the sprite commands, it's ALL commands, but each command seems to have it's own limit. For instance you can have a bazillion lines of

print(a)

with no crash, but only 103 lines of

print("a")

causes a crash. 102 lines of it, no crash.

That's good news for me, I can drop a bunch of non-sprite-related code and still get my program working again, hopefully.
Posted: 5th Sep 2011 20:15
Wath sound format do you use ?

I use WAVs generated by Audacity
The sounds work fine, as I can replace one with the other and they all play.
The problem is when I load the 6th one. (I don't even play it)
More than 5 and I crash.

I am starting to think that maybe the integrated sound on this laptop maybe the problem, but I don't know.
I will experiment more and test it to death, but that will have to wait until after my game is finished.
I am too close to the end now to get side tracked with anything.

ah, it's looking like it's not the sprite commands, it's ALL commands, but each command seems to have it's own limit.

Interesting
That explains the problems I was having with Angry Piglets.
It got to the point that I could not add in any more sprites without it fouling up.
I wanted to have different images for my backgrounds, but had to settle for a color adjustment of just the one.
Anyway, I was able to get daylight/evening/night effect with it though, so there is a workaround for everything.
We just have to find workarounds until the guys at TGC get to work out these few issues.
It is still early in development, so I am sure we will find more quirks, but nothing Lee, Mike, and Paul can't fix.
Posted: 15th Sep 2011 0:49
I hate to bump this up, but this seems to be a huge issue. Each command has its limit as you've stated. I've already hit the limits for the LoadSound() (Which also means I've hit the limit on LoadMusic() ), and LoadImage(). So I haven't worked on my project for over a week
Posted: 15th Sep 2011 0:53
hockeykid, I feel your pain as well. With Lee gone for a week, and nobody else at TGC looking at the bug board, we'll just have to have some patience and hope Lee looks into the problem when he gets back.

AGK Particle Sandbox is dead in the water unless this gets resolved.
Posted: 15th Sep 2011 10:25
My code is at 1604 lines, and is extensively sprite and image heavy. I'm not using any sounds yet, but have loaded 12 music files.

I too get either a "compiler has stopped working", or a "Game.exe has stopped working" error.

This is a very annoying issue as we can't work around it!
Posted: 15th Sep 2011 20:47
What about making emergency custom commands using functions, until the issue is resolved?

MYprint("test")

Function MYprint(x$)
print(x$)
endfunction

Will that also crash at a given calls to that function?