Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / How many lines does your program have?

Author
Message
Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
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.

Bursar
15
Years of Service
User Offline
Joined: 17th Sep 2008
Location:
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.
empty
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 5th Sep 2011 14:34
Does your app crash or the compiler? If it's the app what size is the bytecode file?
MobileCreator
12
Years of Service
User Offline
Joined: 1st Jun 2011
Location: Ottawa - Canada
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

----------
Paulo
http://www.mobilecreators.com
Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 5th Sep 2011 17:18 Edited at: 5th Sep 2011 17:26
Quote: "why not create a simple application that loads an image and do a lot of sprite operations"


Ummm...

Quote: "My test program crashes at around 2,128 lines of sprite commands.
"


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



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

Attachments

Login to view attachments
Red5
12
Years of Service
User Offline
Joined: 26th Aug 2011
Location:
Posted: 5th Sep 2011 17:55
Well it's not related to number of sprites, I tried this...



...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.
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
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.

Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
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
Conjured Entertainment
AGK Developer
18
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 5th Sep 2011 19:10 Edited at: 5th Sep 2011 19:13
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.

Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 5th Sep 2011 19:12
Quote: "My only unexplained crashes are when I use 6 or more sound files."

I use 8 so that cant be an bugg?
Conjured Entertainment
AGK Developer
18
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 5th Sep 2011 19:15 Edited at: 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.

MatsW
17
Years of Service
User Offline
Joined: 10th Jul 2006
Location:
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.
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 5th Sep 2011 19:47
Nuts, I was hoping splitting it up may solve it, glad I waited for more info though.

Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 5th Sep 2011 20:03 Edited at: 5th Sep 2011 20:06
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 ?

Quote: "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."


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
Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
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.

Conjured Entertainment
AGK Developer
18
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 5th Sep 2011 20:15 Edited at: 5th Sep 2011 20:19
Quote: "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.

Quote: "
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."

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.

Hockeykid
DBPro Tool Maker
16
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 15th Sep 2011 00: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

Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 15th Sep 2011 00: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.

Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
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!

My signature is NOT a moderator plaything! Stop changing it!
Impetus73
12
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
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?

----------------
AGK user - novice
Did Amiga / AMOS programming in the 90's, just started programming again with AGK.
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 15th Sep 2011 20:51 Edited at: 15th Sep 2011 20:52
Quote: "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?"

The same idea i have bin using lately
It shouldt do it as you only have the command once but is the error in how many times you use an command ??
Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 15th Sep 2011 21:13
The bug is having too many lines in your program. The limit changes somehow, according to which commands you use. I just used print("a") as an example. I don't want 104 lines of print("a") in my program.

I've tried concatinating lines, like



but that doesn't affect the bug.

I've been able to squeeze some statements, like



but I'm still hitting the limit.

Conjured Entertainment
AGK Developer
18
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 15th Sep 2011 23:44
Put it in a for loop and see how many you can do

Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 16th Sep 2011 07:35 Edited at: 16th Sep 2011 16:27
LOL - I've been trying to pare down my code by re-using text and sprite objects, basically only creating twelve of each, and then moving them around and changing the image/text values. This is in an effort to reduce the number of lines in my program, so I can get it to compile.

Well, it bit me right in the butt...

I've been changing out CreateText() for SetTextString(), but it seems that using SetTextString() lowers the "command cap" limit by two lines every time you use it. So by swapping the two commands, I'm actually DECREASING the number of lines that will fit in my program!

Man, I hope they get this fixed soon!

Silvester
18
Years of Service
User Offline
Joined: 7th Dec 2005
Location: Netherlands
Posted: 16th Sep 2011 10:04
Oddly enough after switching a few variables around I got it to work again after hitting the crash issue. Sure, it's a bit clumsy using three variables for the same global value, but for now the workaround seems to work.

This is a fairly random issue it seems.
Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 16th Sep 2011 14:58 Edited at: 16th Sep 2011 15:01
To recap what is known about this bug...

The compiler has a limit on the number of commands it can build.

The limit is not a hard number, it varies from program to program.

The limit is affected by which commands are in the programs. From testing, it seems that CreateText() uses up one "slot" in the number of commands, but SetTextString() uses up two.

When the limit is reached, the compiler may crash, or it may build a project, but then the player crashes when the program runs. This problem is related to the command limit, as it goes away when the number of commands is reduced.

Josk
16
Years of Service
User Offline
Joined: 2nd Apr 2008
Location:
Posted: 16th Sep 2011 16:22 Edited at: 16th Sep 2011 16:23
Thanks for keeping this updated.

I have been working a lot recently so have not been programming as much as I would like, but know I'm back into it I will no doubt be hitting the limit soon.

I thought I read somewhere that Lee is away, no doubt will make this top priority when he's back.
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 17th Sep 2011 01:32
My Frogger game has also just hit the problem, so that's 2 projects delayed now I'm looking at what I can prune down, but as it is to be part of a bigger overall package this needs sorting asap.

Conjured Entertainment
AGK Developer
18
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 17th Sep 2011 03:46 Edited at: 17th Sep 2011 03:47
Maybe we need to #include other scripts instead of trying to put everything into one.

Have you guys tried that?

DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 17th Sep 2011 05:03
I am doing. Makes no difference either way unfortunately. I've trimmed Frogger down a little, and can continue for now, but obviously this is not something you can do indefinitely.

Hockeykid
DBPro Tool Maker
16
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 17th Sep 2011 09:07
Quote: "Have you guys tried that?"

Yep, still doesn't work

Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 17th Sep 2011 11:23
Quote: "Maybe we need to #include other scripts instead of trying to put everything into one.

Have you guys tried that?"

It dosent help at all as i whas forced to convert parts of my code with alot of strings to constants instead and are upp and running again

Until the next time
Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 19th Sep 2011 21:32
So I've been commenting out huge chunks of code in my program, so I can work on the rest of it, robbing Peter to pay Paul, so to speak, when it hits me...

That's exactly what I would do to produce a demo program! Disable a few key features, and voila!

Anyway, if it works out, I could possibly release a demo of AppGameKit Particle Sandbox this week!

Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 19th Sep 2011 23:58
Just noticed something that Impetus73 wrote about earlier!

I made an function earlier where i used this!

VR.Width = GetVirtualWidth()
VR.Height = GetVirtualHeight()

And got an silly idea to change all my getvirtualwidth-height to my shortcuts from my function.

My bytecode file dropped from 996 kb to 984 kb?

And i also got an performance boost.

So there seams to be some truth in making some kind of global value of an agk command that you use alot in your code.

Just some things i noticed today

Ps....
dosent work on all commands! as i tryed to make some commands in to an function and the bytecode file got larger instead.
XanthorXIII
AGK Gold Backer
12
Years of Service
User Offline
Joined: 13th May 2011
Location:
Posted: 20th Sep 2011 00:50
I wish Lee or Mike would chime in on this. Known issue that is causing a lot of us some serious problems. I'll continue working on my program until I hit it. I wonder if this problem exists in the Tier 2 Code side.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 20th Sep 2011 10:48
Quote: "I wonder if this problem exists in the Tier 2 Code side. "

It does not as you don't use the AppGameKit compiler.

My signature is NOT a moderator plaything! Stop changing it!
AnX
13
Years of Service
User Offline
Joined: 17th Sep 2010
Location:
Posted: 20th Sep 2011 12:42
I think this problem shows up when your bytecode goes over 1MB

Size: 0,97 MB (1 024 000 bytes) - OK
Size: 0,97 MB (1 024 300 bytes) - Crashes
Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 20th Sep 2011 17:58 Edited at: 20th Sep 2011 18:16
It has happened to me with bytecode files sizes MUCH smaller than that. My example of Print("a") has a bytecode file of just 36 kilobytes in size.

It may be related to bytecode size, we just don't have the tools to fix bugs, only TGC can fix them.

Here's another conundrum, when I run the Print("a") code on my vista, it crashes at 104 lines. When I try it on an older XP system, it crashes at 115 lines, with a completely different error, "Unknown Instruction 147456376 at line 134217825.

Dybing
12
Years of Service
User Offline
Joined: 12th Sep 2011
Location: Bergen, Norway
Posted: 21st Sep 2011 08:28
Just hit the wall myself. Just about finished with a standalone beta for my project, was just going to add some text with what is included in my little app, what is to come and a some small instructions. No dice. Would not compile.

I'm guessing the last few CreateText calls in my (planned) instructions screen was the straw that broke the AppGameKit compilers back...

This size and number of calls to various commands bug need to be fixed ASAP.

Oh, and I am at about 1400 lines of code, including spaces and comments. Bytecode is approx. 550kb.
Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 21st Sep 2011 23:42 Edited at: 22nd Sep 2011 00:20
Quote: "
Comment 14 by project member LeeBamberTGC, Today (16 minutes ago)

Changed to high priority and being looked at now.
"


Quote: "
Comment 15 by project member LeeBamberTGC, Today (2 minutes ago)

Fixed for next build 1.0.4.X
"


Woot!

XanthorXIII
AGK Gold Backer
12
Years of Service
User Offline
Joined: 13th May 2011
Location:
Posted: 22nd Sep 2011 04:05
Very good news.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 22nd Sep 2011 15:56
That's great news!

I notice there are a few Lee has left a 'no comment' comment on... not sure whether that means he's looking into it or what but it's a bit confusing.

Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 22nd Sep 2011 18:31
I think those are mainly the ones that have had the type/status/priority updated, so they have been given a "first look" at least.

Login to post a reply

Server time is: 2024-04-20 07:24:06
Your offset time is: 2024-04-20 07:24:06