• Content Count

  • Joined

  • Last visited

About Ralph

  • Rank
    Advanced Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. So this is basically what I have right now. The server is essentially fully handling the movement, but the client just assumes all moves are legal to remove the need for the server to send back to the client what it needs to do.
  2. The reason I went with a monitoring approach over a fully server handled movement system is that i could never drop the lag. The movement lag from the server handling movement was too annoying for me, and I couldn't reduce it by much. The server does monitor by update, not by FPS, but currently the client doesn't move by update, it moves by frames, if that makes sense? So the server is calculating distance based on updates, but the clients move based on frames. An easy fix I just haven't gotten around to (I just need to make speed the client moves at proportional with their FPS). To be honest, after I wrote this post, I found the real issue that was causing this movement bug, it was unrelated, but this is still something I know I will have to deal with in the future. So your recommendation is to fully switch to a server sided movement system?
  3. Sup guys, I'm back and once again working on my side project now that school is out. I recently rewrote some of my server sided code, specifically the pieces that handle anti-cheat. One problem I ran into is my anti speed hack mechanism. Prior to my rewrite (which was more of a cleanup) the way I handled movement on the server was I allowed the client to move however it liked. It would then send its new position (after ever frame) to the server. The server would then check to see how far the client moved (based on its last position which is saved on the server) and made sure that the client didn't move more than a certain amount of pixels each frame. If it moved legally, then it's "last" position would be updated with the new position the client provided and the client legitimately moved. If it moved too fast, the clients old position is kept as its server position, ensuring that sure the client isn't speed hacking (at least on the server side, can't stop the client from moving anywhere really). Anyway, that's how the system works, and it works great, until I ran into the problem of different frame rates (at least I think that's what's causing the issue). After the rewrite of this system, clients are moving too fast to the server, and I think it could be because of slower fps'? Like Ill move right, but now instead of moving say 5 pixels per frame like the pre-rewrite code would detect, im getting 6, and 8 and 15 and other higher random numbers, as if the server was missing some calls. Regardless of the cause, I was wondering, how do people usually handle movement on servers. Am I going about this correctly? Any suggestions? What other ways can I verify a player isn't teleportating or speed hacking? Thanks.
  4. Yeah, a few days after I posted this I fixed the issue by changing all sprites body shape. By shifting the Z offset of each sprite to negative sprite's Z value plus 1, everything was 1 unit off of the "floor" and collided properly then. The issue arises because if you set the z value of a sprite to be 0, it doesnt actually change the height, it just pushes it through the floor it seems. I ran across another issue with anchors, which i also fixed, but that required a source change that I documented on the open issues of the plugin. Overall great plugin, even with the dying support, no worries though, all projects must come to an end sometime.
  5. I would recommend you change the player "object" to a single variable, and set children. That way you can modify it all as 1 object in relation to each other. Rather than 3/4 separate sprites. Also, io.socket.broadcast is a tool you can use, (I think that's the syntax, idk look it up), so you can send a socket message to all clients EXCEPT the one that caused the call in the first place, so you dont have to check ID's if you have no reason to upon receiving a message. (at the top of the very first code you posted)
  6. No need for real synchronization if actions are all standardized. For movement have your client update its position on the server every tick in the update funciton, have the server send that to all other clients, and all other clients just keep setting that players position. (Just set it, rather than set velocities and such). If you have a function to say shoot. Have the function that handle's it for your client be the same thing that handles it when another client shoots. So its all standardized and you dont ahve to worry about syncing it up perfectly. Really this question is just too broad for a good answer. Read some tutorials and think logically about how you could have the same thing happen on multiple screens. All the tools you need are there.
  7. Hey all, So I recently switched my entire game over to Phaser Isometric by @lewster32 and now I keep running into an issue with collision. With just spawning a sprite in and not chaning any of its body properties, collision happens when the TOP of my player's body box reaches the TOP of the sprite's body box. This is a problem because it allows me to just walk through the sprite diagonally, which is not what I want. In fact, what I want is for collision to happen when the BOTTOM of the body boxes touch. (Sidenote: when I say body box I'm referring to the the 3d body shown through a body debug). Here is an example of how it works with no changes made to the body of either sprite. This is collision happening with no modifications: image - side note I am moving up and to the left in this picture, not down and to the left. This is after some changes to the body, the same thing happens too but it more closely represents what I *want* to happen, except it's still happening only with the top of the player sprite and tree sprite. image 2 Similarly, when I go to the top right side of the tree and move down into it, my body will go through the body box until the top of the body box hits the tree's box. When I mess with the Z values it all breaks and no collision will happen either. On top of that, changing the sprites anchors PAST (.5, .49999) also breaks something. Collision will happen at an anchor of (.5, .4999) but not at (.5, .5), it's very strange. Edit: Also, if i set the anchor to greater than (.5, .5) AFTER I enable isoPhysics on the body, the sprite's position gets moved thousands away and sometimes into the negative's. Here is my code to spawn the sprite and player. There is much more that goes into spawning the sprites, but this is anything that could even be related to the issue at hand. player1 = game.add.isoSprite(1000, 1000, 0, 'person'); game.physics.isoArcade.enable(player1); game.physics.isoArcade.collide(player1, itemGroup, null, null, this); createSprite = game.add.isoSprite(1250, 1250, 0, itemGet(chunks.chunks[i][slot]), null, itemGroup); //the anchor and body.setSize code here draws what you see in image 2. With these lines commented out, it outputs image 1. createSprite.anchor.setTo(.5, .49); game.physics.isoArcade.enable(createSprite); createSprite.body.setSize(40, 40, 0, 27, 27); createSprite.body.immovable = true; Any help is GREATLY appreciated. Ive been trying to fix this for a few days now, nothing I do works.
  8. My system in a nutshell is you spawn in, client is sent data of their portion of the map, the client draws it all. Its around a 3k by 2k px draw around the player using 32x32 tiles for everything drawn (except the ground/grass which is a repeating tilesprite). Then when they walk to a point where they need to see more of the map, the server sends more map data, the old map is destroyed and the new chunks are restored. The system is really fast actually, fast enough that you cant see the flicker (but you can feel it while walking, but cant visually see it), that or I made it so that it draws the new sprites before it wipes the old lol, I dont remember its been a while since I wrote it. If you would like to see the game PM me, I would be happy to send you the ip. You need to have a steam account to login though. Edit: Lol, forgot why I was describing my system to begin with. I couldn't use the isometric plugin because it would still be too many sprites generated because I use small tiles. And I never got an answer, is it the phaser isometric plugin or your own system?
  9. Yeah I remembered after I posted that there was a way to change the shape of the phsyics body but I cant remember how. Do I need to use p2 to do it?
  10. Hey just out of curiosity, are you using the phaser isometric plugin by lewster22 on that example of the the noise map? If so, or even not so, how large is the map? Ive been trying to switch my WIP to an isometric view like that but I couldn't quite get it with the phaser isometric plugin because I have too many sprites loaded at once for it to be viable. I tried making a tilesprite that looked isometric to match with the pieces that are actually isoSprites but I couldnt get it to match up and it was pretty buggy. Any suggestions? Edit: Also to piggy-back here, I too have a perlin-noise tiled map generator, but since I built it specific for my WIP it generates a 2000x2000 array, each entry with a number that corresponds with a specific kind of block. It's already packaged nicely since it builds into into a database. If anyone wants it, or if you want it, Ill be happy to drop the source.
  11. Hi there, basically Im planning on switching the tree's in my game to larger more extravagant trees and what I wanted to do was to be able to walk through the top of the sprite, giving the appearance that you are walking behind the tree, but not let them walk through the base of the tree. I couldn't think of a way to do this. I was thinking I would do it with 2 spites maybe? But i thought that was too redundant. I know other frameworks like RPGJS has this but I don't know if phaser does. Thanks for any help in advanced.
  12. Hi there, I think I might transition my game to isometric and it should be a lot of fun, however; in my game I render 100's of sprites. No physics. They are stationary but one way I coped with regular phaser was making the ground a tile sprite, and water and sand and such that requires no interaction just image sprites over that ground tile sprite. Is there anyway to do this in the Isometric plugin? Essentially anyway to draw a isoTile with no physics, just being the floor/water that requires minimal power like game.add.image does? Edit: Sorry for bumping such an old topic, I didnt realize how old it was.
  13. As always, another great post. I only tried to the pixi test on two computers, both of which were the ones that were working to begin with. Ill have to test tomorrow. I guess ill be switching to delta times for people who cant run 60 frames. I already have movement speed capped on the server so I wasn't really worried about over. Do you happen to know of any good guides of how to do this properly? Er basically how to do this. I know the idea of changing movement speed based on the delta but not how to access it in phaser. Edit: I would be willing to link my game in a PM, but its a large read. Their is a lot of sprites drawn at once but nothing rapidly changing. Like it was weird because on one computer it would not pass 30 FPS at all even when standing still when all sprites are idol and nothing is working in the background of the game. Edit 2: Holy moly, I just realized my update function is just 15 lines lol. All it is is on a key press set a sprites velocity and update the sprites position on the server. Server handles the rest of the game. I guess I never realized how much logic I moved to the server lol, I've come a long way from asking how I should handle map data.
  14. Actually, im starting to think its a bug with just these 2 computers. I tried it on 2 more computers, 1 worked like mine. 1 was a crappy laptop capped at its refresh rate of 50hz, and it could handle it so. Also, if someones monitor is lower/higher than 60hz will the update function be called more than 60 times a second? Or will that be capped there and just frame rate goes up? Like I just realized I have some things dependent on the 60 times a second refresh rate of the update function, so do I need to work with deltaTimes now? I question this because on the computer running at 30fps they move slower than the computers at 60fps, but the one at 120fps moves at same speed