doughsay / room.js Goto Github PK
View Code? Open in Web Editor NEWA node.js MOO server
License: MIT License
A node.js MOO server
License: MIT License
An overridden verb needs to have the exact same name as it's parent verb, otherwise it will be considered a different verb. If the name evaluates to the same propName, it will cause an exception in enumerate. I may just need to separate verb 'names' from verb matching patterns...
A player's manual and a programmer's manual needs to be written. The readme is outdated and incomplete.
Sending a lot of "look" commands all at once crashes the server. Apparently related to node-fibers.
` by itself doesn't seem to exhibit the same behavior.
Since verbs now pre-compile their code, the server needs to check submitted verb code for correctness, otherwise it causes a crash in the compile step.
When you add a new verb or property to an object, it should open a tab for it as well. For convenience.
It only counts changes to the code, and sometimes thinks it's been changed when it hasn't.
This is what I think I've observed:
The first time a cron task runs after a server startup, it fires 2 seconds before it's supposed to and then again 2 seconds later. It starts behaving normally after that.
Create a new editor that is more IDE-like. Features should include:
If we store when a user logged out we can display how long it's been since they've been online.
When calling many verbs in a loop, it causes a lot of overhead due to the way room.js created contexts and proxy objects and such.
e.g.: On rjs.infinitymotel.net the players
verb times out when calling the title
and idle
verb of each player in a loop.
For instance, [MooObject ambiguous_match].list
would yield `[ [MooObject wooden sword], [Moo Object iron sword] ]
Continuing the example from issue #1:
Example:
# usage: look at sword
#=> Look at which sword: wooden sword, iron sword?
# usage: look at wooden sword
#=> This sword clearly isn't as strong as, say, an iron one.
# function definition
String.prototype.capitalize = ->
this.charAt(0).toUpperCase() + this.slice(1)
if $prepstr
switch $iobj
when $nothing
$player.tell "Look " + $prepstr + " what?"
when $ambiguity
$player.tell "Look " + $prepstr + " which " + $iobjstr + ": " + (obj.name for obj in $ambiguity.list).join(", ") + "?"
when $notFound
$player.tell $iobjstr.capitalize + " doesn't seem to exist in this room."
else
$player.tell $iobjstr.description
else
$player.tell $here.description + " Contents: " + (content.name for content in $here.contents).join(", ")
{spec: '* * * * * *', verb: 'think', enabled: true}
It's boring and non-demonstrative right now. Definitely push up the exits and web api demo objects.
Changing an object's parent from something to null doesn't trigger a proper update in the editor and the object is removed from the object browser.
Allow the client to be configured.
Things we can configure:
This could be configured in a modal style form, or a new page of sorts. Persistence could be achieved using https://github.com/marcuswestin/store.js/
Add support to swap out client color themes.
http://www.departmentofpersuasion.com/slothpunchclub/
I mean, he mentions MUDs right in the post!
Overhaul and refactor all logging using log4js.
Currently there is no way to check if an $obj wasn't found, or an ambiguity was found. For comparison with return values of $dobj
and $iobj
in verbs, similar to $nothing
.
Example:
# function: l*ook none any any
# (effectively combines look and examine verbs)
# usage: look
#=> What a pretty room you're in! Contents: wooden sword, iron sword
# usage: look under
#=> Look under what?
# usage: look for weapon
#=> Weapon doesn't seem to exist in this room.
# usage: look at sword
#=> Look at which sword?
# usage: look at wooden sword
#=> This sword clearly isn't as strong as, say, an iron one.
# function definition
String.prototype.capitalize = ->
this.charAt(0).toUpperCase() + this.slice(1)
if $prepstr
switch $iobj
when $nothing
$player.tell "Look " + $prepstr + " what?"
when $ambiguity
$player.tell "Look " + $prepstr + " which " + $iobjstr + "?"
when $notFound
$player.tell $iobjstr.capitalize + " doesn't seem to exist in this room."
else
$player.tell $iobjstr.description
else
$player.tell $here.description + " Contents: " + (content.name for content in $here.contents).join(", ")
$room.test (this, with/using, any) = $this.test_two()
$room.test_two (none,none,none) = $player.send $dobj.name + ', ' + $prepstr + ', ' + $iobj.name
command: test here with wooden sword
output: nothing, undefined, nothing
expected output: A Forest clearing, with, wooden sword
Removing objects using rm
does not remove any references to that object. A db with references to removed objects will create null
s in places that can cause exceptions.
commit 6fba849 added node-fibers so that long running verbs can yield to the event loop so other players are not affected. Node-fibers won't compile for node 0.11.3. So for now, use node 0.10.x, but you won't have the verb timeout feature.
Creating and editing verbs and properties through the editor doesn't undergo any sort of validation. This needs to be added.
Room.js objects don't support storing Date and RegExp data types as properties.
It's just silly to only allow integer object IDs, its an arbitrary restriction. A better way of doing it could be this:
Then we can get objects by id like this:
root = $ '#root'
someThing = $ '#123'
By using '#' like jQuery to specify ID lookups, we allow for future expansion of the query operator.
Would address #8.
RangeError: Maximum call stack size exceeded
For disconnect events and such, use toastr events, rather than bootbox alerts which keep stacking up.
It should not let you add properties named with reserved words. A possibly incomplete list of reserved words is:
Similarly, it should not allow you to add a verb that would conflict with any of the reserved words.
While $(num)
can universally access the locations() tree to find an object, it should support jQuery-style string selection as well.
$("string")
should select an object by that name or alias exactly, traversing the standard verb search order before returning null.
I suspect I have memory leaks. I was on the server chatting for quite a while, and doing a lot of stuff. Eventually the server became very sluggish and eventually crashed.
When I was trying to create and start cron jobs for two objects, one of the object's "startJob" function kept starting the other's job instead of it's own. And there was some weirdness when printing out the objects' crontabs. It fixed itself after a server restart. Investigate!
It has a few bugs and I don't feel like maintaining it anymore, the full editor is now more useful.
stack trace from server:
[uncaughtException] TypeError: Object pepeleleleiro has no method 'map'
at RoomJsPlayer.exports.RoomJsObject.RoomJsObject.matches (/home/doughsay/sites/room.js/app/lib/object.coffee:101:26, <js>:156:23)
at /home/doughsay/sites/room.js/app/lib/db.coffee:139:41, <js>:205:22
at Array.map (native)
at Db.module.exports.Db.findNearby (/home/doughsay/sites/room.js/app/lib/db.coffee:139:26, <js>:204:29)
at Db.module.exports.Db.findObject (/home/doughsay/sites/room.js/app/lib/db.coffee:131:5, <js>:193:19)
at Db.module.exports.Db.matchObjects (/home/doughsay/sites/room.js/app/lib/db.coffee:121:11, <js>:181:46)
at Client.module.exports.Client.onPlayerCommand (/home/doughsay/sites/room.js/app/controllers/client.coffee:89:7, <js>:94:34)
at Client.onPlayerCommand (/home/doughsay/sites/room.js/app/controllers/client.coffee:1:1, <js>:3:61)
at Client.module.exports.Client.onInput (/home/doughsay/sites/room.js/app/controllers/client.coffee:49:7, <js>:56:21)
at Socket.<anonymous> (/home/doughsay/sites/room.js/app/controllers/client.coffee:1:1, <js>:3:61)
at Socket.EventEmitter.emit [as $emit] (events.js:100:17)
at SocketNamespace.handlePacket (/home/doughsay/sites/room.js/node_modules/socket.io/lib/namespace.js:335:22)
at Manager.onClientMessage (/home/doughsay/sites/room.js/node_modules/socket.io/lib/manager.js:488:38)
at WebSocket.Transport.onMessage (/home/doughsay/sites/room.js/node_modules/socket.io/lib/transport.js:387:20)
at Parser.<anonymous> (/home/doughsay/sites/room.js/node_modules/socket.io/lib/transports/websocket/hybi-16.js:39:10)
at Parser.EventEmitter.emit (events.js:100:17)
at finish (/home/doughsay/sites/room.js/node_modules/socket.io/lib/transports/websocket/hybi-16.js:288:16)
at Parser.expectHandler (/home/doughsay/sites/room.js/node_modules/socket.io/lib/transports/websocket/hybi-16.js:299:15)
at Parser.add (/home/doughsay/sites/room.js/node_modules/socket.io/lib/transports/websocket/hybi-16.js:466:24)
at Parser.expect (/home/doughsay/sites/room.js/node_modules/socket.io/lib/transports/websocket/hybi-16.js:499:10)
at Parser.<anonymous> (/home/doughsay/sites/room.js/node_modules/socket.io/lib/transports/websocket/hybi-16.js:298:18)
at Parser.add (/home/doughsay/sites/room.js/node_modules/socket.io/lib/transports/websocket/hybi-16.js:466:24)
at Parser.expect (/home/doughsay/sites/room.js/node_modules/socket.io/lib/transports/websocket/hybi-16.js:499:10)
at expectData (/home/doughsay/sites/room.js/node_modules/socket.io/lib/transports/websocket/hybi-16.js:296:16)
at Parser.opcodeHandlers.1 (/home/doughsay/sites/room.js/node_modules/socket.io/lib/transports/websocket/hybi-16.js:313:9)
at Parser.processPacket (/home/doughsay/sites/room.js/node_modules/socket.io/lib/transports/websocket/hybi-16.js:533:8)
at Parser.add (/home/doughsay/sites/room.js/node_modules/socket.io/lib/transports/websocket/hybi-16.js:466:24)
at Socket.<anonymous> (/home/doughsay/sites/room.js/node_modules/socket.io/lib/transports/websocket/hybi-16.js:141:17)
at Socket.EventEmitter.emit (events.js:100:17)
at Socket.<anonymous> (_stream_readable.js:736:14)
at Socket.EventEmitter.emit (events.js:97:17)
at emitReadable_ (_stream_readable.js:408:10)
at emitReadable (_stream_readable.js:404:5)
at readableAddChunk (_stream_readable.js:165:9)
at Socket.Readable.push (_stream_readable.js:127:10)
at Pipe.onread (net.js:517:21)
exiting...
The prompt displayed in the client (>) should be a configurable string sent by the server. It should allow for displaying various player properties and be kept up to date in realtime.
You can modify js objects that are stored as object properties in-place.
e.g. $here.exits['north'] = $exit.create 'north'
The above won't work because $here.exits is a getter that returns a new object, not the real underlying object.
Don't really know how we can solve this...
Attempting to assign a circular js object as a property on a moo object causes RangeError: Maximum call stack size exceeded
Since I don't actually support telnet, why am I limited to standard ANSI colors? Let's just open it up and allow a wider range of colors.
When room.js is running behind an nginx proxy, the handshake property of the socket object is undefined for some reason.
In a command that has a preposition but no indirect object, the indirect object is returned as $ambiguous_match
. e.g. look under
When an exception is caught, we know what verb was run, who ran it, and what the referenced objects were. It would be helpful to display these for debugging purposes.
Due to the recent re-factor to improve performance, the verb timeout code had to be removed. This is because apparently script.runInContext
does not take or honor the timeout argument.
EvanR requests adding a flag to verbs specifying what language they are written in, allowing one to write javascript code as well as coffeescript code.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.