Giter VIP home page Giter VIP logo

cloak's People

Contributors

aychtang avatar dariusk avatar incompl avatar jugglinmike avatar markleford avatar vstirbu avatar zachatrocity avatar

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

cloak's Issues

Grow21: Move Scoring to Server from Client

I don't consider this a critical-path task to finishing Grow21, but it is a cheating risk to have the server trust the client to self-report its scores.

This would be a pretty big refactor; I'd have to move a whole bunch of the game logic from the client to the server :/

Grow21: Players can't start new game a second time

Looked into this a little -- if you run Crafty.stop(true) then Crafty.init(blah blah blah) then Crafty.components() it returns only the base Crafty components. It seems like custom components need to be reloaded? @incompl interested in your take on this

Grow21: Tiebreaker Scoring

Subtask of #16

We still need to count up 19/20/22/23 islands in case of a tiebreaker.

19, 23: +2 points
20, 22: +5 points

Remove client API for interacting with rooms, user lists, etc

The following client methods should be removed:

  • listRooms
  • joinLobby
  • joinRoom
  • getRoomMembers
  • leaveRoom
  • listUsers
  • registerUsername

All of these are things that clients should not necessarily be given free reign to do in all games. They make assumptions about what is allowed in the game. For example, a game may have private rooms, so a client listRooms method would not be appropriate.

Right now rooms have shouldAllowUser to deal with this problem, but this is not a sustainable approach. This type of logic should go in a custom message handler rather than cluttering the config with new settings.

I realize this makes getting started with Cloak a little harder, but it greatly increases the general usefulness of the library. Most of these methods could be implemented as a message handlers within a handful of lines of code.

The following client functions are not effected.

  • configure
  • run
  • end
  • connected
  • message

Since this is not a backward-compatible change this will likely go in a 1.0.0 release.

Interested in your thoughts @dariusk @Cheeseen. Especially since some of these methods came from your work on Grow21, @dariusk .

Do/Should we close inactive sockets?

Not sure if already implemented, should we close inactive sockets after a certain duration? Inactivity will be determined by no events being sent from the socket for the duration.

Remove cloak-createRoom

We can't give users free reign to create as many rooms as they want. This needs to be done in application logic.

Mistakes in documentation

In https://github.com/incompl/cloak/wiki/GettingStarted

in this part, when I copy and paste this

{
  name: 'My Cool Game'
}

and then run: npm install cloak --save

npm ERR! Failed to parse json
npm ERR! Unexpected token }
npm ERR! File: C:\Users\User\Documents\GitHub\multiplayer\package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse

I had to change with

 {
     "name": "MyCoolGame"
 }

there are some links broken like:

https://github.com/incompl/cloak/tree/master/example

Client side methods for setting and getting room data.

There is still a bit of work to hook up getting and setting of a users current rooms state or data (The latest test I added may be the quickest way and requires defining a getter and setter on the server config I think we should give for free). What are your thoughts on exposing methods that abstract that work away from the user.

Trying to use cloak and express - can I ?

Hi,

I'm trying to get familiar with cloak in case I might use it up and coming node knockout competition (as it looks awesome!).

I want a single node server serving up some pages with express and make use of socket.io. I can do this with straight socket.io, but I'm having problems using cloak in the same way. I've tried the following approach:

var cloak = require('cloak'), 
  express = require('express'),
  app = express();

app.use(express.static(__dirname + '/static'));
var server = require('http').createServer(app);

server.listen(8080);

app.get('/landing', function(req, res) {
  res.sendfile(__dirname + '/index.html');
});

cloak.configure({
  port: server
});

cloak.run();

My index.html just calls cloak.configure and cloak.run.
I noticed that server side cloak.run just calls listen on socket, and so I passed the server through (like you would if you used straight socket.io).

When the page renders, I get the following error:

'TypeError: Converting circular structure to JSON
    at Object.stringify (native)
    at Object.exports.encodePacket (/home/roy/src/active/secrets/zamc-cloak/node_modules/socket.io/lib/parser.js:75:19)
    at Socket.packet (/home/roy/src/active/secrets/zamc-cloak/node_modules/socket.io/lib/socket.js:212:21)
    at Socket.emit (/home/roy/src/active/secrets/zamc-cloak/node_modules/socket.io/lib/socket.js:368:15)
    at Socket.<anonymous> (/home/roy/src/active/secrets/zamc-cloak/node_modules/cloak/index.js:103:18)
    at Socket.EventEmitter.emit [as $emit] (events.js:95:17)
    at SocketNamespace.handlePacket (/home/roy/src/active/secrets/zamc-cloak/node_modules/socket.io/lib/namespace.js:335:22)
    at Manager.onClientMessage (/home/roy/src/active/secrets/zamc-cloak/node_modules/socket.io/lib/manager.js:488:38)
    at WebSocket.Transport.onMessage (/home/roy/src/active/secrets/zamc-cloak/node_modules/socket.io/lib/transport.js:387:20)
    at Parser.<anonymous> (/home/roy/src/active/secrets/zamc-cloak/node_modules/socket.io/lib/transports/websocket/hybi-16.js:39:10)

Should I be able to use express and cloak together in this way? Any ideas where I might be going wrong.

Thanks,
Roy.

how to get the id of the room?

I am making a game in which when I join the room
I want to access the data of all the users currently
in the same room(for sending game invites if I am in the lobby).

but for calling cloak.getRoomMembers(...), I need a room Id
I checked the code and I think there is no any API for that.
I specifically have to ask the server for my room id (EXTRA CODE change also on the server)

so I was suggesting that server should also send an Id with the
room name when it emits joinedRoom serverEvent
line no: https://github.com/incompl/cloak/blob/master/src/server/cloak/room.js#L50
changing to:- user._serverMessage('joinedRoom', _.pick(this, 'name', 'id'));

correct me If it is not a good thing.

Audit API

I want to tag a 1.0.0 with recent changes but beforehand I want to go through and make sure there aren't any other backwards-imcompatible changes I want to make first.

Grow21: Kick Back to Lobby

Subtask of #16

The player should be kicked back to the lobby, showing a message and a confirmation button labeled "Return to Lobby" when:

  • The other player disconnects
    • "Other player has disconnected!"
  • The game ends
    • "[win/lose/tie] message"

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.