Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (494)
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  
  Storing entites? [kryonet]  (Read 656 times)
0 Members and 1 Guest are viewing this topic.
Offline GNecro1
« Posted 2014-07-13 13:54:44 »

Well i am working on a multiplayer game, and i have like enemies that spawn randomly so i was wondering should the server spawn the entities like send the x,y of that entity and the client would render it? And the same question for the particles should i store the in server or every client would generate(server is telling the client where to generate them) them for like example fire particles, but it wouldn't be the same for anyone? I done this with some cubes moving around, this seams more complex!

Java freak! Cheesy
Offline Xkynar

Junior Newbie


Medals: 1



« Reply #1 - Posted 2014-07-13 19:49:46 »

It depends on the ammount of trust you want to give your game's clients, usually the game logic is mostly server-side to avoid hacked clients, and if that is what you wish, the server would simply update the state of the entities and send that updated state to every client (the state being, for example, the position). This way, the only thing the client does, if you have a controllable hero for example, is to ask the server to move the hero, and the server will move it or not, depending on the game logic and if moving the hero is possible (there might be a wall infront which would block the hero's path).
You can also do the logic client-side and send the results to the server so the server updates the rest of the clients about your state, but that would create the chance for hacked clients to send altered states which shouldnt be possible with the default client.

If you opt for the first option, in your case, yes, the server should tell the clients where to spawn the entities and then send regular updates so the clients know which is their most recent state, to draw them accurately.

As for particle effects, thats something that should be fully client-side. Every aspect of rendering is usually done client-side, and particle effects is just a matter of knowing where should it spawn to make it happen, it doesnt matter if its not exactly the same in every client, the results are similar and unless particle effects actually affect your gameplay, you dont have to worry so much about it.
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.

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

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

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

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

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

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

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

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

Longarmx (26 views)
2014-09-07 01:10:19

mitcheeb (34 views)
2014-09-04 23:08:59
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!