Howdy, Stranger!

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

Codea 3.1 (203)

24

Comments

  • dave1707dave1707 Mod
    edited February 17 Posts: 8,182

    @Bri_G @Simeon I created a model with a vertexCount of 28,933 and it took 1.08 seconds to display. It’s in my Codea Dropbox folder. I’m not doing anything with texture.

  • SimeonSimeon Admin Mod
    Posts: 5,193

    @Bri_G yeah that model is tiny it shouldn't load slowly

  • Posts: 464

    @Simeon did you change the line numbering? a line number over 999 is now 10..
    I don't like that, my tabs are often longer than 999-bad programming style i guess!

    By the way, often i have to press on a search item twice to jump to the correct location- a bit annoying.

  • Posts: 1,595
    @Simeon - I also noticed that when selecting an asset in the craft.model() parentheses that the path is slow to appear. Is the model loaded/parsed at that stage?
  • SimeonSimeon Admin Mod
    Posts: 5,193

    @piinthesky I did change it but that's a bug! I'll fix

    @Bri_G hmm which model iPad are you running? It does have to do a bit of work to figure out the asset code to put in between the parentheses

  • dave1707dave1707 Mod
    edited February 18 Posts: 8,182

    @Simeon The autocomplete is a whole lot easier to read now.

    Line numbers over 999 now show correctly. I guess that’s good until 9999. I never ran into the 999 problem because I don’t write anything that big in one tab.

    3D Asset Viewer still shows a lot of assets warnings.

  • dave1707dave1707 Mod
    Posts: 8,182

    @Simeon This gives an error.

        img=image(CAMERA)   
    

    Main:3: bad argument #1 to 'image' (string expected, got table)
    stack traceback:
    [C]: in global 'image'
    Main:3: in function 'setup'

  • Posts: 1,595

    @Simeon - iPad Pro (9.7-inch) iOS 13.2.3

  • Posts: 464

    @John @Simeon a surprising observation (at least for me)...if i have a scene with a lot of 3D models resulting in a low fps (around 13) and I then zoom in so that only one model is actually onscreen the fps stays the same! I am pretty sure that before Craft the fps did depend on the number of onscreen objects. I thought opengl culled offscreen objects?

  • edited February 19 Posts: 1,595

    @Simeon - little demo to show slow spriteing plus also a call to a non-existent sprite (pre asset lists} which throws up the last sprite.


    function setup() -- spr1= readImage(assets.documents.project.tile19) spr2 = readImage(assets.documents.project.tile18) end function draw() -- This sets a dark background color background(40, 40, 50) spriteMode(CENTER) sprite(spr1,192,720) sprite(spr2,576,720) sprite("Documents:any",192,640) end

    p.s. replace project.tile19 and project.tile.18 with your own sprites and leave the rest as is.

  • Posts: 464

    @Simeon for me version 200 crashes on startup and cannot be used

  • SimeonSimeon Admin Mod
    Posts: 5,193

    @piinthesky damn, thank you for the report. I'll look into it now

  • SimeonSimeon Admin Mod
    Posts: 5,193

    @piinthesky are you able to install an older build for now? I'll need to look into this more deeply and I don't have time tonight. I'm curious if this build crashes for everyone (seems to work fine for me)

  • Posts: 1,595
    @Simeon - not had chance to load 200 on mine yet. Do you run on iPad or simulator before publishing? Will report on 200 later. If I find it crashed I'll probably wind back to 197, anh other siggestions?
  • dave1707dave1707 Mod
    edited February 19 Posts: 8,182

    @Simeon Version 200 works OK for me.

    img=image(CAMERA) works OK.

  • dave1707dave1707 Mod
    Posts: 8,182

    @piinthesky Try loading an older version from the App Store and then try reloading version 200. Maybe it didn’t load right.

  • edited February 19 Posts: 464

    Powered on/off 200 - crashes
    Went back to 199 -ok
    Went back to 200-still crashes
    Went back to 199-happy

    I am on ipad pro 12.9, IOS 13.3.1

  • dave1707dave1707 Mod
    Posts: 8,182

    @piinthesky I loaded version 200 on my 12.9” iPad Pro 1 with iOS 13.3.1 and everything is OK.

  • edited February 19 Posts: 1,595

    @Simeon - loaded version 200 on my iPad Pro and ran noticeable improvement in speed for the short sprite routine above and address selection, but it still displayed the non-existent third sprite as the second sprite in the list.

    My old 3D models using the addressing prior to the asset.lists worked but a more recent one, addressing with asset.list crashed Codea.

  • Posts: 1,595

    @Simeon - after closing Codea and re-running 200 all code seemed to work fine. No crashes - weird!!!

  • Posts: 464

    @simeon, @dave1707 @Bri_G this time i made sure that codea was exited before doing the testflight update and this time 200 works? I guess previously codea was open when i did the update- i don't know if that could be a reason for the crash.

  • Posts: 1,595

    @dave1707 - just out of interest how did you time the display of the model that you mentioned in one of your earlier posts? Wasn't sure how you'd trap an event like that.

  • edited February 19 Posts: 1,595

    @Simeon - I have a number of data tables which contain paths to textures etc on Dropbox. They tend to be in sub directories but Codea can not see these so we were able to use them by typing in the full path. Could you tell me how I would address a subdirectory using the asset.list procedures in 200 ?

    Also - with the new addressing are there any illegal characters that we have to avoid in storing resources in sub-directories?

  • dave1707dave1707 Mod
    Posts: 8,182

    @Bri_G Heres how I do timeings.

    function setup()
        s=require("socket")
        st=s:gettime()
    
        for z=1,1000000 do
            a=math.sqrt(z)
        end
    
        en=s:gettime()
        print(en-st)
    
    end
    
  • Posts: 1,595

    @dave1707 - yup that's great using sockets but how do you trigger printing out the time after loading and displaying an obj model?

  • edited February 20 Posts: 1,595

    @Simeon - just restarted iPad, loaded Codea and loaded up 3D obj viewer and Codea bombed. Re-started Codea, ran same project and it worked. It’s almost like something needs initialising in first start then it’s OK. Still using 200.

  • SimeonSimeon Admin Mod
    Posts: 5,193

    @Bri_G I think the optimisation I put in for the picker speed update is to blame for this weird behaviour. I'll have to revert it which may make the picker slow again until I can find a better way to improve speed.

    For subdirectories, just type them out like normal

    local tex = assets.documents.Dropbox.My_Folder.My_Subfolder.MyFile
    

    Codea should autocomplete the subdirectories so you can be sure they exist. Codea's autocomplete suggestions will give you "safe" versions of the names you can use, some names will not be able to be translated and so will not appear in the suggestion list (file/folder names containing parentheses in particular)

    If you want to access them dynamically you can use the bracket syntax:

    local tex = assets.documents.Dropbox["My Folder"]["My Subfolder"]["MyFile.png"]
    

    (This requires that you know the file names)

    If you want to list the files in a particular Dropbox subfolder you could do:

    local textures = {}
    for k,v in pairs(assets.documents.Dropbox.My_Folder.all) do
        if v.type == SPRITES then
            table.append(textures, v)
        end
    end
    

    Then you could use those textures with sprite / mesh / craft / shaders / readImage or whatever

  • Posts: 1,595
    @Simeon - thanks for that it clarifies you previous note on syntax.
  • edited February 20 Posts: 1,595

    @Simeo @dave1707 - OK guys this is going to seem a bit weird. The recent bombing occurred after an update which I added whilst playing with 3D. This morning I was getting erratic bombing with other projects even bombing to starting Codea which suggested retained configuration in memory is issue. Random running projects after Codea reset was inconsistent with one project that always bombed. I since found if I run two projects before the bomber that the bomber works. So could you try this with a project that you find always bombs.

    Load the two projects below then run the first, run the second and then run your bomber.

    First:


    -- Craft Template displayMode(OVERLAY) function setup() parameter.integer("x",-180,180,0) parameter.integer("y",-180,180) parameter.integer("z",-180,180,0) -- Create a new craft scene scene = craft.scene() -- Move the main camera position scene.camera.position = vec3( 0, 0.04, -0.4) CameraSettings = scene.camera:get(craft.camera) CameraX = 0 CameraY = 0 CameraZ = 0 FieldOfView = 60 Ortho = false OrthoSize = 5 -- Set camera rotation + position viewing center of the scene scene.camera.eulerAngles = vec3(CameraY, CameraX, CameraZ) scene.camera.position = -scene.camera.forward * 5 -- Adjust the scene lighting scene.sun.rotation = quat.eulerAngles( 45, 150, 0) scene.ambientColor = color(181, 98, 98, 255) -- Get sky material and alter sky and horizon colors local skyMaterial = scene.sky.material skyMaterial.sky = color(32, 36, 193, 255) skyMaterial.horizon = color(92, 29, 214, 255) -- Create a new entity e = scene:entity() e.scale = vec3(1,1,1) / 20 end function update(dt) -- Rotate the entity e.eulerAngles = vec3(x,y,z) if CurrentTouch.state == MOVING then CameraX = CameraX - CurrentTouch.deltaX * 0.25 CameraY = CameraY - CurrentTouch.deltaY * 0.25 end CameraSettings.fieldOfView = FieldOfView CameraSettings.ortho = Ortho CameraSettings.orthoSize = OrthoSize -- Set camera rotation + position viewing center of the scene scene.camera.eulerAngles = vec3(CameraY, CameraX, 0) scene.camera.position = -scene.camera.forward * 5 -- Update the scene (physics, transforms etc) scene:update(dt) end function draw() update(DeltaTime) scene:draw() end

    Second:


    function setup() -- spr1= readImage(assets.documents.project.tile19) spr2 = readImage(assets.documents.project.tile18) spr3 = readImage(assets.documents.project.tile20) end function draw() -- This sets a dark background color background(40, 40, 50) spriteMode(CENTER) sprite(spr1,192,720) sprite(spr2,576,720) sprite("Documents:any",192,640) sprite(spr3,576,648) end

    On the second one you’ll have to set up a project with 3 sprites in but don’t change the line which says ‘Documents:any’ in.

    I know this feels a bit weird but hopefully you’ll be able to reproduce this and it may give Simeon an idea why the error is occurring.

  • Posts: 464

    @John did you notice my comment about the fps being dependent only on the number of 3D models declared and independent of the number actually displayed on screen? Any thoughts about that?

  • SimeonSimeon Admin Mod
    Posts: 5,193

    Thanks to everyone who logged crashes with TestFlight, it's really helping me track this down.

  • edited February 20 Posts: 1,595

    @Simeon - trying to set up a new simple 3D example and I placed an obj and mtl file in a folder within the Codea root together with graphic images. The model is a cube and the images the faces. The model folder was named Cube.

    I can see it with the fileapp but can not see it from the assets command in Codea. I renamed the folder Cube.assets and it is still not visible and the selector command for assets doesn’t pick up the obj file present. Also the files in the document dialogue within Codea have all but disappeared - when 200 was introduced there were a whole lot more assets visible in ordered list - virtually all gone. Is this file problem associated with the asset filing in 200.

  • SimeonSimeon Admin Mod
    Posts: 5,193

    @Bri_G hmm if you made the folder in Codea's documents folder (i.e., where your projects are located) then it should be accessible as assets.documents.FolderName

    I've just put out 201 to try to address the crashing, perhaps it will work with that.

  • dave1707dave1707 Mod
    Posts: 8,182

    @Simeon I loaded version 201, but I never had any crashes (other than my own mistakes) with the previous versions. Will look for other problems.

  • edited February 20 Posts: 1,595
    @Simeon - loaded 201 up and ran OK, so far no issues. As @dave1707 mentioned will take me some time to get used to asset prompts. Found one of my own issues causing problem in a dependency function assets() !!!
    Hope my ramblings didn't cause too much of a distraction.
  • dave1707dave1707 Mod
    edited February 20 Posts: 8,182

    @Simeon Trying to convert some of my projects to use the new assets.

    The old way gave me a table of names from Dropbox

    lst=assetList("Dropbox")
    

    The new way creates a keyed table, (name,path)

    lst=assets.documents.Dropbox.all
    

    Is there a way that I can only get the name, with and without the .ext name, something like

    lst=assets.documents.Dropbox.all.”name”           name only      
    
    lst=assets.documents.Dropbox.all.”name.ext”     name with extension
    

    If not, then I’ll just have to add a little more code to pull the name from lst.

    Something else I’m running into is my projects are listed in alpha order. So now when I create a table of my projects with the new assets, instead of the list in alpha order, it’s random because of the keyed table.

    Using temp=assets.documents.all how do I get just my projects and not what’s in Craft or Examples.
    OK, I’m not getting what’s in Craft or Examples, but I’m getting the folder names Craft and Examples and others along with .png files. I guess what I need to do is just pull out any name with a .codea extension and then drop the extension.

  • Posts: 1,595

    @Simeon @dave1707 - starting to get used to this new addressing regime, photo of failing project attached. A little confused in some respects - namely I built a cube .obj which has 6 images allocated by a .mtl - separate images. I can get cube to display but don’t know how to texture the separate faces unless I build one texture and rebuild texture map. Oh, also the graphics have been excluded as they need to be on a 4:3 ratio.

  • Posts: 1,595

    @Simeon @dave1707 - figured out the 4:3 ratio as it’s for a single texture which, thanks to @dave1707’s cube project, I’ve been able to adapt and address see pic.

  • Posts: 464

    @Simeon @John By setting offscreen objects inactive i was able to increase from 12 fps to 20 fps. In the process i notice there is not a vec3:angleBetween(), so was obliged to use the vec3:dot().

  • SimeonSimeon Admin Mod
    Posts: 5,193

    Just a heads up that there will be a breaking change in the next beta

    • "assets" is renamed "asset", might be a good test of find and replace to fix this in your projects (search "assets." -> replace "asset.")
  • dave1707dave1707 Mod
    edited February 22 Posts: 8,182

    @Simeon Too bad the search and replace didn’t work across all projects. I have about 300+ lines to change assets to asset. Also, as I’m making changes, I’m running across several types of asset where they’re not being highlighted correctly. Some are highlighted with light blue, some with light grey, and some not at all. When I get done changing assets to asset, I’ll show an example of the different highlights.

    These lines give different colored highlighting.

        tab=asset.documents.all
        bkupFile=readText(asset.documents.Dropbox..name)        
        sprite(asset.builtin.Planet_Cute.Character_Princess_Girl)
    
  • SimeonSimeon Admin Mod
    Posts: 5,193

    @dave1707 sorry to make work for you, I just won't have a chance to change it once Codea 3.1 is released

    The highlighting there is intentional, regarding the text colours: any property or function on the asset (key, path, name, ext, type, updated) should be highlighted in the grey colour while the asset path itself is highlighted in aqua

    The light grey vs blue bubbles around the function parameters for readText and sprite are how they were in previous versions of Codea. I'm thinking to change that, but at the moment they are still as they were

  • Posts: 1,595

    @Simeon - I have encountered a slight problem, don't know if it's been mentioned before, with the new asset system on 201. If you get a list of assets listed just above the keyboard it's possible for thelist to exceed the width of the iPad screen and it doesn't seem to scroll.

  • dave1707dave1707 Mod
    Posts: 8,182

    @Bri_G We seem to be thinking the same. About a screen or two from the bottom of page 1 of this discussion, I mentioned that I would like the autocomplete to scroll.

    @Simeon I don’t know how much control you have with this forum format, but the page numbers at the bottom that lets you go to different pages of a discussion doesn’t work. I have to use the page numbers at the top of the discussion. The other problem with the numbers is page 1 doesn’t have the numbers at the top. So if I go to page 1 of this discussion, I can’t get back to page 2 unless I close the discussion and come back in.

  • SimeonSimeon Admin Mod
    Posts: 5,193

    @Bri_G scrolling the list is something I want to add, though first I'll be sorting assets by type (i.e., if you are in the sprite function you should get image types etc.)

    @dave1707 I'll look into the forum page numbers issue, drives me crazy too

  • Posts: 1,595
    @Simeon - thanks for that, a quick question. Is the post tags system set up by you ir an external database. I ask because I pit craft in repeatedly and, even though I selected craft from a drop down list it put the top of the top item of the search options list in - Minecraft. Not really what I wanted - settled for Codea craft in the end.
  • SimeonSimeon Admin Mod
    Posts: 5,193

    @Bri_G oh weird, no I didn't configure it. Wonder if it looks it up externally or something

  • Posts: 1,595
    @Simeon - could be browser related, I've been using Opera recently.
  • dave1707dave1707 Mod
    Posts: 8,182

    @Simeon I ran across this line that doesn’t cause an asset warning. Don’t know if it should or not but it doesn’t follow the asset structure.

          m.texture="SpaceCute:Collision Circle"
    

    Also, something else I ran into while going thru my projects one by one. When I tapped on the next project to open it, another project nowheres near it opened. At first I thought it was my fault, but it happened several more times and the project that opened was several rows and columns away from where I tapped.

  • Posts: 1,595
    @,fave1707 - not seen that exactly but I have seen something that might be related. After running a project a few rows down, I came straight out of it and ran another near the top of the list immediately. The icon from the previous project zoomed to the top of the list. Never seen that before.
Sign In or Register to comment.