Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (776)
Games in Android Showcase (231)
games submitted by our members
Games in WIP (856)
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 top down shooter  (Read 1818 times)
0 Members and 1 Guest are viewing this topic.
Offline PRW56

Senior Newbie

« Posted 2013-01-19 16:49:46 »

As the title said, I am trying to make a multiplayer top down shooter, I get the gist of the client server model and java sockets, but I am unsure as exactly where to put them... What I mean is, a single player starts a server, then after every one links to it, what exactly should be sent to each player. Does every player only send their location to the server, location of any projectiles they fire, the ID of an enemy if they hit it? If someone has a link to a tutorial or something on the subject pls tell me. THX for ANY help!
Offline Rorkien
« Reply #1 - Posted 2013-01-19 17:05:21 »

Usually the players just send their input data (if they are going on X direction, if they are pressing SHOOT, etc.) and the server handles everything, from collision to movement of all players, to avoid hacking.

Imagine if the players have to send their own object data to the server: Since it would be in their own computers, they should be able to modify it's memory address to change anything they want.
This usually results in players flying everywhere, shooting everywhere and people getting killed like it's a drone attack.
Offline PRW56

Senior Newbie

« Reply #2 - Posted 2013-01-19 17:28:47 »

makes sense... so say when someone presses the button to shoot, should that player send a series of varriables or IDs needed to create the object on the server, or create the object and send it to the server (is that possible?), I assume the former, so after the server has the object(s), does it send the data for ALL of those objects to every player, or just ones that have changed?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Rorkien
« Reply #3 - Posted 2013-01-19 18:10:41 »

There are endless ways to achieve it.

In general you want to keep the server-side and the client-side datas sync'ed as much as possible. Both ways are possible, but you must take several factors, like bandwidth, into account. Sending an entire object might be harder and slower than sending just the variables that changed.
Offline doos

Senior Devvie

Medals: 2
Projects: 2

Here be random

« Reply #4 - Posted 2013-01-20 16:30:03 »

Instead of sending position updates constantly, you can predict motion with an equation.

Server updates every player client with current gametime, local objects and equation of motion (object starting position, equation plots where it will be). Can give an updated snapshot of this.
Every player client updates server with location, change of course and any actions of player.. Also timestamp of when this happened.

Every player client uses object list and equation of motion to update what is on screen.

Maybe server decides whether someone has been hit or not and creates objects based on timestamp and action? Maybe this is handled on individual clients and confirmed by the server?

You can also cheat by updating generic source of particle effects, rather than each particle.

I'm sure theres probably an api or tutorial for this.. Dont be afraid to read tutorial about how to network a 3d fps, as apart from the extra dimension, the problem is the same.
Pages: [1]
  ignore  |  Print  

hadezbladez (270 views)
2018-11-16 13:46:03

hadezbladez (147 views)
2018-11-16 13:41:33

hadezbladez (280 views)
2018-11-16 13:35:35

hadezbladez (63 views)
2018-11-16 13:32:03

EgonOlsen (2110 views)
2018-06-10 19:43:48

EgonOlsen (2142 views)
2018-06-10 19:43:44

EgonOlsen (1354 views)
2018-06-10 19:43:20

DesertCoockie (1942 views)
2018-05-13 18:23:11

nelsongames (1594 views)
2018-04-24 18:15:36

nelsongames (2241 views)
2018-04-24 18:14:32
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46 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!