Giter Club home page Giter Club logo

room.js's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

room.js's Issues

Overriding verbs is bad

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...

write manuals

A player's manual and a programmer's manual needs to be written. The readme is outdated and incomplete.

Cron tasks double fire on server startup

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 better editor

Create a new editor that is more IDE-like. Features should include:

  • An object browser (list / tree)
  • Tabs to allow having multiple verbs / properties open at the same time
  • Edit verbs using the ace editor
  • Edit properties as JSON using the ace editor

Performance sucks

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.

Ambiguous Moo objects should have a list of the objects that it matched.

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(", ")

Add cron style events

  • Each object should have a crontab.
  • The crontab is a list of jobs.
  • A job is a cron-spec (e.g. 0 30 11 * * 1-5), a verb name, and a boolean (enabled).
  • e.g. {spec: '* * * * * *', verb: 'think', enabled: true}
  • This is registered by the server in a global cron registry, and executed at the appropriate times.

Update db.example.json

It's boring and non-demonstrative right now. Definitely push up the exits and web api demo objects.

Client side settings and features

Allow the client to be configured.

Things we can configure:

  • theme (by pointing to alternate css files maybe?)
  • scrollback
  • shortcuts (like " for say, ; for eval, etc.)
  • maybe more in the future

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/

Support for $ambiguity and $notFound

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(", ")

calling verbs from inside other verbs does not propagate the context

$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 is dangerous

Removing objects using rm does not remove any references to that object. A db with references to removed objects will create nulls in places that can cause exceptions.

node-fibers won't compile for node 0.11.3

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.

Editor validation

Creating and editing verbs and properties through the editor doesn't undergo any sort of validation. This needs to be added.

Remove "globals" and replace them with the ability for IDs to be strings.

It's just silly to only allow integer object IDs, its an arbitrary restriction. A better way of doing it could be this:

  • when creating new objects, do or do not specify an id.
  • the id can be a string or a number.
  • if specified and available, that will be the id used.
  • if not specified, use the auto-incrementing counter to get the next available numeric id.

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.

Objects with circular inheritence

  • $thing.parent == $root; $root.parent = $thing
  • This causes RangeError: Maximum call stack size exceeded
  • Solution: add a check to the parent setter.

Conflicting property and verb names are not caught.

It should not let you add properties named with reserved words. A possibly incomplete list of reserved words is:

  • id
  • name
  • location
  • parent
  • contents
  • aliases
  • [any existing verb name]
  • [any existing property name]

Similarly, it should not allow you to add a verb that would conflict with any of the reserved words.

Jquery-style selection of objects

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.

memory leaks?

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.

Crontab weirdness

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!

crash when emoting on server with strange player in the room

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...

Configurable prompt

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.

in-place property object edits

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...

expand colors

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.

nginx proxy socket.io bugs

When room.js is running behind an nginx proxy, the handshake property of the socket object is undefined for some reason.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.