Jump to content

Search the Community

Showing results for tags 'express'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 11 results

  1. Hi, I have a multiplayer game that works, except when two players click at the exact same time. For example 6 players are in a game. The game consists of balls being sent from one player to another. The ball is animated from sender player to receiving player. Which means when the sender sends the ball, it is no longer in his/her hands. The ball is now is the hands of the receiving player. This works perfectly except if a move is made by another sending player at the exact same time. For example, 6 players are in a game. Player1 passes Player2 the ball at the same time, Player3 passes Player4 the ball. Player1 and Player2 will work correctly, however in the case of the other two players, what happens is Player3 sends the ball to Player4 who receives it but Player3 is still holding the ball even after he/she passed the ball over to Player4. Does this issue mean I should be using a Callback? Thanks, MLA
  2. Hi, I'm wondering how to avoid simultaneous mousedown events. I have a canvas drawn on screen. When a player clicks events take place based on where the player clicked on the screen. If two players click the canvas at the exact same time, they should both be alerted with a message that no simultaneous moves are allowed. I used an array to capture the move, however it seems to only register the move after the check and not before. Is there a simple way to capture which clients clicked at the same time? //Listen for player click event chainlinks.onmousedown = function(event) { var totCT; //update current player turn on client for (var i = 0; i < remotePlayers.length; i++) { if (remotePlayers[i].id == socket.id) { remotePlayers[i].currentTurn = true; } } //update current player turn on server for (var i in cPlayers) { if (cPlayers[i].id == socket.id){ cPlayers[i].currentTurn = true; } } socket.emit('update-currentTurn', {remotePlayers: remotePlayers, cPlayers:cPlayers}); if (totCT > 1) { //Simultaneous move happened - show invalid message } else { //All good to go ahead with the click event } } Thanks!
  3. I'm using express.js to serve a BabylonJS app statically. The dev server is ts-node running on localhost. Everything is going great except that it won't load .env files. If I try loading the .env file: const envTexture = BABYLON.CubeTexture.CreateFromPrefilteredData("assets/textures/mono_lake.env", scene); const skyBox = scene.createDefaultSkybox(envTexture, true, 128); I get the error "Cannot load cubemap because files were not defined" in the console. Elsewhere on the forum, I see that people using IIS servers need to explicitly allow .env file mimetypes in a web.config file, but I'm wondering if this is necessary in express running on locahost? What makes me think it is not a mime issue, is that I do seem to be able to load the .env as a binary file if I use the code below: Someone must be serving Babylon files over node, does anyone know how to get this working? const assetManager = new BABYLON.AssetsManager(scene); const skyboxTask = assetManager.addBinaryFileTask("skybox", "assets/textures/mono_lake.env"); skyboxTask.onError = (task, message, exception) => { console.log(message); } skyboxTask.onSuccess = task => { console.log("success, length: ", task.data.byteLength);// returns the correct length of the .env file } assetManager.load();
  4. i using nodejs ,mysql ,express i trying put two methods in same route to render the same file but i have this error in my firefox 404 my code aliança route const express = require('express') const router = express.Router() const connection = require('../../Config/database') const controllerAdmin = require('../../controllers/Administration') const controlleruser = require('../../controllers/Alliances') router.get('/Administration/Alliances', (req, res) => controllerAdmin.findcidade3(connection, req, res)); router.get('/Administration/Alliances', (req, res) => controlleruser.findAlianca(connection, req, res)); module.exports = app => app.use('/', router) aliança controller const Allianca = require('../models/Alliances') const findAlianca = async (connection, req, res) => { const allianca = await Allianca.find(connection,req.session.user.username) if (!allianca) { res.status(404).send('Nenhuma cidade encontrada.') return; } console.log("dddd"); req.session.alianca = allianca res.locals.alianca = allianca res.render('Administration/Alliances') } module.exports = { findAlianca } aliança models const find = (connection,username) => { return new Promise((resolve, reject) => { connection.query(`SELECT alianca.nome,alianca.N_membros,alianca.TAG FROM user INNER JOIN alianca ON user.cod_alianca=alianca.id WHERE user.username='${username}'`, (err, result) => { if(err){ reject(err) }else{ console.log(result[0]); resolve(result[0]) } }) }) } module.exports = { find } na app tenho o seguinte require('./routes/Administration/Alliances')(app) aliança.jade tenho assim extends layout block title .col-xs-6.col-xs-offset-3.col-sm-6.col-sm-offset-3 .col-sm-4(style='width:76%') div.panel.panel-primary(style='height:50px') Alliances Page div.panel.panel-primary(style='height:700px') fdssdklfsdklfjskldfjkldsjfl if locals.user.cod_alianca==null p You Dont Have Alliances else br span Your Aliance span= locals.alianca.nome .col-xs-2.panel-red(style='width:24%;height:100%;text-align:center') coneção com base dados tenho o seguinte const mysql = require('mysql') const config = require( "./config.json" ) const connection =mysql.createConnection({ host:config.host, user:config.user, password:config.password, database:config.database, // port:config.port }); connection.connect((err) =>{ if(err){ console.log(err) process.exit(0) }else{ console.log('database on') } }) connection.query(`CREATE TABLE IF NOT EXISTS user (userId INT(11) NOT NULL AUTO_INCREMENT, username VARCHAR(50) DEFAULT NULL, password VARCHAR(60) DEFAULT NULL, PRIMARY KEY (userId))`, (err ,result) =>{ if(err){ console.log(err) } }) module.exports = connection and cmd have this errors GET /Administration/Alliances 500 217.138 ms - 7876 GET /Administration/vendor/bootstrap/css/bootstrap.min.css 404 42.201 ms - 7876 GET /Administration/vendor/fontawesome/css/font-awesome.min.css 404 80.007 ms - 7876 GET /Administration/vendor/themify-icons/themify-icons.min.css 404 112.356 ms - 7876 GET /Administration/vendor/animate.css/animate.min.css 404 142.545 ms - 7876 GET /Administration/vendor/perfect-scrollbar/perfect-scrollbar.min.css 404 176.203 ms - 7876 GET /Administration/vendor/switchery/switchery.min.css 404 208.608 ms - 7876 GET /Administration/stylesheets/plugins.css 404 35.953 ms - 7876 GET /Administration/stylesheets/styles.css 404 64.049 ms - 7876 what i doing wrong
  5. Hi, I have a nodjs application that is currently saved in Windows 2012 R2 server using IISnode with IIS 8.5. I am getting a 404 File or directory not found error, however nothing is being recorded in the error logs. When I run this locally I have no issues and the game runs well. Thinking it could be a permissions issue, I decided to provide temporary read/write access, however that didn't seem to make a difference. I also confirmed that the links are all correct in terms of where files are sitting. Here is my server side code: var PORT = process.env.PORT || 8080; var express = require('express'); var app = express(); var http = require('http'); var path = require('path'); var util = require("util"); var server = require('http').createServer(app); var compression = require('compression'); //Get required classes xyLocation = require("./xyLocation").xyLocation; app.use(compression()); //Compress all routes app.use('/client', express.static(__dirname + '/client')); app.use('/js', express.static(__dirname + '/js')); app.use('/css', express.static(__dirname + '/css')); app.use('/sounds', express.static(__dirname + '/sounds')); app.use('/images', express.static(__dirname + '/images')); // Routing app.get('/', function(request, response) { response.sendFile(path.join(__dirname, 'index.html')); }); server.listen(PORT); console.log('Starting server on port '+ PORT); var io = require('socket.io')(server,{}); io.sockets.on('connection', function(socket) { ... Thanks MLA
  6. How do you configure the server for this template ? => https://github.com/nkholski/phaser3-es6-webpack I'm trying to do it by following this tutorial => https://gamedevacademy.org/create-a-basic-multiplayer-game-in-phaser-3-with-socket-io-part-1/?a=13 I added two dependencies: nodemon and express. I created the server.js file with the server configuration. const express = require('express') const app = express() const server = require('http').Server(app) const path = require('path') app.get('/', function(req, res) { res.sendFile(path.resolve('index.html')) }) server.listen(8081, function() { console.log(`Listening on ${server.address().port}`) }) In the package.json file, I added a command to start the server: nodemon src/server/server.js The server starts correctly but the indicated html file can not read the scripts (" The load failed for the "script" element with the source vendor.js and app.js"). Project structure:
  7. Hi, I'm creating a node js game, using javascript and socket io. I originally was not going to add a mongo DB, but now I'm thinking I should for anyone who may accidentally be disconnected from the game. What would the best game option be? To use a database or not, and the reasons behind it. Many thanks, MLA
  8. It seems that to send a private message to a player, you are supposed to use socket.to(socket.id).emit. I need to emit an image to a specific player so am using this concept, however it doesn't seem to work. Would anyone know how to emit an image to a specific client? Thanks!
  9. Hi, I have been struggling with a minor issue, that I'm hoping someone can help me out with. I have a multiplayer game that uses Express and Socket io. When a new player logs into the game, the player walks to a certain location on screen. In order to make the player walk, I am drawing the player to canvas using a spirit map. In order to make the player walk per frame I am using the ctx.clearRect() to clear the previous frame, however doing this naturally clears the full canvas and removes the already logged player. I'm not sure how to work around this. Any insight is greatly appreciated. Thanks, Laura server.js Player.js
  10. Hello All, I am working on a multiplayer action role playing game and I am using Phaser on the client because I just love this framework. Here is a link to the project on GitHub: https://github.com/crisu83/dungeon-game/tree/feature/phaser-server I have been experimenting quite a lot with running Phaser in headless mode on the server and I managed to get it to run with a few hacks. I am not sure that it is a good idea to run Phaser on the server, but I am looking into this because I would prefer to have an authoritative server that runs on the same code base as my clients. Here is what I did in order to get Phaser running on the server: First I installed the latest stable version of Phaser through NPM by running the following command: npm install http://github.com/photonstorm/phaser/tarball/v2.0.5After that I installed the dependencies for Node Canvas, instructions for that can be found in the project wiki on GitHub: https://github.com/LearnBoost/node-canvas/wiki Next I installed node-canvas and jsdom through NPM. These modules are required in order to "fake" the document, window, canvas and image objects that Phaser depends on that all are available in all browsers, but not on Node.js. npm install jsdomnpm install node-canvasThen I wrote this wrapped module for Phaser: https://gist.github.com/crisu83/5857c4a638e57308be4f I know that this is a ugly hack, but it at least lets me run Phaser on the server. Here is what the server currently outputs: I am now wondering if I should attempt to make changes to Phaser itself to not rely on the document, window, canvas, image when running in headless mode and create a pull-request for the changes. I am sure it will not be easy to remove all those dependencies, if even possible. Does anyone know if Richard has any plans for this? Does this even make sense to run Phaser on the server? Please share your ideas and feel free to use my code for your own projects. Thank you for reading.
  11. https://drive.google.com/folderview?id=0Bwl58NPLObeIWEQ3YlNlTV9KNWs Here's a sharable link to the directory where my files are located. There's no node_modules, so it's necessary to install before express and socket.io. The problem is I can't create and render the balls which need to bounce all the time. The server is responsible for creating my players and balls. I did successfully the creation and movement of my players with the arrow keys and that's synchronised to all the clients. But I can't do the part with bouncing balls. It seems simple game but as far as I am new to this stuff, I can't figure it out. I provide a link to the directory of my files. The command to start the game is: node server.js. If anyone could help me, I would be very happy. Thanks in advance guys.
×
×
  • Create New...