Howdy, Stranger!

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

Codea 2.2 Beta

2

Comments

  • dave1707dave1707 Mod
    Posts: 8,625

    Loaded the current Codea version 2.2 (28) and ran some mesh tests. I ran 1000 and 2000 individual meshes of 3 different sizes, 20, 100, and 200. This was run on the 2.1 version before loading the 2.2 version. The average FPS was done over 1000 draw cycles and the result shown. Here are the results. The speed increase wasn't that much. This was run on an iPad Air.

         1000  meshes  size   20  ver 2.1   FPS  24.8   ver 2.2  FPS  25.7    
         1000  meshes  size  100  ver 2.1   FPS  24.7   ver 2.2  FPS  25.6
         1000  meshes  size  200  ver 2.1   FPS  24.5   ver 2.2  FPS  25.7
         2000  meshes  size   20  ver 2.1   FPS  13.5   ver 2.2  FPS  14.8
         2000  meshes  size  100  ver 2.1   FPS  13.8   ver 2.2  FPS  14.9
         2000  meshes  size  200  ver 2.1   FPS  13.8   ver 2.2  FPS  14.0
    
  • SimeonSimeon Admin Mod
    Posts: 5,417

    @dave1707 thank you for the detailed testing! In my testing the gems mesh demo (the old 'hello mesh' example) runs at 50 fps on my iPad mini 2, it used to run at 30 fps on version 2.1.1.

    The performance increase comes mostly from improvements to CPU bounds code (not rendering). So tight loops and such.

  • dave1707dave1707 Mod
    edited February 2015 Posts: 8,625

    @Simeon Here's the code I used for the mesh tests if you're interested. Also, there's a small orange dot under the Codea icon on the iPad's main screen. Does that mean it's a test version and not the latest real Codea version.


    displayMode(FULLSCREEN) function setup() --[[ 1000 meshes size 20 ver 2.1 FPS 24.8 ver 2.2 FPS 25.7 1000 meshes size 100 ver 2.1 FPS 24.7 ver 2.2 FPS 25.6 1000 meshes size 200 ver 2.1 FPS 24.5 ver 2.2 FPS 25.7 2000 meshes size 20 ver 2.1 FPS 13.5 ver 2.2 FPS 14.8 2000 meshes size 100 ver 2.1 FPS 13.8 ver 2.2 FPS 14.9 2000 meshes size 200 ver 2.1 FPS 13.8 ver 2.2 FPS 14.0 --]] -- the count and fps average will stop updating at 1000 draw cycles. count=0 tot=0 tab={} for z=1,1000 do --# of meshes table.insert(tab,m(math.random(50,WIDTH-50), math.random(50,HEIGHT-50),math.random(360))) end end function draw() background(40, 40, 50) fill(255) for a,b in pairs(tab) do b:draw() end if count<1000 then count=count+1 tot=tot+DeltaTime end text("count "..count.." fps "..count/tot,WIDTH/2,HEIGHT-50) end m=class() function m:init(x,y,r) self.x=x self.y=y self.ms=mesh() self.rot=r end function m:draw() pushMatrix() translate(self.x,self.y) rotate(self.rot+count) -- comment and uncomment the different sizes. self.ms.vertices={vec2(0,0),vec2(20,20),vec2(20,0)} --self.ms.vertices={vec2(0,0),vec2(100,100),vec2(100,0)} --self.ms.vertices={vec2(0,0),vec2(200,200),vec2(200,0)} self.ms:setColors(255,0,0) self.ms:draw() popMatrix() end
  • SimeonSimeon Admin Mod
    edited February 2015 Posts: 5,417

    @dave1707 the orange dot does seem to indicate that it is a beta version of the app. Thank you for the code — so the reason your code doesn't see much speedup in this version is because it is not very CPU bound. The Hello Mesh example, when set to about 3000 polygons, which iterates through all rects and updates their positions, is a good candidate for performance improvements in this release.

  • dave1707dave1707 Mod
    Posts: 8,625

    @ Simeon I thought maybe drawing a lot of individual meshes would be a good test. Guess not. I just ran into something weird, but I haven't been able to recreate it. I was editing some code and when I ran it, there was a line of auto complete commands at the bottom of the screen. I don't remember what list of commands it was showing, but it overlayed the exit, replay, etc buttons. I couldn't exit the code and I had to kill Codea to exit the program.

  • SimeonSimeon Admin Mod
    Posts: 5,417

    @dave1707 thank you for that, I'll try re-create the autocomplete overlay issue.

  • dave1707dave1707 Mod
    edited February 2015 Posts: 8,625

    @Simeon Here's my original time test. It used to run in 7.77 seconds. I'm getting 2 different times now. If I run this from the editor, it takes 17.6 seconds. If I run it using replay, I get 8.2 seconds. I ran each several times and those were the times I got the most. I'm not sure what's taking so long when it's started from the editor, but it's still slower than the original time.

    EDIT:These times are for the iPad Air.

    function setup()
        loop=10000000
        s=os.clock()
        for z=1,loop do
            a=math.sin(z)
            a=math.cos(z)
            a=math.log(z)
            a=math.sqrt(z)
        end
        print(os.clock()-s)
    end
    
  • SimeonSimeon Admin Mod
    Posts: 5,417

    @dave1707 interesting, thank you for that benchmark. Will profile and see what's happening when running from editor.

  • dave1707dave1707 Mod
    Posts: 8,625

    @Simeon I'm playing with the speech command. The speech is too fast at the default value off .5 . I have it set at .1 for what I consider normal speed. Does this vary by device. It will probably vary by each person, so we can see what others have to say.

  • Posts: 1,595

    @SkyTheCoder I've noticed this bug, sometimes if I hit the pause button wrong. I've also noticed it happen without using the pause button, if there's a bit of lag it will freeze.

  • Posts: 127

    hi @Simeon, don't know if this is the proper place to report, but ..my very first impression of the 2.2 beta was actually good.
    Performance issue seems to be solved, as my program sticks to 60fpd making use of several meshes with, in some cases large spritesheets and rects( 1500x1500px ).
    Also, the above benchmark code also took only 50 secs to run when it used to do it in 119 secs with codea 2.0 and 2.1.

    Looks like a very promising update :)

  • Posts: 1,976

    My Codea is still broken in the respect that it doesn't save my settings, and I can't sync to Dropbox...any solutions? When I try to set my background, it just gets stuck on the picture of the log, when I try to link my Dropbox, after authorizing in the Dropbox app, it just gets stuck on the loading icon, and my project icon size gets reset if I close Codea. The Dropbox part is probably my biggest problem, because a lot of my projects using Dropbox sprites are now broken... (I can see the files are still in my actual Dropbox, just not in the Codea app)

  • SimeonSimeon Admin Mod
    Posts: 5,417

    @SkyTheCoder it almost sounds like Codea is unable to write to he file system on your device. Could you try backing up all your projects (I.e., with iExplorer) and then deleting and reinstalling Codea?

  • Posts: 1,976

    @Simeon Last time I tried backing up Codea in iExplorer, nothing showed up when I opened Codea, and everything was a bit broken. I think the iExplorer problem is a problem with my iPad, because my charging port is broken and it can't connect very well. Codea can save new projects to my iPad, but even with free space, the settings aren't saved. Is it possible to do an iCloud backup and get Codea's files out of there?

  • SimeonSimeon Admin Mod
    Posts: 5,417

    @SkyTheCoder that makes things tricky. I wouldn't trust an iCloud backup to work — It has been inconsistent for me when restoring app data.

    You could write a Codea app to upload all the code somewhere. Alternatively you could copy and paste the code out using AirCode — or in the next beta, it will have a RESTful API that would let you pull the code out using JavaScript or something.

  • Posts: 1,255

    @Simeon is there a reason why the default speech speed is so fast?

  • dave1707dave1707 Mod
    Posts: 8,625

    @Mark I mentioned the speech speed being too fast in my post above. Thanks for agreeing with me.

  • SimeonSimeon Admin Mod
    edited February 2015 Posts: 5,417

    @Mark @dave1707 I believe the built-in speech synthesiser's default settings are very fast. Unsure why this is. I left Codea to default to Apple's setting but I can have it default to what I chose for the example project instead?

    Edit: It could be because its use is primarily for accessibility, so having it speak fast makes it faster for someone to navigate a UI (i.e., it doesn't matter that it sounds strange, only that it gets information across quickly)

  • Posts: 1,255

    @Simeon Personally, it would make sense to me if normal speed was 1, half speed was 0.5, double speed was 2.0, etc. But if that would be too confusing for those who are used to Apple's values, I understand.

  • SimeonSimeon Admin Mod
    Posts: 5,417

    @Mark I've changed the default rate to 0.1

    The Apple min, max and default are 0.0, 1.0, and 0.5 respectively. The default rate (0.5) is very fast.

    We could map the range [0.0 - 0.1 - 1.0] to [0.0 - 1.0 - 2.0] for the rate option. I think setting the default to 0.1 might be enough though.

  • SimeonSimeon Admin Mod
    Posts: 5,417

    @dave1707 regarding your earlier benchmark, I get a consistent 8.7 seconds on every run when profiling it. Is it possible that there was something else running? Does it still consistently produce a slower first-run for you?

  • dave1707dave1707 Mod
    Posts: 8,625

    @Simeon Running the code below, here are my results. Codea is the only thing running. I'm using an iPad Air 16GB with iOS 8.1.3 with 5.9 GB available. I'm running Codea 2.2 (28). Is there anything else you want me to try or any other information you could use.

    Test code.

    function setup()
        loop=10000000
        s=os.clock()
        for z=1,loop do
            a=math.sin(z)
            a=math.cos(z)
            a=math.log(z)
            a=math.sqrt(z)
        end
        print(os.clock()-s)
    end
    

    Here are the times starting the code from the editor. 10 runs.

    17.99
    11.88
    8.26
    17.66
    17.83
    17.78
    17.84
    17.63
    17.62
    16.90
    

    Here are the times starting the code with replay. 10 runs.

    8.23
    8.20
    8.29
    8.26
    8.22
    8.20
    8.21
    8.23
    8.22
    8.31
    
  • SimeonSimeon Admin Mod
    Posts: 5,417

    @dave1707 very odd, I'll have to do some more testing. I always get the ~8 second times.

  • dave1707dave1707 Mod
    Posts: 8,625

    @Simeon I loaded Codea 2.2 (29) and ran the above test again. Here's the results.

    Running from the editor

    8.22
    8.25
    8.27
    8.24
    8.25
    

    Running using replay.

    8.21
    8.20
    8.21
    8.33
    8.22
    
  • dave1707dave1707 Mod
    Posts: 8,625

    @Simeon Tried to get Codea to drop tabs by hitting the run and close icons at the same time. I tried about 20 times and it didn't drop a tab, but Codea crashed 2 times in those 20 tries.

  • dave1707dave1707 Mod
    Posts: 8,625

    @Simeon The default speech speed seems just right.

  • dave1707dave1707 Mod
    Posts: 8,625

    applyLinearImpulse and applyAngularImpulse were added to version 2.2 (29) . They both seem to work, but I really don't have a good test for them yet.

  • Posts: 1,595

    @dave1707 I'll give applyLinearImpulse a shot in my game, see where it takes me.

  • dave1707dave1707 Mod
    Posts: 8,625

    @Luatee From what I see so far, applyLinearImpulse give an object a velocity in some direction and when used with World Points also causes a rotation. I tried it with the example you had in another post using applyForce. I replaced applyForce with applyLinearVelocity and the result was even worse.

  • Posts: 1,595

    @dave1707 hmm.. Well, I've replaced the standing footwork on my player to use linearImpulse which seems to produce much less erratic behaviour when the frame rate dips. I'll try get a comparable result, as you may notice applyForce(vec2(0,100)) is much much weaker than applyLinearImpulse(vec2(0,100)). Impulse isn't an averaging force so try reducing the input in linearImpulse.

  • SimeonSimeon Admin Mod
    Posts: 5,417

    Thanks @dave1707 and @Luatee for giving those things a test. The next build has an exciting little feature relating to browsing the forums within the app.

  • dave1707dave1707 Mod
    Posts: 8,625

    @Luatee You might have to give "mass" some value to get equal results for applyLinearImpulse.

  • edited February 2015 Posts: 1,595

    @Simeon results are close:

    -- ApplyImpulse
    
    -- Use this function to perform your initial setup
    function setup()
        held = nil
        hang = nil
        hpd = nil
        ball = physics.body(CIRCLE,75)
        ball.x = WIDTH/2
        ball.y = 300
        floor = physics.body(EDGE,vec2(0,0),vec2(WIDTH,0))
        box2 = physics.body(POLYGON,vec2(-150,-50),vec2(-150,50),vec2(150,50),vec2(150,-50))
        box2.type = STATIC
        box2.x = WIDTH-200
        box2.y = HEIGHT-250
        box3 = physics.body(POLYGON,vec2(-20,-120),vec2(-20,120),vec2(20,120),vec2(20,-120))
        box3.type = DYNAMIC
        box3.x = WIDTH-150
        box3.y = HEIGHT-395
        b3anc = box3.position+vec2(0,115)
        b3pd = vec2(0,115)
        nc = physics.joint(ROPE,box3,box2,box3.position,box2.position,math.huge)
        physics.iterations(5,4)
    end
    
    function touched(t) 
        local p = vec2(t.x,t.y)
        if t.state == BEGAN and ball:testPoint(p) then
            held = p
            hang = ball.angle
            hpd = (p-ball.position)
        end
        if t.state == MOVING and held then
            held = p
        end
        if t.state == ENDED then
            held = nil
            hang = nil
            hpd = nil
        end
    end
    
    -- This function gets called once every frame
    function draw()
        -- This sets a dark background color 
        background(40, 40, 50)
    
        -- This sets the line thickness
        strokeWidth(2)
    
        -- Do your drawing here
        pushMatrix()
        pushStyle()
        translate(ball.x,ball.y)
        rotate(ball.angle)
        sprite("Space Art:UFO",0,0,150,150)
        popStyle()
        popMatrix()
        sprite("Cargo Bot:Game Area Floor",box2.x,box2.y,300,100)
        pushMatrix()
        pushStyle()
        translate(box3.x,box3.y)
        rotate(box3.angle)
        sprite("Space Art:Icon",0,0,40,240)
        popStyle()
        popMatrix()
        if held then
            local pos = (ball.position+(hpd):rotate(math.rad(ball.angle-hang)))
            ball:applyLinearImpulse(ball.mass*((held-pos)*32-ball.linearVelocity)/32,pos)
            fill(255)
            ellipse(pos.x,pos.y,15)
        end
            pos = (box3.position+(b3pd):rotate(math.rad(box3.angle)))
            box3:applyForce(box3.mass*((b3anc-pos)*32-box3.linearVelocity),pos)
            fill(50,200,50,255)
            ellipse(pos.x,pos.y,15)
    end
    
    
    

    You can make 'stiff' joints, trying to figure a way to make it a bit more axis like.

    Edit: Codea crashed after I opened it back up from multitask screen and pressed X to edit the editor, not sure if thats related to the fix in (29). I can't recreate it though so maybe not.

  • SimeonSimeon Admin Mod
    Posts: 5,417

    New build is out which removes the triple-tap escape gesture in favour of closing-and-reopening Codea. Also disables the swipe back gesture.

    Also try browsing the forums from the Codea Talk button on the main screen, I've made it easier to copy blocks of code when on the iPad.

  • dave1707dave1707 Mod
    Posts: 8,625

    @Simeon When in FULLSCREEN no buttons, the buttons can be brought back with a slight 4 finger squeeze and release.

  • dave1707dave1707 Mod
    Posts: 8,625

    @Simeon I ran into a problem where I couldn't get out of the fullscreen no buttons unless I killed Codea and reopened it. The slight 4 finger squeeze didn't work. The full 4 finger squeeze and reopen Codea didn't work. Pressing the home button and opening Codea didn't work. I had to kill Codea before it was back to normal.

  • SimeonSimeon Admin Mod
    Posts: 5,417

    @dave1707 hmm odd, must be a bug in my code. From the app's point of view the multi-touch squeeze is identical to hitting the home button and reopening the app.

  • dave1707dave1707 Mod
    Posts: 8,625

    @Simeon Here's the steps to recreate the fullscreen no buttons problem.

    1. start a program with fullscreen no buttons
    2. press the home button
    3. press the Codea icon to bring the program back.
          It should show the buttons.
    4. slide your finger from the left side to the right to show half the editor screen.
          slide the screen back to the left.
    5. press the replay button. 
    6. at this point, you can't get the buttons back.
    
  • Been playing with the new speech api - so far so good and nothing erroneous to report thus far and nicely implemented!

    I noticed that most of the functionality is documented, apart from: speech.voice - which appears to be exposed, but with no info what it does. What does this do?

  • Posts: 1,976

    I'm having some problems with zDepth (not specific to the latest beta), probably because I was using a vertex shader to make waves. It seems to be reversed, as seen in this picture:

    image

    (using setContext with depth)

    Any ideas on how to fix this, if it is because I'm using a shader that moved some vertices higher than OpenGL thinks they are?

  • SimeonSimeon Admin Mod
    Posts: 5,417

    @andymac3d thanks! speech.voice is reserved for the future. There is the potential to change the voices but an API is not yet worked out for that.

    @SkyTheCoder I'm unsure what you are experiencing from the picture, any more details?

  • Posts: 1,976

    @Simeon The water in the background is showing up over the water in the foreground.

    image

  • SimeonSimeon Admin Mod
    Posts: 5,417

    Thanks for details @SkyTheCoder, it would be best to try to isolate this in a simplified test case.

    Out of curiosity, has anyone noticed the "COPY" option next to code blocks when the forum is browsed within Codea? Are these useful for you?

  • dave1707dave1707 Mod
    Posts: 8,625

    @Simeon So that's where is was hiding. I gave it a try and it makes copying code a lot easier. Don't have to struggle with the drag icons on larger chunks of code. Works great.

  • dave1707dave1707 Mod
    Posts: 8,625

    @Simeon When using the forum from within Codea, could you add another icon at the bottom of the screen where you have the reload and open in Safari icons. One that would cause a jump to the top of the discussion. On long discussions, it takes awhile to scroll back to the top. In the normal forum, tapping the screen at the very top next to the battery icon causes the screen to jump to the top of the discussion.

  • dave1707dave1707 Mod
    Posts: 8,625

    @Simeon Forget about adding the icon mentioned above. I didn't notice the "Home Beta" buttons at the left side of the screen. The Home button does what I was asking.

  • SimeonSimeon Admin Mod
    Posts: 5,417

    @dave1707 I added a status bar to the in-app browser which you should be able to tap to scroll to top.

  • dave1707dave1707 Mod
    Posts: 8,625

    @Simeon Loaded Codea 2.2(31) and tried the fullscreen no buttons problem and couldn't get it to fail, looks like it's fixed. Tried the status bar in the in-app browser and it scrolls to the top, thanks. Not sure what the other updates did. Doesn't sound like anything I ever used, so I can't report on them.

  • SimeonSimeon Admin Mod
    Posts: 5,417

    @dave1707 thanks! The other stuff is just the necessary parts before App Store release, I think build 31 is a good release candidate.

  • Posts: 2,043

    Forum bug: If I press back in the browser (in Codea) from a discussion I am signed out. If I close and reopen, I'm signed back in. Small, but inconvenient.

    The new copy button is great!

    All the fixes seem to working for me

Sign In or Register to comment.