Skip to content

Commit

Permalink
Merge pull request CoDaS-Lab#39 from CoDaS-Lab/develop
Browse files Browse the repository at this point in the history
Navigation Map to No knowledge condition
  • Loading branch information
chiragrank authored Nov 4, 2021
2 parents a43345e + ca43616 commit 232a4d3
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 43 deletions.
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
# CODAS LAB EXPERIMENT

This Client is in beta version and part of a game built for ASIST project using Phaser.js. The Client works with the API available at [ASIST-API](https://github.com/CoDaS-Lab/ASIST-API)
This client is in beta version and part of a game built for ASIST project using Phaser.js. The client works with the API available at [ASIST-API](https://github.com/CoDaS-Lab/ASIST-API)

## Requirements:
- Node 12.8.3+ installed
## Requirements

## Running Locally
- Install node modules using `npm install` from the current directory of the project
- Set up the `socketURL` variable located in `/public/js/config.js` file.
- Start node server using `node localServer.js` and it should be should be available at `http://localhost:880`
- Node 16.9.1+

## Running on localhost

1. Install node modules from the current directory of the project
- `npm install`
2. Set up environment variables
- `LOCAL_SOCKET_URL`: API server URL. for example: `https://api-asist.herokuapp.com/` or `http://127.0.0.1:5000/`
- `PORT="880"`
- `IP="0.0.0.0"`
3. Start the node server and it should be should be available at `http://localhost:880`
- `node server.js`
67 changes: 31 additions & 36 deletions public/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var gamePlayState = new Phaser.Class({
this._updateGameConfig(randomSelectionValues)
}
victimCount = this.mapConfig["victimIndexes"].length;
var initializedGameData = {"event":"game_created", "map_config": this.mapConfig, "game_config":this.gameConfig,
var initializedGameData = {"event":"game_created", "map_config": this.mapConfig, "game_config":this.gameConfig, "time":new Date().toISOString(),
globalVariable:{"rm_id":roomIdx, "p_id":playerId, "aws_id": turk.emit(),"socket_id": socketId, "session_id":sessionId, "session_limit":sessionLimit}}
socket.emit("game_config", initializedGameData);

Expand Down Expand Up @@ -221,50 +221,45 @@ var gameInfoState = new Phaser.Class({
this.bottomRight = this.add.sprite(300, 303, "blankBottomRight")
this.bottomLeft = this.add.sprite(123.5, 303, "blankBottomLeft")

this.topLeft.setScale(0.3)
this.topRight.setScale(0.3)
this.bottomRight.setScale(0.3)
this.bottomLeft.setScale(0.3)

this.tl = "No knowledge";
this.tr = "No knowledge";
this.bl = "No knowledge";
this.br = "No knowledge";

if(Math.random() < .3){ // first randomization
if (Math.random() < .5){ // post accident*/
this.topLeft = this.add.sprite(123.5, 100, "rubbleTopLeft")
this.topRight = this.add.sprite(300, 100, "rubbleTopRight")
this.bottomRight = this.add.sprite(300, 303, "rubbleBottomRight")
this.bottomLeft = this.add.sprite(123.5, 303, "rubbleBottomLeft")
this.tl = "Knowledge";
this.tr = "Knowledge";
this.bl = "Knowledge";
this.br = "Knowledge";
}
}else{ // second randomization
if(Math.random() < .5){
this.topLeft = this.add.sprite(123.5, 100, "rubbleTopLeft")
this.tl = "Knowledge";
}
if(Math.random() < .5){
this.topRight = this.add.sprite(300, 100, "rubbleTopRight")
this.tr = "Knowledge";
}
if(Math.random() < .5){
this.bottomLeft = this.add.sprite(123.5, 303, "rubbleBottomLeft")
this.bl = "Knowledge";
}
if(Math.random() < .5){
this.bottomRight = this.add.sprite(300, 303, "rubbleBottomRight")
this.br = "Knowledge";
}
}
// if(Math.random() < .3){ // first randomization
// if (Math.random() < .5){ // post accident*/
// this.topLeft = this.add.sprite(123.5, 100, "rubbleTopLeft")
// this.topRight = this.add.sprite(300, 100, "rubbleTopRight")
// this.bottomRight = this.add.sprite(300, 303, "rubbleBottomRight")
// this.bottomLeft = this.add.sprite(123.5, 303, "rubbleBottomLeft")
// this.tl = "Knowledge";
// this.tr = "Knowledge";
// this.bl = "Knowledge";
// this.br = "Knowledge";
// }
// }else{ // second randomization
// if(Math.random() < .5){
// this.topLeft = this.add.sprite(123.5, 100, "rubbleTopLeft")
// this.tl = "Knowledge";
// }
// if(Math.random() < .5){
// this.topRight = this.add.sprite(300, 100, "rubbleTopRight")
// this.tr = "Knowledge";
// }
// if(Math.random() < .5){
// this.bottomLeft = this.add.sprite(123.5, 303, "rubbleBottomLeft")
// this.bl = "Knowledge";
// }
// if(Math.random() < .5){
// this.bottomRight = this.add.sprite(300, 303, "rubbleBottomRight")
// this.br = "Knowledge";
// }
// }
this.topLeft.setScale(0.3)
this.topRight.setScale(0.3)
this.bottomRight.setScale(0.3)
this.bottomLeft.setScale(0.3)
socket.emit("game_info", {"event": "navigation_map", "socket_id":socketId, "aws_id": turk.emit(), 'rm_id':roomIdx, 'p_id': playerId, "input_time":new Date().toISOString(),
socket.emit("game_info", {"event": "navigation_map", "socket_id":socketId, "aws_id": turk.emit(), 'rm_id':roomIdx, 'p_id': playerId, "time":new Date().toISOString(),
'top_left': this.tl, 'top_right': this.tr, 'bottom_left': this.bl, 'bottom_right': this.br});
},
});
Expand Down

0 comments on commit 232a4d3

Please sign in to comment.