Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
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 2624 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  

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

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

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

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

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

nelsongames (141 views)
2018-04-24 18:14:32

ivj94 (883 views)
2018-03-24 14:47:39

ivj94 (144 views)
2018-03-24 14:46:31

ivj94 (795 views)
2018-03-24 14:43:53

Solater (159 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 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!