Posted: 16th Sep 2011 9:15
Hit a snag trying to load a 31st image. In my little app I have (until now) had a long nice list of images loaded in the main.agc as I've come to need them. Most for buttons (with onOver function for highlighting if mousepointer is hovering over a button).

Today, I made some new buttons for my project, and imported them through the usual method of loadImage(id, name). It all compiled nicely, but the app won't run. Stopped working windows helpfully tells me. So I started commenting out all the new loadImage calls, then it worked. Uncommenting one by one, I found the limit; 30 calls to loadImage (or possibly image ID).

Working around the problem now, by instead loading up the images need for each screen, and flushing them on exit of the screen. Like I already do with sprites and text.
Posted: 16th Sep 2011 11:21
Not come across this in my own tests. When you say the app won't run, what exactly happens? Do you get a compiler message popping up or an error at runtime?
Posted: 16th Sep 2011 11:27
I think he gets the "Application has stopped responding" message so neither compiler nor runtime error...in a sense.

This problem might be related to this problem.
Posted: 16th Sep 2011 12:08
I can confirm that I load much more than 30 images in my App.
Posted: 16th Sep 2011 15:06
And the problem is recapped here.

It has been reported on the bug board, it is the second issue on the list. But I don't think anyone at TGC is looking at that list, since there has been no status change on any issue reported there.

Mike - is Lee the only one who would be looking at that list?
Posted: 16th Sep 2011 15:45
Not come across this in my own tests. When you say the app won't run, what exactly happens? Do you get a compiler message popping up or an error at runtime?


It's at runtime. No compiler error.

I tried loading and flushing images as I needed them on screen, but that did not work. Apparantly my projects approx. 1200 lines of code (so far ) mean that I can only do 30 loadImage calls.

And seeing as my first work-around failed abysmally, I'm now forced to import images the proper way. Not one and one, but gathered up in an atlas-map and then later assign using loadSubImage calls.

Seems to be working so far, I have at least managed to get more than 30 images into my app.

But I'm worried about hitting the 2k (and change) lines of code wall soon. Before I add networking to my app, I guesstimate getting to at least 1500 lines of code all in all...
Posted: 16th Sep 2011 15:54
The problem is that if the list does not seem to get any TGC attention (or is that TLC?) then people will start clogging the forum up with bug posts again in an attempt to get answers.

It would be a shame to see such a good idea get ignored in the future because it is apparently being ignored at the moment by TGC.

Already I've seen a few posts on there where people are getting frustrated...
Posted: 16th Sep 2011 16:23
Well, I imagine a lot of dev time is being spent on getting Android added. It is very frustrating to have no response on that board. Lee's posts about the board would seem to indicate that he will be the only one looking at it, and he's out 'til Monday.

This from Lee:
Essentially rather than bug reports getting lost in the forum, they are collected in a central list at code.google. I will then classify the issues as features, bugs and what priority they should have. If anyone would like to pitch in on each issue to verify those bugs as confirmed, they will be given higher priority as it's quicker to fix a confirmed bug than one where I have to trial and error to find it. Once they are confirmed, I will fix the issue for the next build, and mark it as such. When the next build is released, the original reporter of the issue can confirm it has been fixed, and if not resurrect the issue on the issues board and the cycle repeats. Should be a much better system than the one used by DBP!
Posted: 16th Sep 2011 17:11
Small update: The loadSubImage workaround did not work either. I can not assign / keep active more than 30 image IDs in my current project.

Sooooo. First I'll shave my code a bit. I'm sure I can cut from the current 1200 lines down to perhaps 1000 lines. I'll see how many active image IDs I'm allowed then. Not expecting much though.

Worst case, I'll have to rework my nice onMouseOver feature, and all the calls to it, as it nearly doubles the amount of images I use. Hmmm, perhaps just use some alpha effect for the mouseOver rather than an extra image.

Either that or reuse imageIDs by flushing the ones I do not use on a given screen, and load up new images on then available image IDs.

Good thing I got the weekend off, to rewrite a bit of code, and make the entire thing somewhat more slim and efficient.
Posted: 16th Sep 2011 19:13
I dont think its the load image command!

Only when i generate my current beta level i do with my editor, so do i load an image 500 times with this!

j = LoadImage ( "space/Tile.png" )
iSprite = CreateSprite ( j )

and it works
Posted: 16th Sep 2011 21:58
If you use loops and such I think you have less of a problem. Rich Dersheimer posted that he got a crash after 102 lines of print("a"). If you simply put that in a loop it will work fine. I think it is probably a memory issue rather than a command issue, the error number I get, when trying to compile is very long.

Still I wish they would fix it or at least acknowledge it. Lee actually posted on my Shooter WIP thread saying he would put this at top priority. Then he goes on hols to San Francisco lol. The thread still seems very much unchanged even now, as do all the others(priority wise, not complaint wise).

I understand this won't get fixed instantly, but it would be nice for someone at TGC to actually mark the thread as top priority so we know it is being addressed.

Oh, all of you guys trying to work around this. If you really feel you need to, carry on. I however have simply put my project on hold until it is fixed. I don't see the point of trying to cut code to get around the issue, only to hit it again later down the line. No amount of clever coding will stop this bug from stopping any large project from being affected. It is a little too random to actually nail the exact problem on the head anyway. I also have better things to do than rewrite projects to work around bugs (unless they are trivial bugs).

I would start another project in the meantime. This will be fixed and your project will be waiting. If it isn't there would be a lot of people wanting their money back. As time goes on, more and more people will come across this issue.

I expected at least a month before it got fixed when I first found it, so that leaves about 2-3 weeks left lol.

Oh one last thing I have way more than 30 images in my project also, so as I said above, I think the problem is a difficult one for us to pin down.

+ Code Snippet
gosub other

do
 printc("grr"):printc("grr"):printc("grr"):printc("grr"):printc("grr")
 print("grr"):printc("grr"):printc("grr"):printc("grr"):printc("grr")
 print("grr"):printc("grr"):printc("grr"):printc("grr"):printc("grr")
 print("grr"):printc("grr"):printc("grr"):printc("grr"):printc("grr")
 print("grr"):printc("grr"):printc("grr"):printc("grr"):printc("grr")
 print("grr"):printc("grr"):printc("grr"):printc("grr"):printc("grr")
 print("grr"):printc("grr"):printc("grr"):printc("grr"):printc("grr")
 print("grr"):printc("grr"):printc("grr"):printc("grr"):printc("grr")
 print("grr"):printc("grr"):printc("grr"):printc("grr"):printc("grr")
 print("grr"):printc("grr"):printc("grr"):printc("grr"):printc("grr")
 print("grr"):printc("grr"):printc("grr"):printc("grr"):printc("grr")
 print("grr"):printc("grr"):printc("grr"):printc("grr"):printc("grr")
 print("grr"):printc("grr"):printc("grr"):printc("grr"):printc("grr")
 print("grr"):printc("grr"):printc("grr"):printc("grr"):printc("grr")
 print("grr"):printc("grr"):printc("grr"):printc("grr"):printc("grr")
 print("grr"):printc("grr"):printc("grr"):printc("grr"):printc("grr")
 print("grr"):printc("grr"):printc("grr"):printc("grr"):printc("grr")
 print("grr"):printc("grr"):printc("grr"):printc("grr"):printc("grr")
 print("grr"):printc("grr"):printc("grr"):printc("grr"):printc("grr")
 print("grr"):printc("grr"):printc("grr"):printc("grr"):printc("grr")
 print("grr")`:printc("grr"):printc("grr"):printc("grr")
sync()
loop

other:
do
for n= 1 to 2000
    linecount=linecount+1
    printc("grr")
    if linecount=15
        linecount=0
        print(" ")
    endif
next n
Sync()
loop

return

This demonstrates one of the problems. This code will work as is. Rem in the remmed out lines and it will crash.
Posted: 17th Sep 2011 2:16
This demonstrates one of the problems. This code will work as is. Rem in the remmed out lines and it will crash.

I also got this crappy string bugg seams to be some kind of limit to the size of memory strings use?

this dont work!

+ Code Snippet
function KeyBoard( key as string )
    IsTrue = 0
    // Returns 1 if the current device has a full sized keyboard,
    // 2 if the device has a virtual or mobile phone keyboard and 0 for no keyboard at all.

    // we only want this to work on an pc or mac so if no full keyboard jump to end
    if GetKeyboardExists()<>1 then goto exit_keyboard

    // if no key pressed jump to end
    if GetRawKeyPressed( GetRawLastKey( ) ) = 0 then goto exit_keyboard

    Pressed_Key = GetRawLastKey( )
    // all the key press checks
    // system
    if key = "esc" and Pressed_Key = 27  then IsTrue = 1
    remstart
    if key = "tab" and Pressed_Key = 9  then IsTrue = 1
    if key = "back" and Pressed_Key = 8  then IsTrue = 1
    if key = "space" and Pressed_Key = 32  then IsTrue = 1
    if key = "enter" and Pressed_Key = 13  then IsTrue = 1
    if key = "shift" and Pressed_Key = 16  then IsTrue = 1
    if key = "ctrl" and Pressed_Key = 17  then IsTrue = 1

    // arrow
    if key = "up" and Pressed_Key = 38  then IsTrue = 1
    if key = "down" and Pressed_Key = 40  then IsTrue = 1
    if key = "left" and Pressed_Key = 37  then IsTrue = 1
    if key = "right" and Pressed_Key = 39  then IsTrue = 1

    // alphabet ( only checks Large letters and numbers )
    if key = Chr( Pressed_Key ) then IsTrue = 1

    exit_keyboard:
endfunction IsTrue


But this do work!

+ Code Snippet
Initiate_Keyboard:
    #constant KB_esc 27
    #constant KB_tab 9
    #constant KB_back 8
    #constant KB_space 32
    #constant KB_enter 13
    #constant KB_shift 16
    #constant KB_ctrl 17

    #constant KB_up 38
    #constant KB_down 40
    #constant KB_left 37
    #constant KB_right 39

    #constant KB_a 65
    #constant KB_b 66
    #constant KB_c 67
    #constant KB_d 68
    #constant KB_e 69
    #constant KB_f 70
    #constant KB_g 71
    #constant KB_h 72
    #constant KB_i 73
    #constant KB_j 74
    #constant KB_k 75
    #constant KB_l 76
    #constant KB_m 77
    #constant KB_n 78
    #constant KB_o 79
    #constant KB_p 80
    #constant KB_q 81
    #constant KB_r 82
    #constant KB_s 83
    #constant KB_t 84
    #constant KB_u 85
    #constant KB_v 86
    #constant KB_w 87
    #constant KB_x 88
    #constant KB_y 89
    #constant KB_z 90
return

function KeyBoard( key )
    IsTrue = GetRawKeyPressed( key )
endfunction IsTrue


Thanks to bursar on the heads up on constants