Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Server-Side JavaScript engines?
06-15-2010, 11:31 AM
Post: #1
Server-Side JavaScript engines?
I recently came across a powerpoint talking about HTML/JavaScript engine called Aves. During that, I saw a mention of NodeJS which then led me to the V8 JavaScript Engine from Google.

It piqued my interest into thinking that a MUD engine might be able to run via JavaScript on the server. The question that first comes to any sane person's mind is "why"? Well, I find JavaScript to be extremely robust. It's Prototype Object Oriented structure makes objects very flexible. Once could add methods to existing objects quite easily, extending them and enhancing them.

I can imagine a MUD where all development is done through the web (via a Web-Based IDE). The MUD Lib developers create the base library. The creators can then extend them quite easily. You could even incorporate event based handling to abstract it even more.

The possibilities are very intriguing for me...
Find all posts by this user
Quote this message in a reply
06-15-2010, 11:08 PM
Post: #2
RE: Server-Side JavaScript engines?
Most Javascript engines currently available have issues with closures and efficient memory management.

Granted you may want to take a look at Coffee MUD for inspiration. Yeah the heavy stuff is handled in Java (if that suits you) but all the scripting is strictly done in the JS engine "Rhino".
Quote this message in a reply
06-17-2010, 10:25 AM
Post: #3
RE: Server-Side JavaScript engines?
So spent some time the past couple of days playing around with NodeJS (which is built on-top of Google's V8 JavaScript Engine). My initial, very preliminary opinion is that is very possible to write a complete and complex MUD using this. In fact, it is so intriguing that I'm going to give it a stab: jsMUD is now my next attempt at AJAX/Browser Based MUDs. The PikeMUD that I was working on will have to wait. I was having way to many issues with the sandboxing that I started to give up on it.

A quick search on the internet shows that someone else has a mud called jsMUD as well. Oh well, it might not be original, but it'll have to do for now.
Find all posts by this user
Quote this message in a reply
06-20-2010, 05:16 PM
Post: #4
RE: Server-Side JavaScript engines?
Interesting. So are you working with the google app engine at all, or is GAE just for web hosting?
Quote this message in a reply
06-21-2010, 10:11 AM
Post: #5
RE: Server-Side JavaScript engines?
(06-20-2010 05:16 PM)York Wrote:  Interesting. So are you working with the google app engine at all, or is GAE just for web hosting?
Actually, it's something called NodeJS, which extends Google's V8 JavaScript engine. I'm playing around with having a mud driver/engine and library being written completely in JavaScript. I'm testing out some sandboxing features, seeing how to implement a form of inheritance, etc.
Find all posts by this user
Quote this message in a reply
06-24-2010, 11:59 AM
Post: #6
RE: Server-Side JavaScript engines?
On the plus-side integrating with CouchDB would be a cinch. Wink
Quote this message in a reply
07-21-2010, 12:04 AM
Post: #7
RE: Server-Side JavaScript engines?
So I've done some more coding against NodeJS, thought about how I would approach a new mud engine written completely from JavaScript, and this is what I've come up with so far.
  • NodeJS is very event driven and asyncronous, which means that you have to program slightly different that we are all use to. It's not an obstacle, just a different approach that needs to be planned for. This also means that synchronous calls are basically non-existent, which would be difficult for some to grasp, but makes other things much much simpler (i.e. Heartbeat is now an event that people subscribe to instead of a callback that you define).
  • By using JavaScript, I decided to change my standard OOP approach from the classical class-inheritance style to a the prototype style. More on this later.
  • Everything in the MUD library should be based off of Entity, which is simply a collection of components. A component is a self-contained unit that provides a specific function (i.e. physics, ability to hold things, etc). This is different from the normal approach in which you would inherit from object to create an item class, then inherit from item to create a container class. Instead, you create an entity and add the abilities you want to it.

So back to the prototype vs class approach. This is my very broad, and probably incorrect, summary of what prototype OOP is:
Instead of declaring a class (and sub-classes) in which you create instances, you take an existing object and extend it with new functionality. There is more to it, but you get the idea, and JavaScript has a slightly modified approach to that.

Either way, it makes for a different feel when developing your engine and MUD library. But it also provides you with a level of flexibility that is simply awesome, especially at the library level. That prototype-based language with component-based architecture will lead to a very powerful and flexible system.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)