logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
embedded serverside js: user-scriptable persistent worlds

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Linux development
View previous topic :: View next topic  
Author Message
elven



Joined: 28 Jul 2006
Posts: 259
Location: Germany

PostPosted: Wed Jul 11, 2012 17:47    Post subject: embedded serverside js: user-scriptable persistent worlds Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Linux development All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group