Jump to content

shimlong

Members
  • Posts

    7
  • Joined

  • Last visited

shimlong's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Still trying to figure this out. Any help is appreciated!
  2. Looks like that Raining Chain game has a lot of relevant tutorials, too. Checking them out now. http://rainingchain.com/tutorial/nodejs
  3. I actually just started Phaser recently too, using that same boilerplate repo. I used this repo as the template for getting multiplayer working: https://github.com/xicombd/phaser-multiplayer-game It was actually surprisingly easy to get working. Just run the server he has, and take the pieces from his client example (such as the event handlers and connecting to the server via socket.io) and stick them where appropriate in your own client. Then you can modify the events sent/received as needed for your game. I am lucky in that the game I'm working on is tile based, and the user can only move from tile to tile (like Pokemon). I simply emit a "player move" event to the server every time a user begins moving to a new tile. For your questions: 1. I am using Browsersync just fine for the client code. It came with the boilerplate repo we're using and hasn't been a problem. I had to update the gulp file to also copy over some new folders I added for assets and stuff. The repo I linked above for the server is using NodeJS it's basic built-in web server (not Express). It's running on port 8080 by default and haven't had issues. In production, my plan is to have the game server separate from the server serving pages and client code. I would guess most people do this. If you need to turn off the server for maintenance or whatever, you don't want your website to also go down. Same if your game server crashes for some reason. I am going to make the website with Laravel and host it at DigitalOcean on a VPS. I am hosting the NodeJS server on Heroku. 2. Again see the repo I linked above. Heroku makes it real easy - just git push to your heroku remote and it will auto deploy. You will have to do a few things like set your environment variables, use a database add-on if needed, and add a Procfile. 3. You won't want to make a new connection on every update. Make the connection once at load time and keep it open. I am not sure how games usually handle player movement data when players are free-moving. I would assume several times a second the client will send the player's current location and direction to the server if it has changed. 60 times a second is probably overkill. Once a second is probably fine. 4. Instead of seeing if they're moving this exact millisecond, maybe just store their old X,Y and see if it matches their current X,Y. If not, send the new one to the server. 5. If you want all clients to see the same NPCs in the same places, then their behavior is probably best handled on the server. Simply send data to the client saying to display this sprite at this location. In general, you want as little to happen on the client as possible in multiplayer games. Allowing the client to set their own player's position without any checks, for example, is what leads to speed hacks. Allowing the client to manage NPC behavior and AI also means they can manipulate it do whatever and then your server isn't checking to make sure it's actually what it should have done. I'm about to attempt to update that boilerplate repo to the most recent version of Phaser. Let me know if you've tried to update it too and ran into any problems!
  4. For my own selfish purposes it'd be helpful to have "infinite" tilemaps and performance improvements on tilemap rendering. If not exactly infinite, then some API that allows a player to transition from one tilemap to an adjacent one as they approach an edge.
  5. I've spent several hours going through the API, the phaser.js code itself, and Googling as much as possible but I have not been able to find a clear answer: can the X or Y value of a tile be negative? For example, doing Doesn't seem to work. The rest of the tilemap (using positive coordinates) is displaying, but this negative one is not. I cannot tell if this is because Tilemaps ignore negative coordinate tiles, or if there is some aspect of the camera, stage, world bounds, camera bounds, that I am not aware of preventing it from rendering. I've tried changing the position of the TileMapLayer to be offset from the top left of the world but it didn't work. I've tried lots of different things with the camera to see if existed but just wasn't showing. My results are inconclusive to me, though. If I am going about this all wrong, please let me know. The basic premise is, I want a Tile with a coordinate of 0,0 to be the center of my world. I want it to expand in all four directions an indeterminate amount of tiles. This is because the game is multiplayer and would potentially need to scale much larger if the player base grew. The tile data is dynamic and is sent from the server to the client.
×
×
  • Create New...