Introducing PlayScript

Over the last year Zynga has been looking at solving a hard problem in the mobile and web space: how do you deliver games that run on both mobile and web simultaneously without having to do a full port.

Although there are a variety of technologies out there that solve the problem to some degree or another, none of them were quite right for Zynga.

What we wanted was a single language that could then be compiled to a variety of run-times allowing us to quickly build 3D games for both web and mobile devices.

We looked at technologies like HTML 5, hAxe, Native Client and others but they all suffered from a distribution problem: not every browser supports 3D (IE) or the tool doesn’t support 3D (hAxe) or the technology is limited to one browser (Native Client)

So a couple of our great engineers looked at the problem and decided to see if there was a way we could bring actionscript games to mobile.

And so PlayScript was born.

PlayScript provides a Flash compatible runtime and rendering environment on mobile via OpenGL via the .NET platform, allowing games to be written once and run across web and mobile with the same code base.

PlayScript compiler and runtime has been released to open source under the Apache license.

You can find it here:

https://github.com/playscript/playscript-mono

Happy Hacking!

14 thoughts on “Introducing PlayScript

  1. Raoul Duke

    Wow. Very cool, and terribly nice of Zynga to release it for other people to get to use and study! (For people who are interested in this kind of very nifty thing, there’s also http://www.haxenme.org. Pretty close in philosophy I think; closer than, say, Cocos2d-x etc.)

    Reply
  2. kostadis roussos Post author

    haxe was definitely an inspiration.

    One thing to note – for 2D we have a great solution in Cocos-2D-x. Our challenge was really around finding a 3D solution.

    Reply
  3. Pingback: Zynga introduce PlayScript compiler and runtime

  4. kivancgumus

    Can you explain more details about the porting problems? Why other developers must use this compiler. How can it help? Could you publish the case study for that. Thanks.

    Reply
  5. mick

    Looks very promising! One thing I don’t really get: Is flashplayer a (current) target for the PlayScript compiler, as it is for haxe?

    Given that a lot of your facebook games are flash games and you say “for both web and mobile devices”, how do you achieve it with Cocos-2D-x as you mention it as a great solution for 2D content? Does Cocos-2D-x target flashplayer and I’m simply overseeing it? Or (and in general) do you plan to publish web games for HTML5 only? Would be nice if you could give me a hint.

    Reply
  6. kostadis roussos Post author

    @kivancgumus – other developers can do whatever they want ;-). The nice thing about playscript is that it lets you write your game in actionscript compile the code using flash builder and then take the same code and compile it to run on a mobile target.

    @mick it’s a little bit different than haxe. In haxe’s case the, haxe must compile the code to something that can run on the flash vm. In our case we don’t because playscript is a superset of actionscript. So you can just take the code and compile it using flash builder

    Reply
    1. kostadis roussos Post author

      The big advantage over adobe air is that dealing with performance and native language integration is much simpler. Mono gives you significant advantage in that respect through the native language bindings and the C# language features that are part of playscript.

      Reply
  7. mick

    So to compile it using flash builder it has to be as3 only, am I right? One could use PlayScript to some kind enhance things for mobile devices etc.?

    Reply
  8. kostadis roussos Post author

    Yes it has to be as3 to run in flashbuilder. but you could use playscript to do optimizations for mobile.

    Reply
  9. Viviana Baldarelli

    it looks promising. Can you shed some light on the workflow? What editor to use? (I assume Flash Builder will be perfectly fine) How to compile? Command-line compiling or is there a tool? Are there different compilation workflows for different platforms?

    Reply

Leave a Reply to Viviana BaldarelliCancel reply