Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Codea crashing

edited July 2014 in General Posts: 142

I am currently working on a game, but every so often, when I am playing the game, Codea crashes. I was just wondering if this is my fault, having too much running in the game or if, when I export it to Xcode, the problem with resolve itself and stop crashing.

Comments

  • BriarfoxBriarfox Mod
    Posts: 1,542

    @Staples it's hard to tell without code. What is happening when the crash happens? How many objects are you drawing?

  • edited July 2014 Posts: 142

    @Briarfox I have a couple of screens set up as classes and drawn when necessary, but the app only crashes during the game screen. Then there are only 3 lines drawn, one sprite(the background), some text, and ellipses are constantly being drawn and removed. When the game crashes, there are usually about 8 ellipses drawn. I don't find this to be very much at all. When measured it is running at around 60 fps, so there should be no reason for it crashing.

  • Posts: 425

    Are you running out of memory? Creating objects every frame and not deleting them?

  • Posts: 142

    @Coder I don't think so. When an ellipse goes off the screen I use table.remove to get rid of it.

  • edited July 2014 Posts: 425

    It's difficult to see without sharing your code but use print statements to debug your code

    Get the memory in use by calling

    print(collectgarbage("count"))
    
  • Posts: 142

    @Coder I'm not really sure what that calls, but I am getting back numbers ranging from around 250-290.

  • Posts: 425

    Hmm... Could you post your code to help us debug it please?

  • edited July 2014 Posts: 142

    @Coder My code is pretty long so I'm not sure I should post it as it will just spam up the page. I can post it if you want, but It might be a bit confusing as there are a lot of images you won't have.

  • Posts: 425

    I don't mind if it helps you solve your problem. You could put all the code on the net, host on Dropbox maybe?

  • edited July 2014 Posts: 142

    @Coder, here is a folder with all the code. For all of the code in one file to paste into Codea, go into the full code folder.

  • Posts: 425

    Thanks, I will look thru it as soon as I have acces to an iPad

  • edited July 2014 Posts: 142

    @Coder, ok thanks! The actual app is not complete, but the game portion is playable. Pardon my work. I'm still learning Codea/lua so it's not the best. Some concepts such as scrolling I sort of made up a way to get it working.

  • Posts: 425

    One reason for crashing may be this:

    music("Dropbox:Theme for Harold var 2",Loop)
    

    Rather than Loop use true as loop is an undeclared variable so it will pass nil rather than true or false

  • Posts: 425

    I think your problem is that you don't destroy the basket and balls after each game so they are still there taking up memory and you create new ones and eventually there is no memory left so codea crashes

Sign In or Register to comment.