Jump to content
  • Advertisement

vhxonline

Member
  • Content Count

    8
  • Joined

  • Last visited

Community Reputation

140 Neutral

About vhxonline

  • Rank
    Newbie
  1. I apologize, I should have mentioned I did try that. However, behavior was still not as expected. It actually made it bizarre.   Every >= .2 seconds on the client I send the update packet. Looking at the logs the client sent the message after (example) 0.202649094381 seconds. However, the server side saw the time calculated since we got the last packet as: 0.19164764274 seconds. This seems to happen intermittently (client: 0.202243417922 vs server: 0.20065745487) somehow server is calculating the time faster than the client sends it + network latency. Surely it can't be that imprecise? I don't understand... any thoughts?
  2. I have looked at that and time.clock() is meant for processor time of the current application so it doesn't work from sending across client -> server. However, when timing things in the application, it's definitely a lot more accurate.   I have looked at the fixed time step and have tried to get it to work but there is still the imprecision of the system timers. Even if I have a set time step (1 / 100), if I do: distance / (currentTime - oldTime) it will never come out with the correct speed (even using the client). I'm guessing due to imprecisions of timers?   I update once every roughly every 0.2 seconds. Sending the movement packet with new time and position. So for example, total distance: 22.1180555556, total dt spent: 0.243055555556. How much real time elapsed: 0.200000047684.    Even if I got the fixed time step working, the server still needs to somehow verify the timestamp sent by the client is accurate somehow.   Maybe I am missing the concept behind the time step? It's to keep each step the same distance regardless of FPS, right?     If you really want to combat cheating, then you have this backwards.  The server needs to be the authority on all aspects of gameplay.  The client transmits user input to the server and the server runs the game simulation based on that input.  The client also runs the simulation for the player as well, but when the two simulations invariably go out of sync, the server is the master and the client is responsible for resyncing.   Initially this is what I did, however I ran into problems. Among other problems in combat, anyone with greater than 100 ms of delay, the gameplay became completely unacceptable. I talked with some other game developers and they mentioned most online games just verify the speed and let the client control movement.
  3. Thanks for the response. I have tried sending the timestamp of time.time() and then setting calculating distance / (newTime - oldTime), but it still does not calculate correctly. It's odd considering both the server and client are running on the same machine so the actual timestamp should work here. Maybe the timing isn't accurate enough?
  4. I am having problems with verifying the movement speed server side in my 2D game, and am looking for direction the best way to fix this.   Right now I have it so the client can move freely, and will periodically send updates to the server on where it's at using a coordinate system (roughly 5 times every second and on direction change). The client sends the position x, y (floats, since I go by pixels and needed to calculate movement speed correctly) and dt of the time it took to reach that position. I do this by getting the current time minus the time I last sent an update (dt). I take the times the server sends and calculate the speed based on that.   I also have an estimated movement speed, server side, to check for cheating. I do this by checking the distance between last position verified and new position sent by the client and last server time stamp when we verified the speed (distance / time). Then after verifying that the speed is ok, we timestamp the new one.   However, I cannot get the server to resolve the speed accurately. I assume this is because the server timestamp is not going to match the time the client traveled since the server processes much faster plus the delay from lag. The end result of the speed calculation ends up calculating the player being too slow or too fast (???) in many cases.  I obviously can't trust the dt the client sends and I can't rely on the timestamp the server uses, so... what could possibly be the solution? If anyone could give me some insight I'd appreciate it! (Using python)
  5. I am trying to make very simple effects in my 2D game of textures (PyOpenGL) and trying to figure out what blend modes to use. I have searched around and seen people talk in depth about this but couldn't find any real solution in the end. Many talk about shaders which I don't use for this.   Right now I have a world layer, an overlay layer, and then a 'light' layer. Each filled with various textures. The world layer contains all the textures of my world, the tiles, the objects, etc. The overlay layer is simply an opaque color that covers the screen. The 'light' is just a very simple white circle (eventually different shapes) with a transparent background.   What I am trying to accomplish is to create a light effect by taking the light/object texture, removing it from the overlay to create a hole in the shape of the texture (with alpha), and then blend in that result to the world so that some appears dark while certain areas remain normal giving the illusion of lights. From there I can actually add a light texture in its place to control how bright it will appear along with coloring it.   Can this be accomplished with a blend mode with OpenGL? I've tried using glBlendFunc(GL_DST_COLOR, GL_ZERO) with both but it just makes the lit portion extremely bright.This works as a temporary solution but problems arise where if you get multiple 'lights' too close together, they of course get added and get way too bright washing out all the color. Also makes it hard to adjust the intensity of it.   Can someone give me some direction how I should be doing this? Is this not possible with blending? Thanks.
  6. Thanks, so to clarify, you would say my approach of tracing which players know about who has X data from a player, then managing it from the server is the right way to go?    I'll look into the hysterisis, seems like a viable option as well.
  7. Hello, just some questions on how to handle updating data between players. More of a design and implementation question.   When it comes to keeping track of players near each other, In my game, I only want characters in a certain range to be shown, as such the server only sends data to other players in X range around the player.   Right now, the server stores who we've sent player data to so we don't keep sending the full player state constantly (after the full player state, I just send position updates). But I'm running into problems with people going out of range, having their states changed, then moving back into view and the out of view clients obviously don't know (since the player state changed out of view). I figured the solution might be to delete the reference to the known player from the other player, so when it goes out of view so it refreshes.  However, if someone is just moving in and out of view I don't want it sending full states constantly. It's been suggested to use a timer, so that once it goes out of view it has say, 1 minute before you delete the fact the other players know about you. Which is a good idea, but I'm getting wary of the server handling things like this that seem like it belongs in the client operation? I am not sure how other games handle this interaction.   What is the best way to go about this? Should the server be keeping track of which player knows about your player data and handling timeouts and view distances? I've also read some people have the client request data from the server. Example: You get movement data from a character that doesn't exist, so the client asks the server for info on this player. However, that starts having problems of queuing the initial request, waiting for the server to get the state data and send it back, then playing all of the queued up commands meant for that player when we create it.. Of course I'm not sure if that's correct as well. I guess I just need guidance on proper setup when it comes to this.   Thanks.  
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!