Hi,
I just started to learn jmonkey network few days ago and have lots of problems:
- How to let clients see each other?
For example, client#1 connects to server and then client#2 connects. How does client#1 see client#2 ? Iv used rootNode.attachChild(// code for adding my new hero) to let client#1 see client#2. It works but after adding client#2, client#1 cannot control his own hero, it controls the new hero. (hope i describe this clearly…)
2.How to get the existing information?
For example, when the client#2 connects, how does it know the position of client#1 (and maybe the healthPoint of client#1’s hero)? Use something like logger to save information and server to read and broadcast to client#2 when he connects?
3.How to share information?
I just show an example to describe this question:
In my game, there is a building which will be destroyed by heroes. When the client#1 hits/beats this building once, the building’s healthPoint would reduce 1, assume the initial HP of building is 100, then now it should be 99 and 99 should be shown on all clients’ screen. After that, client#2 hits the building, then it reduces 1 again. Now the building’s HP should be 98. (Not 100-1=99 on client#2’s screen). How to achieve that? Use a global class to hold all data?
Many many thanks, experts!