Jump to content

scripting


Recommended Posts

How did you guys manage to embed the javascript in this game?
By writing code to embed it :). We use SpiderMonkey (the JS engine used in Firefox), which is designed to be easily embedded into non-web-browser applications.
What is it being used for?
For implementing gameplay code (currently not much, but it should be much more in the near future), and for GUI behaviour.
Is any other language used for scripting?
No.
and why not Lua? Isn't that much mroe popular than js?
There's a trillion pages on the web and two thirds of them use JavaScript; how much more popular do you want? :ok: It's true that JS seems to be rarely used in games, but we chose JS a long time ago (before I joined the project) and I think it was a good decision (since it's quite a nice language, and implementations have been improving a lot recently).
Link to comment
Share on other sites

Ah, I see.

but what do u mean gameplay code ?(what aspects of it) how are u guys separating the game code from the engine? (is there a rule of thumb to decide where to put what?)

sry if the questions seem a bit vague...I'm not sure how to phrase it

Edited by buggy123
Link to comment
Share on other sites

Gameplay would be things like deciding when to promote units, the effect of auras, harvesting - basically what defines 0ad. The rule of thumb for adding new gameplay-related code is: if it should be moddable (by non-C++-programmers) and it's not time-critical and there's no tight coupling with existing C++ code, write it in JS.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...