Development Update And Photoshop Tools For Corona SDK Part 1

Rocket 5 IconIts been a few weeks since my last blog post so I wanted to update you all on what’s been going on and also kick off a new series.  First off, I’m working on a new production plan that should allow for more tech reuse between projects so that Rocket 5 can get more high quality games out on the market in a shorter amount of time. 

Up until this point, each of our games has been very different and so they’ve all been written basically from scratch.  We currently have 2 games in development that will test out this theory of tech reuse including some pretty big changes to XS Force (more on that in a future blog post).

In With The New

The biggest change that has happened is that I’m in the process of switching game development platforms from Unity3D to Corona SDK.  Unity3D has served me well over the last couple of years and I couldn’t have shipped Giant Moto, Holeshot Drag Racing, Small Space and Walken on iOS without it.  But I was starting to get bogged down with “too many features” and all of the overhead that comes with features that I’m not using – I’m at a point where I want to focus on making 2D games but since Unity is a 3D environment, there’s a lot of rule bending that I have to do to make my games.  There’s also the issue of of build size – it’s very difficult to make an iOS game under the magic 20MB app size – even when making a very simple 2D game.  And if I ever want to remove the Unity splash screen from the front of my games, I’ll need to cough up another $1,000+ for the pro license.  I’m not going to turn my back on Unity entirely though, in fact I’ll be using it to build a game at the upcoming Toronto Game Jam since it’s still a great prototyping tool and a super fast way to build games for the web and desktop.

The Missing Link

Corona SDK has so far proven to be a nice lightweight development platform that has all (or most) of the features I need without a lot of extra stuff I don’t need.  However one of the main differences between Corona and Unity is the lack of any kind of graphical editor in Corona – every object that’s displayed on screen has to be written into a .Lua script.  I’m a Level Designer by trade and so I’m used to being able to lay out levels, place triggers, enemies and waypoints, etc in a graphical design tool.  So after some early experimenting in Corona, I quickly realized that I was going to need some kind of tool for laying out my levels.

Maya Based Editor

My friend Mike suggested that I build out tile-based 2D levels in Maya and then export the information to a .Lua file with a Python script.  Mike wrote the script and it worked pretty well, but there were some workflow issues with using Maya (It’s like using a jackhammer when you really just need a butter knife) and since I don’t know Python I’m pretty slow at adding new features to his script.

Photoshop Based Editor

I knew that you could write scripts to automate tasks in Photoshop, but it never occurred to me that it could be used as a level design tool until I ran across Alex Souza’s Fireworks to Corona Exporter which lead me to his Photoshop Corona exporter that actually comes bundled with the Corona SDK.  After looking over his scripts, I realized that I could rewrite Mike’s Maya Python script in JavaScript and use Photoshop for my level editor instead!  After about a day of writing the exporter scripts, I now have a very versatile and usable level editor based on Photoshop.

I’m not going to get into all the details of the export scripts here since I’m still refining them – I’m planning to do another blog post later to show you them in action (notice this post is titled “Part 1”).

Photoshop Layer Renaming Script

My level exporter relies on Photoshop Layer and Group names for stuff like texture names in the exported .Lua file.  But when you duplicate layers and groups in Photoshop it automatically adds ” copy”, “copy 1”, “copy 2” etc… to the end of the new layer name (I hear PS CS5 has an option to turn that off, but I’m using CS3).  Since my levels are based on 16×16 pixel tiles, I’m duplicating a lot of layers and so I have dozens of these layers that need to be stripped of the ” copy 1″ text.

Photoshop Layer Names

Rather than rename these all individually, I turned to the interwebs and found a couple of different solutions to the problem (honestly I thought I would find way more).  The best one I found was RenameLayers.jsx by Mark Walsh.  It works great for removing the extra text that Photoshop adds, but unfortunately his script executes on every .psd that’s currently open in PS and since the script can be a little slow if you have several complex files open it could take a while to complete.  So I modified the script so that it only works on the currently active .psd file.

UPDATE: I found a way to make the renaming script significantly faster and it also works on any layer in the scene unlike my original script (which I have removed from this post). The new method requires stdlib.js which you can download from here.

And you can download the layer renaming script from github: Download Rename Layers.jsx

Save Rename Layers.jsx in /Applications/Adobe Photoshop CS3/Presets/Scripts if you’re on a Mac or C:\Program Files\Adobe\Adobe Photoshop CS3\Presets\Scripts if you’re on Windows. And save a copy of stdlib.js in that same folder.

If Photoshop was running when you added the script to the folder, restart PS. To run the script in Photoshop go to File –> Scripts –> Rename Layers. It won’t be obvious that the script is running except you’ll get an hourglass and you won’t be able to do anything in PS. If your file has a lot of layers, the script can take a while so be patient. I suggest testing this on a smaller file first before you try it on a .psd with 100’s of layers just to make sure it’s working properly.

Feel free to modify Rename Layers.jsx to meet your own needs.


I’m planning to post more about my experiences with writing JavaScript tools for Photoshop that are more specific to improving game development workflow with Corona SDK, so stay tuned!

If you like this post, please be sure to follow us on Twitter and Facebook to keep up to date with everything that’s going on here at Rocket 5.

Show Your Support

If you find these tutorials useful, please considering buying one or more of our games and apps for iPhone and iPad. Your support helps to keep the tutorials flowing!

  • Giant Moto: High flying arcade style motocross action!
  • Small Space: Fly a spaceship, eat space creatures, score point!
  • Holeshot Drag Racing: High speed drag racing action!
  • Alien Booth: Transform pictures of your friends into awesome aliens!
  • iSpoof Walken: A hilarious look into the world of Christopher Walken!
  • Gaga Eyes: Transform pictures of your friends to give them huge anime eyes!

12 thoughts on “Development Update And Photoshop Tools For Corona SDK Part 1

  1. Pingback: Photoshop As A Level Editor For Corona SDK | Rocket 5 Studios

  2. Pingback: Cool Indie Level Editors | Rocket 5 Studios

  3. Sultan

    Please, could you tell how to use the script?
    I did as in your post, but new duplecated layout still has ” copy 1″.

    I guess that I have to run it, but how?


  4. Sultan

    I have found how it can be done (run script).

    File> Scripts and select the script from the list RenameLayers.jsx

    The problem photoshop has hug.

    I’m using CS4, 
    has anybody checked it on cs4?

  5. Tim Miller

    Glad you figured it out.  If your file has lots and lots of layers and/or if your computer is slow it will appear to “hang” while the script is collecting layer information.  I’ve only tested it on CS3, but it’s only using basic functions so I can’t imagine they changed them between versions.

    Also which version of the script are you using? The “new faster script” or the “original slow script”? You should use the faster one obviously, the older one is very slow on large files.

  6. Sultan

    Yes, you are right! I had file with ~400 layouts, and I was waiting for a long time and I decided that it hung, my pc is fast (Intel Core i5 3.20GHz/8GB RAM) but still very slow!So can you, please, make script to apply only to selected layouts/folder to rename, not for all layouts in file?Additionally I have CS4 in russian so I had made some changes in script, I have changed “copy” to “копия”, so now it works fine!Old version of the script did’nt work with my PS, but your modifed (faster) script works well!Thanks a lot!

  7. Rober Stehwien

    Curious if you are still primarily using Corona or if you came back to Unity (with the latest unity tutorials).  Be interested in hearing your preference months later.

  8. Pingback: Photoshop As A Level Editor For Corona SDK. « hapticmobile

Comments are closed.