Search the Community

Showing results for tags 'socketio'.



More search options

  • 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 Platform
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

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 12 results

  1. I'm trying to read data from the file as follows and send data to the client. I can send a 20MB file in 30 seconds. But I have to send 20MB per second. Am I doing something wrong? [Server.js] var File = require('File') var FileReader = require('filereader'), fileReader = new FileReader(); fileReader.setNodeChunkedEncoding(true || false); fileReader.readAsArrayBuffer(new File('../Test.txt')); fileReader.addEventListener('load', function (ev) { JsonData = JSON.stringify(new Int16Array(ev.target.result);); }); var app = require('express')(); var http = require('http').createServer(app); var io = require('socket.io')(http); io.on('connection', function(socket){ console.log('a user connected'); console.log("DateTime : " + getDateTime()); socket.on("update", function(data){ console.log("DateTime : " + getDateTime()); socket.send(JsonData); }); socket.send(JsonData); socket.on('message', function(msg){ console.log('message: ' + msg); }); socket.on('disconnect', function(){ console.log('user disconnected'); }); }); http.listen(9099, function(){ console.log('listening on *:9099'); }); [Client.js] var socket = io("http://localhost:9099"); socket.on('message', function(message) { var JsonData = JSON.parse(message); socket.emit("update", { data:"getData"}); }); Socket.io version : 2.2.0 Filereader version: 0.10.3 NodeJS version: 10.16.3
  2. socket.on('bulletFromServ',function(bullet){ activeBullets[bullet.id][bullet.num] = game.add.sprite(connectedSprites[bullet.id].x - 8,connectedSprites[bullet.id].y - 8, 'bulletSprite'); game.physics.arcade.enable(activeBullets[bullet.id][bullet.num]); game.physics.arcade.moveToXY(activeBullets[bullet.id][bullet.num], bullet.xDest, bullet.yDest, 300); }); Hi, i am having an issue with socket IO together with the moveToXY physics method. When the client receives the "bulletFromServ" message above. I try to initialize a sprite and then use the information sent with the bullet parameter to fill in the parameters of the moveToXY method. However, the sprites are created in the correct position but do not move at all. This snippet of code is within the create function but i have also tried using it in the update function with no luck. I use the moveToXY function in the below code which doesnt involve a socket call and it works fine. The snippet below also includes the emit to the server with the bullet details. Any ideas why the sprite is rendered but does not move to the position i specify with the moveToXY call? if(!firstFired){ activeBullets[socket.id] = [game.add.sprite(connectedSprites[socket.id].x - 8,connectedSprites[socket.id].y - 8, 'bulletSprite')] firstFired= true; }else{ activeBullets[socket.id].push(game.add.sprite(connectedSprites[socket.id].x - 8,connectedSprites[socket.id].y - 8, 'bulletSprite')); } activeBullets[socket.id][activeBullets[socket.id].length-1].checkWorldBounds = true; activeBullets[socket.id][activeBullets[socket.id].length-1].outOfBoundsKill = true; game.physics.arcade.enable(activeBullets[socket.id][activeBullets[socket.id].length-1]); game.physics.arcade.moveToXY(activeBullets[socket.id][activeBullets[socket.id].length-1], game.input.mousePointer.x, game.input.mousePointer.y, 300); socket.emit('bullet', {id:socket.id, x:activeBullets[socket.id][activeBullets[socket.id].length-1].x, y:activeBullets[socket.id][activeBullets[socket.id].length-1].y, xDest:game.input.mousePointer.x, yDest:game.input.mousePointer.y, num:activeBullets[socket.id].length-1 }); Thanks
  3. Hi everyone, I am working on a multiplayer board game and am having trouble finding a suitable framework for handling client/server communication. I have been using NodeJS with socketIO which i like because the API is pretty straightforward, however, since it is not a dedicated game framework, I've had to write my own logic for having multiple rooms to handle multiple game instances and this got ugly really quick. I found this library, https://www.npmjs.com/package/rumpus, however, there is little documentation and activity. The other one that I've considered is this, https://github.com/gamestdio/colyseus, but I was wondering what others have used. Since this is a 2d board game, with users simply taking turns, performance is not a huge deal and I'd like to keep it as minimal as possible. This is really just a learning project so I am super concerned about things like server authentication, etc. Thank you for any help!
  4. Hi! I'm in the process of developing an online multiplayer snake (4-8 simultaneous players in a grid based arena) with the stack involving Phaser in the client, Node in the backend with the networking protocol being websockets through socket-io. The progress made so far has been a prototype consisting of a dumb client and an authoritative server. The server proceeds game logic by 100ms and emits the result to the client at the end of each iteration of this game loop. The client is able to tell the server to change its direction to up, down, left and right, respectively, and the server will use this in order to calculate the next x and y position for this client (which is on the next tick). If the server notices clients colliding with walls, other clients or fruits, the involved client(s) is affected accordingly. The issue with this "dumb client" approach is that the responsiveness for the client seems to be lost in not actually simulating anything locally. From what I understand, to mitigate this lag for the client, client prediction can be applied. Since the movement is actually not caused as a direct action from a client but is always constant (you only influence direction in snake), this would mean that this 100ms game loop would have to be simulated in the client as well, with directional client input being respected and simulated directly in the client at the same time as it is being sent to the server for "verification". For some reason I cannot seem to wrap my head around this topic of the game having "constant speed". The examples I've read are mostly based on games where the movement is based directly on a fixed action, say "move me 10 px to the right", and not constant in the way snake is. Does this “constant speed” design change how I should tackle lag mitigation techniques such as client prediction? What about entity interpolation/extrapolation? Any help or guidance would be greatly appreciated.
  5. Im making a multiplayer game using phaser on client and node.js/socket.io on server and I'm currently not sure how to handle exceptions on server-side. Basically, whenever there are uncaught exceptions (perhaps due to some edgecase i didnt foresee), the server will crash, and the game state which gets stored in-memory for speed and updated every 33ms will get lost, including disconnecting all connected players (ie. 20 players will get disconnected if there's an unexpected server bug). Even if there's automatic restart, it'll be a new process with new memory and new socket connections. So my question is, how do i auto-catch these exceptions, so that I can handle them via an email notifier instead, and let the game continue on smoothly (prevent client disconnect) ?
  6. Phaser Tanks Multiplayer is a multiplayer version of the tanks example: https://phaser.io/examples/v2/games/tanks It does not take into account movement/aim cheats and will be changed in future sometime. The DEMO can be played here: http://vps128058.vps.ovh.ca:8081/ The Github to contribute is here: https://github.com/Langerz82/phasertanksmultiplayer
  7. 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.
  8. I have been working on a multiplayer game and have been wondering what are some of things one should be aware of when creating a multiplayer game in node. As in are there things you should never do? Also does anyone think using a client-server architecture is a bad idea (it's not a pure implementation, but has some peer-to-peer design in there)?
  9. It has been a long road of learning, but I think I finally have my first attempt at a multiplayer game ready for some more public testing and feedback. I still have some work to do, and the art is only what I could do largely on my own and with some friends helping. Hardpoint is a online tank battle game where two teams of up to 5 each battle for the map objective. Each core chassis has numerous weapon locations (hardpoints) that can be outfitted with machine guns, rocket launchers, missiles, flame throwers, and more. Each tank crew can bring up to three different perks to the battle as well, which offer bonuses like small bonuses of faster speeds, and quicker ability cool-downs. Each chassis has a special ability they can trigger, from nitro boosts with mine drops, to artillery, to regeneration. GAME LINK: http://game-128ghardpoint.rhcloud.com/signin.html Requirements: IE/Firefox/Chrome: (Chrome is prefered) Google Account: For login and tracking of stats. Backend: Nodejs, Mongodb and SocketIO. FrontEnd: Impactjs, Box2d, jQuery and Sound Manager 2. Current Status: I know I have plenty to work on still, with refining portions to adding more clear features and cleaning up code. Still, let me know what you think. Play with your friends and give me feedback. BUGS which are being worked: -The Social Section, (friends list) is still a work in progress, but it does work. -Chat window resizing goes a little wonky and needs to be set. -Crash during some rhino charges due to the box2d set position and turret projectile contact listener issue. Thanks in advance to anyone who plays, and feel free to hit me up with any questions you have. Gameplay
  10. Hello, I cant find any good solution how admit hit between two players in nodejs (with socketio) with phaser. There is some solution, with problems. 1. Player A create bullet and send to server X,Y,rotation (speed will be constant), server send create event to other clients and create ghost bullet. When will hit this bullet to same player, player get damage (its local event, because bullet is created in his game, and collision detect call damage to player) This solution is very good, but there is very big problem. When target player minimalize game, or switch tab, socketio, and mainly javascript thread will be paused and this player/client cant admin, get hit, becuase. Server send create bullet event, but this client is "paused" and not create bullet and not get hit. How I can solve this ? Because, it will be easy cheat for god mode. 2. Hit solve on attacker side (player who will fire), just when his bullet hit someone, it send to everybody. I hit player XXX, and every client will recieve this hit and localy get this ghost player/dummy damage, after will be zero, just destroy/hide it. This solution will not be depenes on paused javascript thread. This solution is hard to create and mainly, create some cheat will be very easy (just send concrete socket with target player) So I want to use first solution, but how I can avoid puase to main thread (also in mobile phone, user just close browser, but game will run on background - yes I can use some kind of hearbeat and kick this user) But when player just switch to messenger reply friends, go back to game, and will be kicked ? Thanks for every good solution
  11. Hi all, I'm creating a phaser+socketIO game where people have to race each other. I'm providing all players with an emitter as a trail. Ideally I'd like to keep a constant flow on the emitter but it always shoots out in bursts When I look into the rain example I see a constant particle flow: http://phaser.io/examples/v2/particles/rain But with my project it only bursts. I know that it has to do with lifecycle and frequency but I'm a bit confused after all my tries. Emitter is made inside a Player object which holds the body sprite as well. ​this.emitter = game.add.emitter(this.sprite.x, this.sprite.y);this.emitter.makeParticles('particle'); //this.emitter.setXSpeed(10, 10); //this.emitter.setRotation(0, 0); this.emitter.setAlpha(1, 0, 1000); this.emitter.setScale(0.8, 0, 0.8, 0, 3000); this.emitter.minRotation = 0; this.emitter.maxRotation = 0; this.emitter.gravity = 0; this.emitter.setXSpeed(-400, 0); this.emitter.setYSpeed(-5, 5); this.emitter.start(false, 1600, 5, 0);Thanks guys, phaser kicks ass!
  12. Word Melee is a game in which players use letters, provided in a dashboard, to formulate words in order to use against their opponents. Word Melee features a turn-based local player mode in which two players share a computer, P1 uses [Enter], and P2 uses [shift], and face off one another. Word Melee also features an online mode in which you give other players an ID in order to join a match, inspired by Google's Cubeslam online multiplayer mechanism. The game is complete, but if you find any bugs please let me know immediately. Also, feedback is very much appreciated. If you would like to request a battle with me, send me message in the forums. [PLAY WORD MELEE] Also, if you are using Google chrome and would like to save this game as an app, the game is also available on the Google Chrome Store. EDIT: I just noticed something. This contains English Letters. Quick question: Is there a service that gives language converting abilities? Or shall I approach this programmatically?