0
\$\begingroup\$

This question already has an answer here:

I'm developing a game and it is intended to be a multiplayer game. I have experience in writing servers and clients in Java, but the game is written in C++. The server will be written in Java for sure.

I have 3 questions:

  1. Am I forced to write the client in C++ ?
  2. If not, is there a way to write the client in Java as well, and somehow communicate with the game program?
  3. The game includes characters moving. Is the correct approach to calculate the positions of every dynamic object on the server and for the clients to only receive the current positions of everything from the server? The only thing the clients would send is their input(click, spell casts etc.).
\$\endgroup\$

marked as duplicate by Seth Battin, Anko, Kromster, Josh Jun 29 '15 at 15:22

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • \$\begingroup\$ When it comes to choosing a networking solution for your game you need to include things like: Max # of players on the server, besides position - what other attributes of a character do you wan't to be synchronized. Is it 2d? What about rotation? Is it 3d? What about orientation, animation & animation frame, looking vector, etc. Please modify your question and include more details about the game. Also, you can develop a multiplayer game client in Java - I've made an online voxel FPS in Java and it runs wonderfully. \$\endgroup\$ – ClickerMonkey Jul 6 '15 at 15:26
1
\$\begingroup\$

In a client/server architecture it is not required that client and server are implemented in the same programming language. They usually communicate by sending raw data via network sockets. So you can choose the technology for each component separately, depending on your requirements, skillset and personal preferences. An exception would be when you want to use some library for netcode abstraction which isn't available for both languages you would like to use.

Only sending clients the data they need and only receiving their input and calculating the game mechanics on the server while only receiving the input is usually a good approach. This is called an authoritative server and it is the best way to prevent cheating. However, any actions the client performs locally should be performed without waiting for a confirmation to make the game appear smoothly regardless of the network latency.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.