multiplayer game - java2D

Hello all, urgent guidance required ??? i am developping a simple game using java with Graphics2D library.
the game involve moving of objects, object and its attribute are stored in a class : Piece

during the game every object involved in the game are stored within a 2D array. (every piece has a position atribute)
this is my 1st game and i need it to be able to allow two user moving diferent piece ON THE SAME PANEL.

if my thinking is good, i think i need to find a way to share the the 2D array and make it possible to access and modify the array at the same time.

i know a litle bit of socket programming, Gurus, share your wisdom with me. How should i proceed ? :-\

Events. Send an event when something is moved with the information what was moved and where it got moved so all other clients can reproduce this event locally.

But starting with networking for your first game is possibly not the best idea.

It’s a terrible idea, your project will most likely end in frustration

Take a look at kryonet. It is a nice and simple networking library.

It is very likely, that you have to change your existing code, so it supports multiple players, but it’s very hard to give any advice without having more details. It’s definitly much easier if it is round based and not in realtime. Best would be you start a test project to get used to networking. When you get that, you can work out how to incorporate that into your game.

I agree to that, networking / programming for multiplayer is certainly not the easiest thing to start with. If you are new to programming, it might be better if you first create a singleplayer game (or multiplayer on the same machine using keyboard, gamepad and mouse. yes, that still exists :wink: ) and learn the basics of programming. It’s much easier to learn one thing at a time.

ops, new to forum, karma action limited to 1 the hour :stuck_out_tongue:
so firstly, thank you all for response and sry for the lack of information.

infact, my 1st game is in wrk in progress:- consist of moving object around, details are up (simple shape objects).
Just right now i have just finished the singleplayer(the core fully functional with only some interface stuff remaining).

what i need to do is make this Same game to be playable by two players.
i know for a newbie am pushing the level high but i acepted this challenge. Java is too vaste and there are soo many way to code something, that is why i need the point of view of You, experienced programmer , which will help me understand how i have to attack this multiplayer part. :slight_smile:

like i said every data is stored in a 2D array
-darius suggested using events : i am investigating on it…
-atombrot: will check this 1st thing in the morning, learning some some basic networking stuff 1st.
any other ideas and suggestions are welcomed :slight_smile: ? ???