Jump to content
  • Advertisement

Greyshack

Member
  • Content Count

    6
  • Joined

  • Last visited

Community Reputation

107 Neutral

About Greyshack

  • Rank
    Newbie
  1. So after reaching the position such player should stop? What if the update arrives earlier/later due to latency for example? I'll look into the link, thanks.
  2. I'm having a different problem now but it's still related to multiplayer implementation so I figured I'll write it here as well. I have the client and the server working and the clients get updates every 1/20 of a second containing information like positions of all characters. What I'm doing in short on the client is I'm drawing the enemies in the past, meaning I store a previous packet in memory and when the next one arrives I interpolate the enemy movement from the previous packet position to the next one. When the packet arrives I also correct the position of a given player if it differs greatly from the data I receive from the server. The problem here is that it never is as smooth as I'd like, certainly not as smooth as movement of character just drawn by the client. The correction formula: (distance is the distance between current player position and where it should be when the new packet arrives(which is the position of the previous packet)). if (distance > 2.0){         position = pos; } if (distance > 0.1){         position += distVec*0.1f; } How do you go about drawing enemies? I'm 99% sure you have to draw them in the past. Maybe go one packet further and draw them with a delay of two packets?
  3. If the server was made in C++, can I send the whole structs over the socket? Beacause I've read somewhere that its not recommended but didn't really understand this.
  4. 20 packets per second, about 100 bytes per player. What is the best commercial situation? Server in c++ I assume. How to send the data then? As pure bytes in some kind of sequence that I set myself? Like for example first 4 bytes are player x etc? I've made the server and everything works and over 300km there is a slight delay, my friend tells me. So I'll be trying to reduce it as much as it is possible. Is a ping-pong delay test every second a good idea? To take it into account on the server side when calculating.
  5. @Sivx The point is that I want my own game engine and my own server etc., I'm doing this because I want to see if I can and apart from that because I enjoy it a lot. And it's not like I'm only starting, I have the engine working already, animated models and so on. I decided to write the client in C++ and the server in Java after I read that it's not recommended to send the whole structures over the network so it's not like making the server in C++ had that many advantages(and I prefer Java over C++). So now I am focusing on making the server and there are many things I'm unsure about, since it is my first time. Basically I've decided that positions and collisions will be calculated by server and the client will only receive updates as well as notifications in case his character gets hit etc. And the client will notify the server when the player want to go to a certain position or has casted a spell. I've just read that in many games such "packets" of data from the server are send something like 20 times per second, and the client somehow interpolates in between to get the smooth gameplay. Do you think its necessary to do this even if there is an 8 player limit ? Because what I intended to do was to have the loop on the server running at 60 FPS and send updates every game update on the server. @hplus0603 Yeah I have zero knowledge of Java NIO, but actually I'm only using multiple thread to listen to the client sockets. There is only one thread doing the updates of the game state. And since the game isn't very complicated I think I am able to port the engine mechanics to Java without much problems. And I'm sending only the most important data parsed in JSON strings over the network.  
  6. Hey, To begin with I read the FAQ but I did not get all the answers I was looking for, so please do not send me back there :) I'm developing a game in OpenGL in C++ that is intended to be a multiplayer one. I have a few questions about the approach that I should take when implementing the multiplayer. I have experience writing client/server applications in Java, never did it in C++. Below is how I imagine doing it, and I'd like you to correct me if anything I think is wrong. I want to write the server in Java. It would create a separate thread for each player. The clients would only send the server their inputs, for example a click made by the player so that the character moves, or information that a spell has been cast. The server would calculate the positions of every dynamic object and send it to all players. It would also take care of collisions etc. Since I'm not familiar with C++ networking, I was wondering if it was possible to somehow make client side also in java and communicate with the game program somehow? I don't think so, but I'll ask anyway :)
  • 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!