Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (530)
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 636 times)
0 Members and 1 Guest are viewing this topic.
Offline PRW56

Senior Newbie





« Posted 2013-01-19 17: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 18: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 18: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 19: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 Member


Medals: 2
Projects: 2


Here be random


« Reply #4 - Posted 2013-01-20 17: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  
 
 
You cannot reply to this message, because it is very, very old.

 

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

The first screenshot will be displayed as a thumbnail.

ctomni231 (33 views)
2014-07-18 06:55:21

Zero Volt (29 views)
2014-07-17 23:47:54

danieldean (24 views)
2014-07-17 23:41:23

MustardPeter (26 views)
2014-07-16 23:30:00

Cero (41 views)
2014-07-16 00:42:17

Riven (43 views)
2014-07-14 18:02:53

OpenGLShaders (31 views)
2014-07-14 16:23:47

Riven (30 views)
2014-07-14 11:51:35

quew8 (29 views)
2014-07-13 13:57:52

SHC (64 views)
2014-07-12 17:50:04
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!