Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (498)
Games in Android Showcase (115)
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 with libgdx  (Read 2092 times)
0 Members and 1 Guest are viewing this topic.
Offline israelg99

Junior Member





« Posted 2014-05-22 20:53:48 »

Hello i am trying to make a multiplayer game with libgdx + kryonet.
and i get kinda confused...

Some questions -
1. The server should be in a libgdx project, or in a plain java project?
2. If i should make the server in libgdx project, how can i load the gdx without creating a screen, i mean the server doesn't need a screen right?

Thanks a lot Smiley
Offline opiop65

JGO Kernel


Medals: 154
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #1 - Posted 2014-05-22 20:58:08 »

The server doesn't have to be a LibGDX project, in fact there is almost no point in making it one. Create it separately. 

Offline israelg99

Junior Member





« Reply #2 - Posted 2014-05-22 21:00:14 »

The server doesn't have to be a LibGDX project, in fact there is almost no point in making it one. Create it separately. 
Thanks that's what i thought, here i have another problem, i have a tiled map, which is the game map, so in order to check collision i will need to load it right? how can i do that?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline saucymeatman
« Reply #3 - Posted 2014-05-22 21:02:46 »

You should make a single player local game first Smiley
Offline israelg99

Junior Member





« Reply #4 - Posted 2014-05-22 21:05:05 »

You should make a single player local game first Smiley
I did, i made a single player libgdx game, now i want to implement the multiplayer feature.
So as i asked, i have a tiled map which is the game map, and in order to check collision, i will need to load it into the server, right? how can i do that? because with plain java project you don't have any tiled map loaders or something.
Offline opiop65

JGO Kernel


Medals: 154
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #5 - Posted 2014-05-22 21:11:55 »

No you won't need to. Check collisions client side for now, focus on actually learning networking before you move to advanced networking, trust me.

Offline israelg99

Junior Member





« Reply #6 - Posted 2014-05-22 21:24:56 »

No you won't need to. Check collisions client side for now, focus on actually learning networking before you move to advanced networking, trust me.
ok thanks, i will work on some other things, like the client's input and such.. and will make the collision detection client side for now..
But i will be really glad if you will tell me how should i do the collision detection server side, with tiled map please  Smiley
Offline CodeHead

JGO Knight


Medals: 41


From rags to riches...to rags.


« Reply #7 - Posted 2014-05-22 21:31:33 »

From the "Support For TMX Maps" on the GitHub page under Java:
Quote
A library for loading TMX files is included with Tiled at util/java/libtiled-java.

Seems like a good place to start. Wink

Arthur: Are all men from the future loud-mouthed braggarts?
Ash: Nope. Just me baby...Just me.
Offline JESTERRRRRR

Senior Member


Medals: 7
Exp: 1 year



« Reply #8 - Posted 2014-05-23 04:11:19 »

Depends what route you wanna go down, many involve a world of hurt Wink.

Most professional games will have a server that loads the entire map (never renders it obviously), and calculated collisions exactly as you probably are in your single player version. The people 'playing on the server' will also calculate collisions themselves, then just send what they have done (e.g. im moving forward and ended up here or something). This is when the server checks its collisions results with the clients, and send the client a correct version if it went wrong. This is essentially how you stop someone editing their client to cheat and go through walls or always claim they've shot someone, or w/e.

If you're making a small game, or even better if its co-op (no pvp) then this is unnecesary, I don't recommend it anyway as its extremely difficult when compensating for the lag time it takes to send and receive messages.

So really it all depends what your game does.. It may be best just to use the server to tell all the players what each one has done, and forget doing server side collision for now. Once you have that running smooth you can look at what problems exist, and start working on a solution.

But tl'dr your question about how to do it on server side, you keep track of the players state, receive his actions, and check his movement or w/e exactly the same as in singleplayer, so yes you need to load the collision data, be it a tiled array or bunch of squares or w/e

Edit: I just read your other thread about its being a 2d fighting game. That isnt easy, you'll need to do a fair bit of reading up on the subject. GL
Offline israelg99

Junior Member





« Reply #9 - Posted 2014-05-23 09:45:21 »

Depends what route you wanna go down, many involve a world of hurt Wink.

Most professional games will have a server that loads the entire map (never renders it obviously), and calculated collisions exactly as you probably are in your single player version. The people 'playing on the server' will also calculate collisions themselves, then just send what they have done (e.g. im moving forward and ended up here or something). This is when the server checks its collisions results with the clients, and send the client a correct version if it went wrong. This is essentially how you stop someone editing their client to cheat and go through walls or always claim they've shot someone, or w/e.

If you're making a small game, or even better if its co-op (no pvp) then this is unnecesary, I don't recommend it anyway as its extremely difficult when compensating for the lag time it takes to send and receive messages.

So really it all depends what your game does.. It may be best just to use the server to tell all the players what each one has done, and forget doing server side collision for now. Once you have that running smooth you can look at what problems exist, and start working on a solution.

But tl'dr your question about how to do it on server side, you keep track of the players state, receive his actions, and check his movement or w/e exactly the same as in singleplayer, so yes you need to load the collision data, be it a tiled array or bunch of squares or w/e

Edit: I just read your other thread about its being a 2d fighting game. That isnt easy, you'll need to do a fair bit of reading up on the subject. GL

Yeah.. i actually did already the single player and it works pretty awesome and smooth. so i decided why not adding the multiplayer? i know its hard, but what can you do? when there will be a pill that will make everything a lot easier i'll be glad to use it, but till then..  Wink
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline JESTERRRRRR

Senior Member


Medals: 7
Exp: 1 year



« Reply #10 - Posted 2014-05-24 05:11:23 »

Id you're really serious about making a proper multiplayer server type situation, I'd recommend

http://gamelix.com/resources/Unity3D%20Forum/Interpolation%20Explained.pdf

and

https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking

But I warn you just the thought of implementing it made me yawn and watch TV.  You could probably botch some little system together that balances  programming time/ease and results accordingly to what you want. I only do multiplayer stuff that doesn't require decent lag compensation.
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.

radar3301 (11 views)
2014-09-21 23:33:17

BurntPizza (29 views)
2014-09-21 02:42:18

BurntPizza (19 views)
2014-09-21 01:30:30

moogie (20 views)
2014-09-21 00:26:15

UprightPath (27 views)
2014-09-20 20:14:06

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

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

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

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

Tekkerue (50 views)
2014-09-09 02:24:56
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!