I have been looking around for clues on the subject but I'm not convinced to commit to javascript as my primary scripting language.

Currently I have started with lua. But I fear it will be a limiting choice for my future projects which include web clients for my games.

So basically I would like to know if you think it would be a viable solution for handheld devices and consoles.

Also, I would be glad to hear about:

  • anyone who had much success with javascript in cross platform games
  • failures with javascript scripting engines
  • restrictions within console SDKs that would prevent this type of solution
  • successes using lua in web games
  • \$\begingroup\$ Is it "sound"? You shouldn't use colloquialisms like that. Not everybody will have English as a first language. Innit. \$\endgroup\$ – Charles Goodwin Oct 9 '11 at 23:42
  • 5
    \$\begingroup\$ That's not a colloquialism, with the adjective version the word means "having no defect" as in the common phrase "safe and sound." It's also a noun and verb, which is probably what you're thinking of. \$\endgroup\$ – Patrick Hughes Oct 10 '11 at 1:29
  • \$\begingroup\$ Sorry I have been reading too many books. English is not my 1st language. You are free to reformulate the question. \$\endgroup\$ – Coyote Oct 10 '11 at 7:31

Javascript is absolutely getting more popular for the task and there are already games in apple's AppStore and the others that prove this. Besided the game libraries like crafty or impact, a lot of new technology around javascript has emerged over the last months and you might want to look at

  • CoffeeScript to write Javascript much quicker
  • Backbone.js to structure your game a lot more (I seriously use this in a game)
  • Jasmine (in case you are paranoid enough to write tests for you game)
  • localStorage in newer browsers to save the players data.

In can you create a server-client game then node.js is also something to look into.

When you start your game please be aware that there's not only canvas or webgl but for some games svg or even plain html with some awesome css transformations might be useful as well.

| improve this answer | |
  • \$\begingroup\$ I'm off to quickly checking CoffeeScript, Backbone.js and node.js. \$\endgroup\$ – Coyote Oct 10 '11 at 7:29
  • \$\begingroup\$ While crafty and impact offer good solutions for mostly web dev, I am not looking into full JS game engines. I might try to integrate V8 to my engine later on but for my current project I will restrain from using too much scenario data as to avoid having too much scripting to do if I can. Backbone.js and node js have elements I would reuse... Thanks. \$\endgroup\$ – Coyote Oct 20 '11 at 11:42
  • \$\begingroup\$ Hi, apart from the UI I have now something approaching a working solution where I can share some game logics and model across the nodejs server and phone gap test project. Thanks for the pointers. \$\endgroup\$ – Coyote Mar 4 '12 at 11:10

The JavaScript you would write for your desktop game's scripting would likely not be the same as what would be used as a web client (Assuming by this you mean running in the web browser). An exception would be if you are talking about using an existing engine that uses JavaScript, like Unity3D, which is already cross platform and can be run in a web browser.

The issue is that if you embed JavaScript in your engine so that you can script your game in JavaScript, that doesn't all of a sudden mean your engine can be run from the browser.

| improve this answer | |
  • \$\begingroup\$ I totally agree with you; embedded JavaScript doesn't mean the engine can be run from the browser. That's why I am looking into this but I am still skeptical. The amount of code I can reuse will not bring loot women and instant glory to the table. But if at least a part of the game (let's call it game-core-script) can be shared by the different projects I will be happy to have only one place to go to add and change a few scripts and get all the changes applied in all the projects sharing game-core-script. \$\endgroup\$ – Coyote Oct 10 '11 at 7:27
  • \$\begingroup\$ Yeah, that is certainly possible, but it does still depend on which engines you'll be using. One thing you could do, though, is write a sort of framework on top of the engines such that the client code of the framework (your core game script) will be able to use the framework on top of each engine in the same way without caring what engine it is on top of. \$\endgroup\$ – DeM0nFiRe Oct 10 '11 at 13:07
  • \$\begingroup\$ That's the idea. \$\endgroup\$ – Coyote Oct 10 '11 at 13:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.