Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (753)
Games in Android Showcase (228)
games submitted by our members
Games in WIP (842)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  multiplayer game - java2D  (Read 1512 times)
0 Members and 1 Guest are viewing this topic.
Offline dav0012

Senior Newbie

« Posted 2014-04-25 18:49:10 »

Hello all, urgent guidance required  Huh 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 ?  Undecided
Offline Drenius
« Reply #1 - Posted 2014-04-25 19:18:59 »

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.
Offline Gibbo3771

JGO Kernel

Medals: 128
Projects: 5
Exp: 1 year

Currently inactive on forums :(

« Reply #2 - Posted 2014-04-25 19:33:10 »

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

"This code works flawlessly first time and exactly how I wanted it"
Said no programmer ever
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline atombrot
« Reply #3 - Posted 2014-04-25 21:17:11 »

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.

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

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.
Offline dav0012

Senior Newbie

« Reply #4 - Posted 2014-04-25 22:01:16 »

ops, new to forum, karma action limited to 1 the hour 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. Smiley

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  Smiley ? Huh
Pages: [1]
  ignore  |  Print  

ivj94 (583 views)
2018-03-24 14:47:39

ivj94 (48 views)
2018-03-24 14:46:31

ivj94 (374 views)
2018-03-24 14:43:53

Solater (62 views)
2018-03-17 05:04:08

nelsongames (109 views)
2018-03-05 17:56:34

Gornova (151 views)
2018-03-02 22:15:33

buddyBro (694 views)
2018-02-28 16:59:18

buddyBro (92 views)
2018-02-28 16:45:17

xxMrPHDxx (493 views)
2017-12-31 17:17:51

xxMrPHDxx (733 views)
2017-12-31 17:15:51
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!