Howdy, Stranger!

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

Codea Runtime Library

2

Comments

  • SimeonSimeon Admin Mod
    Posts: 5,432

    Thanks @szleski, updated.

  • TaoTao
    Posts: 20

    @Simeon, does Codea Runtime Library have support for iADs in xCode? Also, would it be possible to have in app purchases?

  • DylanDylan Admin Mod
    Posts: 121

    @Tao No they are not supported (iAD and IAP), though the source code is available, so it would be possible for someone to add support for them.

  • Posts: 4

    Hi everybody
    I'm new in this forum (and a new Codea user). I like this IDE (and Lua) very much. I'm impressed, how smart a small game can be developed. A big thanks to the maker of this genius piece of software.

    First: sorry my poor english, hope, you understand my two questions about the runtime library (-;

    -> I've developed a small topdown shooter (codea figher ;) ) with 4 enemy waves and a boss, in witch i've used some sprites of the Tyrian Remstered spritepack. In my game, the sprites will zoom with factor 2 in this way:

    sprite("sprite-name", pos.x, pos.y, width * 2, height * 2)

    If i run the game in codea, everything is all right, but if i compile my project with your runtime library in xcode, the sprites have the vanilla sizes. Is the zoom function not implemented yet and will this come in one of the next versions?

    -> The other thing is, that the game runs very smooth inside codea with 60 fps, but the same version compiled in xcode runs with only ~30 fps. Is this ordinary?

    Greetings

    irus.

  • SimeonSimeon Admin Mod
    edited May 2012 Posts: 5,432

    @irusloy it sounds like you are getting 30 fps in the iPad Simulator? That is normal. The simulator is much slower than a real iPad.

    The size problem is very odd — it could be due to a retina graphics bug. Do you have a small piece of sample code that misbehaves in the runtime? I'll look into it using the sprite line you posted above.

    Edit: Also if you plan to release your game on the iOS App Store please do not use the word "Codea" in the title of your game. (You may, however, mention Codea in the description and keywords for your game. Or in the game itself.) If you do not plan to distribute your game then don't worry about it :)

  • Posts: 4

    Hi @Simeon, thank you very much for your reply. I don't use the simulator, because i know the performance issue. I've used the iPad 3.
    Concerning the sprite zoom, you've right: The iPad 2 shows the sprites correctly, the issue is only on the iPad 3.

    The slow downs are on both devices; here the code samples. I use a class Enemy for draw the Enemies and a class EnemyFormation, in witch the formation will be moved (this will mean, self.position will set from the EnemyFormation class)

    Enemy = class()
    
    function Enemy:init(type)
        self.sprite = {
            "Tyrian Remastered:Enemy Ship C",
            "Tyrian Remastered:Enemy Ship D",
            "Tyrian Remastered:Enemy Ship C 1",
            "Tyrian Remastered:Enemy Ship B",
            "Tyrian Remastered:Boss A"
        }
        self.ship = self.sprite[type]
        self.position = vec2(0,0)
        ....
        self.width, self.height = spriteSize(self.sprite[type])
    end
    
    function Enemy:draw() 
    
        pushStyle()
        if self.type == 1 then 
            tint(0, 196, 255, 255)
        elseif self.type == 2 then --....
        ....
        end
        popStyle()
    
        sprite(self.ship, self.position.x, self.position.y, self.width * 2.5, self.height * 2.5)
        .....
    
    end
    

    If there are any typos in the code: never mind, write this post on my pc without copy/paste from the ipad ;)

    And of course, "codea fighter" is only the working title :)

  • DylanDylan Admin Mod
    Posts: 121

    Version 1.4.1 has been pushed to the github repository.

  • Posts: 122

    Awesome, Dylan! Thank you!

  • Posts: 80

    @irusloy does that x2 problem occurs when you are recording in codea on the new iPad? I also used spritesize, same problem...

  • Posts: 122

    Quick Question. I fired up my project under the new release of the Runtime but it appears that it isn't performing the http.get functions in the simulator.

    Is this just an Xcode simulator thing or did I screw something up in my project as opposed to my iPad project?

  • Posts: 122

    Nevermind.. It decided to just take a bit of time to work :P

  • edited May 2012 Posts: 4

    @Inviso: Yes, only with the new iPad. Since v1.4 i've the same issue inside Codea, not only with the runtime library.

  • Posts: 122

    New problem. After transferring my app over to Xcode, I've noticed that my app appears to be running a bit slower and one of the touch functions is no longer working. There is no difference between the xCode code and the Codea project code. Any idea on these two issues?

  • Posts: 122

    I should mention the touch function that is not working is one that should bring up the keyboard.

  • DylanDylan Admin Mod
    Posts: 121

    @Deamos Can you post the smallest code that replicates the problem?

  • edited May 2012 Posts: 122

    It's a fairly large project so I'll try to post the parts handling the keyboard.

    function handleSearchBarButton(touch)

    if touch.x>=285 and touch.x < 485 and touch.state == BEGAN then
        if touch.y >= HEIGHT*.95 and touch.y <= HEIGHT*.95+35 then
            showKeyboard()
            return
        end
    end
    

    end

    function drawBoxes()

    --Zoom In/Zoom Out Buttons
    pushStyle()
    sprite("Eve Live View:44_32_44",WIDTH-76+36/2,HEIGHT*.95+35/2)
    sprite("Eve Live View:44_32_43",WIDTH-38+36/2,HEIGHT*.95+35/2)
    popStyle()
    popStyle()
    
    pushStyle()
    if mapStarLinesToggle == true then
        tint(0, 255, 26, 255)
    end
    sprite("Eve Live View:44_32_58",26,HEIGHT*.95+16)
    popStyle()
    
    pushStyle()
    strokeWidth(1)
    stroke(104, 104, 104, 130)
    fill(57, 59, 58, 194)
    rect(285,HEIGHT*.95,200,35)
    popStyle()
    pushStyle()
    fill(255, 255, 255, 255)
    font("Courier-Bold")
    fontSize(18)
    textMode(CORNER)
    textAlign(RIGHT)
    text(kbBuffer,288,HEIGHT*.95+9)
    popStyle()
    
    pushStyle()
    strokeWidth(1)
    stroke(255, 255, 255, 255)
    fill(27, 73, 145, 255)
    rect(485,HEIGHT*.95,35,35)
    fontSize(18)
    fill(255, 255, 255, 255)
    sprite("Eve Live View:77_32_49",503,HEIGHT*.95+35/2)
    popStyle()
    
    pushStyle()
    strokeWidth(2)
    stroke(255, 255, 255, 255)
    fill(80, 74, 70, 255)
    --rect(WIDTH-38,HEIGHT-100,35,35)
    fill(255, 255, 255, 255)
    sprite("Eve Live View:77_32_30",WIDTH-21,HEIGHT-100+35/2,28,28)
    popStyle()
    
    pushStyle()
    strokeWidth(2)
    stroke(255, 255, 255, 255)
    fill(80, 74, 70, 255)
    if infoBar == false then
        tint(212, 209, 209, 255)
    else
        tint(27, 255, 0, 255)
    end
    sprite("Eve Live View:44_32_24",WIDTH-23,HEIGHT-140,28,28)
    popStyle()
    

    end

    Those two functions draw/display the text and handle at least opening the keyboard for the input.

    If that isn't enough to replicate, I've posted the source in its entirety at https://github.com/deamos/Codea-Eve-Live-Viewer-for-iPad.

    Other than the noticeable slowdown and the opening of keyboard issue, all other touch functions are working perfectly. I don't know why this is happen as everything is working flawlessly from within Codea.

  • Posts: 122

    Any idea yet, @Dylan, on why its not recognizing the showkeyboard()?

  • SimeonSimeon Admin Mod
    Posts: 5,432

    @Deamos I think showKeyboard() is broken in the Codea Runtime Library. You've found a bug. We don't have a hidden text field to focus on for the keyboard in the runtime library — an oversight. I'll have to add it.

  • edited May 2012 Posts: 122

    Ahh cool. +1 bug found for me. Thanks @Simeon! I was tearing apart my code thinking it was a problem on my end.

    Edit: Almost forgot. Is there any reason why there would be around a 25% slowdown of a project in the transfer to XCode?

  • SimeonSimeon Admin Mod
    Posts: 5,432

    @Deamos perhaps you are running in Debug mode? When you do a final archive of your app it will be in release mode. Codea runs in release mode so it will generally be faster than a default Xcode build.

  • Posts: 122

    Ahh, now that would probably explain it. Thanks again, @Simeon. I'll try it out again when the Runtime gets updated.

    These are the reasons I prefer Codea over xCode and ObjC. Much simpler and allows me to focus on my idea, instead of dealing with the pits of iOS development.

  • Posts: 130

    Good job with Codea Runtime Library. I did not expect to see it now. I thought it will take more time to make a converter Codea to xCode. But, here is a little problem. What should I do if my game needs music or sounds?

  • Posts: 130

    Simeon, please answer me this question: What should I do if my game needs music and sounds?

  • SimeonSimeon Admin Mod
    edited June 2012 Posts: 5,432

    You can use sound() to generate sounds. Cargo-Bot also uses sound() to make music as well, using @Fred's ABC Music player library.

    Alternatively you can modify the runtime to expose music playing functions. I believe @frosty did this or his game.

  • edited June 2012 Posts: 130

    On the moment is fine with ABC Music player library. Thanks Simeon for this tip. I think that I have to read the entire board, may be more interesting things here.

  • Posts: 80

    I think @frosty wanted to share his changes to the code to achieve background music support... But it seems he didn't quite got to it yet.... But I'm sure he will as soon as he can :)

  • Posts: 2,161

    I've just gotten my hands on a Mac, so can now potentially make use of the runtime library. I'm not all that sure what I need to do and what I can do. I have Xcode installed, and I chose to include the iOS suite. So then I can clone the git repository and presumably compile stuff (haven't tried yet). At some point I clicked some link which started the process of registering me as an "Apple Developer", but I aborted before finishing the form (partly because the telephone number field insisted on having an area code).

    My basic question is: how much can I do before I have to pay someone something?

    That is, when registering as an Apple Developer then it didn't look like I was going to have to pay any money, but I presume that to get to the point of selling something on the App store then one has to do so. Is there some point before that where I can actually get something onto my iPad? Even just so that I can write something for my kids so that they don't have to keep clicking on Codea, selecting the program, and running it (with all the attendant dangers of deleting all my code).

    Pointing me to documentation would be fine.

  • Posts: 2,820

    @Andrew_Stacey - Without a developer account, the only things you can do is build an app in Xcode and test it in the iPhone simulator. You can not do an Ad Hoc (on the device) build or publish it to the app store. There are hidden ways to get your app on your iPad if your jailbroken, but that's very undocumented due to apple the bully. Hope that helps! Maybe I answered the wrong question.

  • Posts: 122

    I just ran across this nugget for anyone who does not have a Mac and still wants to develop for iOS. You still need a developer account and I have not tried it yet, but it sounds very promising.

    http://trigger.io/cross-platform-application-development-blog/2012/06/13/new-features-test-iphone-ipad-apps-on-windows-and-linux-embed-media-players-and-widgets-updated-toolkit/

  • edited June 2012 Posts: 130

    Another question about Codea Runtime Library.

    Marvel not that I said unto thee, I want to create a game with Codea,

    Everything seems perfect, one thing can ruin everything.

    I have iPad 2... If I will create my game with Codea on iPad 2,

    Codea Runtime Library will convert the game for iPad 3 with Retina Display?

    In other words, My game will looks good properly on iPad 3?

  • SimeonSimeon Admin Mod
    Posts: 5,432

    @Georgian it should work, but your art assets may come out slightly blurry unless you also include @2x versions (e.g., the file name is "yourimage@2x.png").

    The best way is to test — In Xcode you can actually test your app on the retina simulator. When the simulator is running choose "Device" from the menu and set it to retina resolution. Then you'll see how it will look.

  • edited June 2012 Posts: 130

    Simeon, If I put the image @2x, the position of @2x image will be the same on retina display?

    In other words, the game will looks Identic?

    But better, please give me a small example: A simple game with a normal image and one with @2x.

    An example will help me to understand how to do this work.

    But please give me an archived example, not .Codea

  • SimeonSimeon Admin Mod
    Posts: 5,432

    You can see it with the included sprite packs. Have a look at the Small World sprite pack. You'll notice @2x versions of every PNG file. These are used when running on retina devices — the idea is that they look the same but have the increased resolution necessary for retina display.

    You can try it yourself using the iPad Simulator.

  • edited June 2012 Posts: 130

    Simeon, thanks! (*) Finally I understood. #:-s I have tested and it works! B-)

    Thanks again for your patience to explain!

  • Posts: 1

    Hello all, I'm new to Codea and I'm very impressed what you guys have achieved here. thumbs up and thank you for your work.
    Before I start working on some real/bigger projects with Codea I want to know if I could use Codea and the Codea Runtime Library to produce paid apps or are there any legal/license issues which forbid this?

  • edited June 2012 Posts: 130

    Torak, Of course, you can produce games with the Codea and then

    you can publish your game on App Store as free or paid app.

    For more details visit this link: Codea Runtime README

    The Codea Runtime Library is licensed under the Apache License v2.0, so, Apache License is also for business. Please read more details from here: How to use Apache 2.0 license in commercial products.

  • edited June 2012 Posts: 130

    Simeon, There's a new problem with Codea and Codea Runtime.

    I don't like this phrase "Extracting your project's codea folder from the iPad can be done using iExplorer", why? Because requires my iPad to be Jailbroken.

    I need export proiect.codea from Codea directly. When you'll fix this problem?

  • beebee
    Posts: 381

    @georgian: You could extract your project folder from Codea app using iExplorer without any jailbreak. Have you tried it?

  • Posts: 130

    bee, it works! I think Windows XP had some errors, but finally it works.

  • Posts: 2

    Hi, is it possible to link in new code (eg c code) to the runtime and codea on the iPad somehow?
    You can to the runtime obviously enough, but I'd like to add external c to codea itself so I can write my app on the iPad and call extra code. I have a developer account if that makes a difference.

  • SimeonSimeon Admin Mod
    Posts: 5,432

    @Daven11 unfortunately, no. Apple doesn't allow runtime linking with shared objects on iOS, so we can't offer any sort of plug-in architecture.

    My only suggestion is to write dummy versions of your C-bound Lua functions in Codea (for example, for Game Center you could have it store scores locally). And then don't use those definitions when you link against your version of the runtime in Xcode.

  • Posts: 2

    Thanks. Thought I'd check just in case I'd missed something, back to the Mac or jailbreak :(

  • Posts: 266

    I was just wondering how you would add game center support to your game when using Xcode. I looked at @juaxix's objective c Xcode classes but I'm not sure what code I would use in my actual project. For example, if the user taps the high score button, how will I call game center and use that call in xcode. I'm uber confused one this

  • Posts: 2

    Grazie per il grande lavoro.
    Elvio (Alessandria - Italy)

  • Posts: 1,255

    Any timeline for upgrading the runtime to support 1.4.6? In particular, the lack of isKeyboardShowing() is a roadblock on my current app. Thanks.

  • SimeonSimeon Admin Mod
    Posts: 5,432

    .@Mark as soon as possible. I just need to back-port some render engine changes to the runtime version of the viewer.

    If you want to add this function temporarily, it is quite easy to do. Just modify DisplayCommands.m to add the following function:

    int isKeyboardShowing(struct lua_State* L)
    {
        BasicRendererViewController* vc = [SharedRenderer renderer];
    
        lua_pushboolean(L, vc.keyboardInputView.active);
    
        return 1;
    }
    

    Then register the function in the LuaState.m create method.

    LuaRegFunc(isKeyboardShowing);
    
  • Posts: 1,255

    Thanks very much. I'm away his weekend but cant wait to get home and recompile.

  • Posts: 1,255

    Worked dandy. Just had to add isKeyboardShowing() to DisplayCommands.h

    OnTopic is off to the app store. Thanks!

  • Posts: 1

    Two quick questions:

    I'm running codea code with xcode, into the iPad simulator.

    1. When I change something in the lua, I need to reset and clear the simulator before I see it. Is there a way to set up xcode so it knows that I'm changed the lua and does what it needs to do to update the sim?

    2. I've added a lua file called GameEngine.lua to the projects directory in xcode. It has a class called GameEngine. This class is not visible when running the game. But when I put the code into one of the original luas imported, say main.lua, it is visible. So my question is, when I add a new lua file to the xcode project, is there some other place I need to tell Xcode, hey there is a new lua file to look at. (Oddly, in the log when I run it, I do see gameengine.lua loading, but the classes in it are not being added)

    Thanks for any answers, suggestions.

Sign In or Register to comment.