1

I am writing a game in which I have a Java server/client system set up.

Everything is working great, but I reached a slight problem. I have set up a basic health system, and a GUI to go with it (for example, health bars over everyone's head), but the problem happens when I want to give every player a separate GUI (e.g. an inventory).
Obviously, it should be client-side, but I cannot for the life of me figure out how to do it. Everything that I tried resulted in the GUI's painting on top of each other and being visible for all clients.

So, how would I do it? Any input is helpful. I have quite a bit of experience in Java programming, just not with Java servers.

The tutorial I followed was this Youtube video (although it seems basic, I was unaware how to do server programming at all). I can provide some of my attempts if I still have it. The server is set up towards the end of the playlist.

  • 1
    What do you mean with resulted in the GUI's painting on top of each other and being visible for all clients.? Does this mean, every client sees the GUI for every other client? – tkausl Jul 30 '15 at 18:02
  • @tkausl, Yes, that's exactly what I mean. So everyone sees everyone else's health stats and inventory. – Carl-Fredrik Nyberg Brodda Jul 30 '15 at 18:24
  • This sounds to me as if every entity is drawing its own interface. This is wrong. It may be okay that every entity draws its billboard over his head but the interface is something different. You should draw the interface once in the main-loop after rendering all entities. – tkausl Jul 30 '15 at 18:28
  • Good to hear. I'd recommend you ask in Gamedev next time, there are more guys with experience in game-development than here. – tkausl Jul 31 '15 at 10:26
1

if you want to create one server client application , the put your game logic on server , and GUI , you distribute over clients. Don't put your logic code , visibility code to GUI Client application. Also create one object of your shared game data and multiple objects of the clients. are you getting m

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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