Codea 3.9 (407)

Hi everyone!

Lots of Air Code updates in this new version:

  • All projects are now available directly from VSCode’s explorer view
  • Projects and collections can be created from VSCode
  • Projects can be renamed from VSCode
  • Device sleep is now disabled while Air Code is connected
  • Debugger pause will stop on the first draw() line
  • Fixed issues with filename case sensitivity
  • Fixed an issue with saving of large files

To test the new features, you must switch to the pre-release version of the Codea Air Code VSCode extension:

1 Like

@jfperusse - just loaded the new pre-release on my PC to test PC compatabity. Deleted old version and installed. Noted the new menu system with connection at bottom but so far have not been able to connect.

Will try on my Mac later.

Hi @Bri_G ! If you had an existing workspace opened, you might have to close it (File → Close Folder), and then use Connect to Host… again.

@sim @jfperusse Simple print statements are crashing 3.9 (401) Codea 4x.


function setup()
    print()
end 

Hi @dave1707! Strange, checking right away.

@dave1707 Just confirmed the crash in Modern projects. I’ll make a quick fix until this is resolved properly.

@dave1707 Crash is fixed in 402, thanks for reporting it!

@jfperusse The crash is fixed, but the print statements don’t print anything.

1 Like

Hi @dave1707, that’s to be expected as the new side view is not ready yet, but we should be able to bring back print support in Modern soon. Thank you!

1 Like

@jfperusse @dave1707 - I recorded a crash with 401 and tested it again with 402. It crashed - using the terrain code that Creator27 posted in the following link -

Voxel terrain has gaps

When it crashed it didn’t fire up an alert to post a crash report to @sim and @John.

There is something in 401/2 that still needs resolving.

p.s. please update this thread title to 402.

Hi @Bri_G. I tried 402 on my iPhone and an iPad and couldn’t get a crash with Creator27’s code. Do I need to do anything special?

@jfperusse - looks like I might have to copy/paste the code again. Maybe some corruption?

Update: reloaded Creator27 s code and ran straight after pasting into new project. Threw up an error straight away with first line

assert(OrbitViewer)

Remarked that line out and ran and it fired an error for unknown component in OrbitViewer. So I added the camera dependency to introduce that functionality, ran it and it crashed - with no error dialogue posted.

What type of device are you using? Maybe I can try with the same device.

It’s an iPad 3 pro.
Just a thought - is there any way Codea could be running, without fault, in the background. Not sending out a error but displaying the iPad desktop screen?

I don’t think Codea is still running in your case, otherwise you would still see it in your running applications on the iPad.

I wasn’t able to reproduce the crash on the 3rd generation iPad in the Simulator. My guess it that maybe this is an out of memory crash.

Maybe you could try reducing the size of the voxel scene as a test. For example, updating the existing code with scene.voxels:resize(vec3(100, 1, 100)).

Also, was this project working for you in previous versions of Codea?

@Bri_G @jfperusse Ran the code from the link shown above at least 25 times and didn’t have any crashes. This is on an iPad Air 3. I had to comment the assert line and add the dependency, but other than that it ran ok.

I think it must be something associated with my iPad as I removed lots of files from Photos and Downloads, moved a lot of large files from my Codea folder, ran it again and it still ‘crashed’.

The I tried to record the screen whilst demonstrating this - set the screen video capture loaded and ran the project and it crashed again but when I tried to stop the video it wasn’t running it looks like the crash stopped the video as well (tried a few times and it repeated the crash).

Last resort, posting what I have in pasted into the demo, after my edits, please check on your pads.

Also included details of my system in a snapshot.


-- Template2

-- assert(OrbitViewer)
seed = math.random(1, 10^10)

function setup()
    -- Create a new craft scene
    scene = craft.scene()
    scene.camera:add(OrbitViewer, vec3(0, 0, 0), 10, 0, 100000000)
    scene.camera.farPlane = math.maxinteger
    generateArea()
end

function generateArea()
    scene.voxels.blocks:addAssetPack("Blocks")
    local grass = scene.voxels.blocks:new("Grass")
    grass.setTexture(ALL, "Blocks:Dirt Grass")
    grass.setTexture(UP, "Blocks:Grass Top")
    grass.setTexture(DOWN, "Blocks:Dirt")
    local snow = scene.voxels.blocks:new("Snow")
    snow.setTexture(ALL, "Blocks:Snow")
    local sand = scene.voxels.blocks:new("Sand")
    sand.setTexture(ALL, "Blocks:Sand")
    
    scene.voxels:resize(vec3(10^4, 1, 10^4))
    scene.voxels.visibleRadius = 40
    scene.voxels.coordinates = vec3(0, 0, 0)
    scene.voxels:iterateBounds(vec3(0, 0, 0), vec3(100, 1, 100), generateVoxels)
end

function update(dt)
    -- Update the scene (physics, transforms etc)
    scene:update(dt)
end

-- Called automatically by codea 
function draw()
    update(DeltaTime)
    
    -- Draw the scene
    scene:draw()	
end

function generateVoxels(x, y, z, id)
    local perlin = craft.noise.perlin()
    local height = perlin:getValue(x / 280, z / 292, seed)
    if height >= math.random(7, 8) / 10 * -1 then
        scene.voxels:fill("Grass")
    else
        if math.random(1, 10000) / height < 500 then
            scene.voxels:fill("Snow")
        end
    end
    if height >= .00001 then
        scene.voxels:fill("Sand")
    end
    scene.voxels:block(vec3(x, height * -56, z))
end

@Bri_G I ran the above code. I restarted it 25 times and rotated the image each time between restarts. No crashes. I’m on a 64gb iPad Air 3 with 36gb available.

The storage space available is likely not an issue. When I said out of memory, I meant the RAM, but that’s just a wild guess.

@Bri_G Add the below code in the draw function. On my iPad, it went to around 14500 before it went back down to 3300 probably on a normal collectgarbage.


    mem=collectgarbage("count")
    text(mem//1,WIDTH/2,HEIGHT-50)