Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (497)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
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 341 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
« 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

Senior Member


Medals: 10
Projects: 1



« Reply #3 - Posted 2014-04-25 21:17:11 »

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

https://github.com/EsotericSoftware/kryonet

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  
 
 

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

BurntPizza (19 views)
2014-09-19 03:14:18

Dwinin (34 views)
2014-09-12 09:08:26

Norakomi (62 views)
2014-09-10 13:57:51

TehJavaDev (87 views)
2014-09-10 06:39:09

Tekkerue (42 views)
2014-09-09 02:24:56

mitcheeb (65 views)
2014-09-08 06:06:29

BurntPizza (47 views)
2014-09-07 01:13:42

Longarmx (35 views)
2014-09-07 01:12:14

Longarmx (40 views)
2014-09-07 01:11:22

Longarmx (36 views)
2014-09-07 01:10:19
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org 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‑gaming.org
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!