Howdy, Stranger!

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

Codea 4 - Official Thread

JohnJohn Admin Mod
edited April 23 in General Posts: 762

Hi everyone

It's been a while since I did any kind of official update on Codea 4, and I've mentioned it on Twitter as well as in various threads when its come up. So I thought I may as well make an official thread to talk about it. I've started writing an introduction / migration guide to explain all the differences with the feature set, engine technology and any API changes that break backwards compatibility

Obviously Codea 4 isn't out yet and won't be out for a while but I really want to get at least a beta out to testers very soon. This is the biggest and more fundamental change to the engine that we've ever done and has taken years of our time. I want it to be as well received by the community as possible, but obviously that requires time and feedback from testers and users. Some of the changes might surprise or even annoy some of you, but I do believe its a big step forward

List of changes and migration guide:


  • Posts: 297

    I look forward to seeing the beta as soon as possible.

    No voxel systems, no craft.noise. Were they abandoned, or deeply integrated?

    In addition, is Codea 4 released as a new, standalone app, or as an update to the current Codea?

  • JohnJohn Admin Mod
    Posts: 762

    The documentation is a work in progress so some stuff hasn't got a mention yet.

    craft.noise can be put back in fairly easily. The entire voxel system is pretty complicated but I want to give it the same treatment as everything else (more streamlined and tightly integrated). It just hasn't been done yet.

    This release is an opportunity to rework systems, so I'd been keen to hear if there's specific ways voxels can be improved. I think my mistake the first time around was underdocumenting it but also it being such a big complex system in the first place. I almost just want to have voxel volumes that are really flexible without requiring a lot of setup

  • edited April 23 Posts: 297

    It's nice to hear that voxel systems can be maintained, and I think it has a lot of potential and is well worth the time it takes to maintain it (for developers) , it is also well worth the time spent in-depth learning (for users) .

    But it was also complex enough that it took me a while to understand its basic use. Regarding the system documentation, I've been going through the Codea4 documentation, and it feels like a big deal.

    Do you need the assistance of the community? I'm talking about documentation assistance. I'm sure there are plenty of people who would be happy to help, including me, if necessary.

  • edited April 23 Posts: 2,689
    @John - thanks for adding this thread. As I've mentioned before 4 looks very interesting from the hints you've posted previously and from your initial documentation. Codea support and documentation has always been good so I'm expecting to pick up any changes soon. I agree that a little more information/tutorials would have helped with voxels in 3, maybe some YouTube video tutorials? Or you could leave that to the users.

    Waiting in anticipation. Thanks again for the thread

    Edit: could be useful up front to let users know if there are any limitations on what kit can support it and any limitations - like introduction of metal etc.
  • JohnJohn Admin Mod
    edited April 23 Posts: 762

    The documentation is hosted on github and is automatically regenerated from source when new commits are pushed. So any approved pull requests will automatically update it. In case you are interested we're using for our new documentation

    I'll be sure to add a section that will make note of any features that are missing and still in the works. From off the top of my head the following are currently missing:

    • Voxels
    • AR
    • Sensor data - camera, accelerator, gyro, magnetometer, GPS
    • Noise functions

    On the bright side the new internal engine structure is very modular and makes it very quick to add new features / integrations

    Some new features that have been added that I haven't really talked about:

    • Built-in UI system (still in early stages, similar to Unity 2D Canvas and Shade UI)
    • Compute shaders (including a falling sand demo I've done)
    • ImGUI support (experimental)
    • Skeletal animation
    • Shadow maps
    • New tween system
    • Keyboard events (key press/release events)
    • Gamepad support (i've tested this with my PS4 controller on both bluetooth and directly connected)

    There's also the scene editor, which is still a work in progress

  • Posts: 2,689
    @John - thanks for the update, the new UI based on Unity sounds interesting. I'm assuming you are using a slide-in panel to achieve that.
  • JohnJohn Admin Mod
    Posts: 762

    Added support for skinned mesh animation import (exposed via mesh.animations

  • edited April 23 Posts: 308

    Can’t wait to try it out, seems like it will be straight forward for 2D ~but I wonder about shaders, will raw glsl code still work?~ oh never mind you already answered this and the answer is yes can still use glsl

  • JohnJohn Admin Mod
    Posts: 762

    @skar Yes, we have a shader cross-compiler from GLSL to MSL. No doubt we'll run into bugs here and there since the process isn't 100% reliable. But at least we get compute shaders!

  • Posts: 72

    It looks amazing!

  • Posts: 535
    Sounds promising! If you want a wishlist, it would be nice with a moveandslide() api for physics similar to godot, to more easely make platformer physics. A simple version of a numpy like api for working with image data would be nice for general algorithms. And looking into the possibility to use gps and bluetooth in the background (maybe not possible) would open up for some more use cases. Well the list could be longer :)

    Keep up the good work :)
  • edited April 24 Posts: 308

    @Simeon @John not to put a damper on things but I didn’t notice any docs regarding breakpoints and debugging. There was previously a mention of the possibility and desire to add better support for debugging so I hope it hasn’t been totally forgotten. I got stuck on a bug that was really difficult to figure out using print statements. :)

  • JohnJohn Admin Mod
    Posts: 762

    @tnlogy The move_and_slide() function for their KinematicBody class looks interesting. Not exactly sure how to implement it (Some kind of one way collision processing I presume). At the very least we'll have kinematic bodies that can be moved manually, will have to look into this kind of thing though. As for image processing I've found that compute shaders work pretty well and I have made some image filter classes using them

    @skar I'm still looking into proper lua debugging. I've actually got some stuff working with a socket-based remote debugger, but I need to build a front end to both control and display the results. I wanted to prototype one using Codea itself but you end up with a paradox (lua is frozen while being debugged). I also tried multiple multithreaded instances running in parallel but that comes with a host of issues. So I think either a web-based javascript debugger or a native swift-ui one will probably have to do. Still needs more work. Either way the debugger will exist inside and be possible to remotely access, but might require some hacking before an official debugger interface is built.

  • Posts: 535
    @John you can check out their code at but it is a bit messy, since they have some special cases for moving platforms etc. I tried to implement something similar with Codeas api, using raycast and Kinetic body, but didn’t succeed. To have a similar API would simplify things a bit. Another perspective on it would be to enable collision checks between kinematic and static bodies in box2d, like in defold

    Ok, guess I will stick to shaders for processing :)
  • Posts: 35

    What is the main goal of Codea 4, the reason why you want to change the version from 3 to 4?

  • JohnJohn Admin Mod
    Posts: 762

    There are quite a few reasons. The current runtime is around 10 years old now and many of the technical decisions over the years have made maintaining it much more difficult than it should be and have made it all but impossible to support certain features

    Goals for Codea 4
    * Changing render API from OpenGL ES to Metal (future proofing)
    * Moving closer to a pure C++ backend (future cross-platform support)
    * Merging redundant or duplicated craft features (mesh/model, texture/image, shader/material, etc)
    * Streamlining various API calling conventions
    * Improving Lua bindings (making new features easier to add in future)
    * Compute shader support (impossible with OpenGL ES on iOS)
    * Editor support and scene serialisation
    * Reduction of technical debt, spaghetti code and making overall engine design more modular

  • Posts: 128


    Built in 3D movement commands would be nice (e.g. Entity.move.forward or Entity.move(vec3(x,y,z)) where x,y,z are movement relative to the entity rather than x,y,z coordinates in the 3D scene).

    Thanks! :-)

  • JohnJohn Admin Mod
    Posts: 762

    @SugarRay Could have something like myEntity:translate(x, y, z, LOCAL|GLOBAL) which gives you both options

  • JohnJohn Admin Mod
    edited April 26 Posts: 762

    Just a note as well in Codea 4 you can add new functions to existing built-in types.

    So if you wanted to you could do this:

    LOCAL = 1
    GLOBAL = 2
    function entity:translate(t, space)
        space = space or LOCAL
        if space == LOCAL then 
            self.position = self.position + self:transformDirection(v)
        elseif space == GLOBAL then
            self.position = self.position + t

    And now you can use this function on any entity

  • Posts: 128

    @John: Great!

  • Posts: 661
    @John Looking forward very much to Codea 4. Remember you don’t have to have everything implemented to release the beta-I am a bit worried you will keep adding new features and delay a long time before making it available!
  • JohnJohn Admin Mod
    Posts: 762
    The only hold up right now is getting the editor ready. Also considering if it needs to be a separate app (even if just for the beta) so that you can easily keep running 3.x projects without having to switch builds
  • Posts: 35


  • Posts: 308

    if it needs to be a separate app (even if just for the beta)

    if it’s a separate app then keep it separate so we don’t have to migrate twice

  • Posts: 7

    This sounds like great news. I was metal-openGL concerned. Also shows that the people behind Codea keep working on it.

    I would imagine the ETA for Codea 4 to be out is a year away? (so May 2023?).

    I would in particular welcome a very robust export to Xcode to recompile as I am seeing a lot of issues in Codea 3 regarding that, and I can't see how you publish on the store an App without recompiling it.

  • Posts: 308

    a couple more things i wonder about, not trying to delay any development but we can’t pause sounds, will there be any improvements on the sounds system?

    any plans to add video playback support? it would be ideal to be able to play videos in containable boxes as well as full screen

    there were some posts about controller (external device) support, and @jfperusse gave us an easy way to use objc to add support but will it be built in to codea 4?

  • edited April 30 Posts: 171

    I'm really looking forward to Codea 4, it really looks amazing!

    It would be great if it could be its own separate app (or if you could somehow keep the Codea 3 runtime as an option). Otherwise, it might be a little intimidating to update as projects could break - especially if it is still in beta and going back to the AppStore version might be difficult or require to migrate back to the old API. I don't know, though, how easily we can transfer projects and e.g. the documents-folder from one app to another.

    I agree with @skar on the sound system. As far as I know, 'pan' doesn't work for sounds that are already playing and it's not really transparent how many sounds can be played at the same time. Sometimes, if there are only a few sounds playing, new ones are simply ignored. It would be great if that could be improved some time in the future.

    Anyway, this really looks to be the biggest step forward for Codea and I can't wait to give it a try!

  • JohnJohn Admin Mod
    Posts: 762

    @Elias if it remains a single app then 3.x projects will still be supported

    Sound system is improved with support for pausing, fading, seeking with potential for buses, ducking, filters etc… there’s also a waveform generator so you can make procedural sounds

    I’ve got a visual debugger interface working in Codea 4. Technically it could work in Codea 3.x as well but be slow due to lack of support for OP_HALT which requires a regression to Lua 5.3 at the moment

  • Posts: 171

    Oh, if that's the case then a single app might allow for easier migration as all assets and projects are already there. But both approaches seem sensible to me.

  • JohnJohn Admin Mod
    Posts: 762

    Sneak peak into some of the progress on Codea 4.x

    Beta is coming along and will be putting it out there soon hopefully

  • JohnJohn Admin Mod
    Posts: 762

    I've started work on a tutorial series for Codea 4 as well: to Codea

  • edited May 10 Posts: 2,689
    @John - just scanned through your examples for 4 and, I'm assuming there's more to come, they are intriguing - looks like you are setting up separate windows for parameters etc and shaders look good. Is there a new Codea icon on view in there?

    Only 1 suggestion, not going into some of the Lua text facilities, but a simple example of concatenation of text to text and text to variable (in the text example) would be useful.

    Thanks, will keep looking through these and post any ideas I have.
  • JohnJohn Admin Mod
    Posts: 762

    @Bri_G Yes there is more planned, I've only just started sketching out what I want to have. There are a lot of potential topics and concepts to cover

    Not sure what you mean by text concatenation, are you referring to the Dialogue project?

  • Posts: 2,689
    @John - nothing so sophisticated, I just meant the addition/extension of strings. Like :


    Foo = 21

    print("Foo is equal to : "..Foo)


    Showing the ability to build strings and incorporate values. Added to Hello.lua .

    p.s. apologies if the code formatting doesn't work, wrote this on my Android phone.
  • JohnJohn Admin Mod
    Posts: 762
    Oh I get what you mean :)
Sign In or Register to comment.