elven
Joined: 28 Jul 2006 Posts: 259 Location: Germany
|
Posted: Wed Jul 11, 2012 17:47 Post subject: embedded serverside js: user-scriptable persistent worlds |
|
|
Hi.
This is another side project idea of mine. The basic idea is to allow players/users/anybody edit and scripts, which would be able to act on ingame objects and events.
Concept
============
* Github Wiki
Implementation
============
The project is in it's early stages, and the concept a moving target. But there's code! (which depends on nwnx_jvm)
The actual implementation is javascript-based (Mozilla Rhino), and as such, user code needs to be written in JS. Javascript has been chosen for it's simplicity (regarding embedding and sandboxing), and because nearly every scripting language can target js in some form.
Currently working code looks like this (note that this is CoffeeScript, which translates to plain old JavaScript. You could use any stack which outputs js in the end):
Code: | script.set "message", (from, message) ->
this.log "Got message from " + from + ": " + message
script.set "creature.sees", (other) ->
this.log "I am seeing: " + this.getPerceivedCreatures(50.0)
this.message(other, "hi")
this.taskFollow(other, 5) if other.objectId() == 4
script.set "creature.hb", () ->
this.log "my tasks: " + this.taskList().length
cn = (num for num in [0..100000])
|
As it is currently, running the code is only of interest to people versed in Scala and too much time on their hands. If you're interested in participating with development, ideas, and/or running this as it grows (as a test bed), feel free to ask for specifics.
As always: ideas and comments welcome. |
|