Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (711)
Games in Android Showcase (213)
games submitted by our members
Games in WIP (785)
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  
  Questions about hosting and playing.  (Read 2368 times)
0 Members and 1 Guest are viewing this topic.
Offline Addictman

Senior Devvie

Medals: 3
Projects: 1

Java games rock!

« Posted 2005-03-28 17:01:07 »

Hi there.

When designing a game where the server is inside the game itself (no centralized server running somewhere else), where one of the players is the host, and the others join the game...

Do you treat the host differently with regards to network code? Do you build custom written code for the game host, or do you treat the host like any other player? I mean, if I treat it like any other player, I will be taxing the network code more than I need to, however it's obviously the easiar way to go. Since the host player will be able to talk to the server directly, custom code could make things more efficient, but by how much? Is it worth it? Does anyone have any experience as to what normally works out for the better?
Offline blahblahblahh

JGO Coder

Medals: 1

« Reply #1 - Posted 2005-03-28 17:48:40 »

Like all "performance issues" there is no accurate answer to your questions in the abscence of a detailed game description.

However, performance on localhost using the networking layer is pretty fscking good in general so long as it uses the loopback interface ( and not the external interface; Just make sure you connect on 127 / localhost when connecting to the local server.

There's significant overhead to using lo, but you're never going to notice it in a non-dedicated-server game - it will be dwarfed by your other issues (*)

(*) modulo my first sentience above; i.e. I'm sure you could come up with many situations or several where you do notice. But since you've not described the game, you probably want an inaccurate, finger-in-the-air answer, so here ya go Smiley

malloc will be first against the wall when the revolution comes...
Offline Addictman

Senior Devvie

Medals: 3
Projects: 1

Java games rock!

« Reply #2 - Posted 2005-03-28 18:53:53 »

Thanks Smiley

Yes, I was looking for more or less a "general rule of conduct" in the matter. I was not sure exactly how networking over localhost worked (Faster than remove networking is obvious, but I was not sure just how fast it was).

In my specific game, your answer confirmed my initial thoughts of handling the host as any other player.

The game is a turn-based board game, where each "action" (usally moving units, playing cards) are performed in cycles, so networking is always completed for one player before it begins on the next player. So, the network part of this specific game is pretty stressless. However, I always keep in mind how I can "generalize" the code for later, (if only with commenting the code), so I wanted to ask this question to get some general feedback. Which I did. So, all is good Wink
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Jeff

JGO Coder

Got any cats?

« Reply #3 - Posted 2005-04-16 01:35:20 »

Short answer is that on a LAN, for almost any conceivable data-transfer use, bandwidth is effectively infinite and latencies are effectively infintessimal.

So yes you can treat the host like any other client and no its not really worth doing any special coding.

Many games will in fact actually launch a seperate process for the server.  This was staretd by  Quake2 and is still commo ntoday (ie all the Bioware NWN engine games do this... NWN, KOTR, KOTRII, etc)

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

Archive (63 views)
2017-02-27 19:41:49

Riven (73 views)
2017-02-27 17:26:59

numerical (442 views)
2017-02-21 07:32:16

numerical (445 views)
2017-02-21 07:31:46

theagentd (556 views)
2017-02-18 13:42:33

theagentd (552 views)
2017-02-18 13:35:16

h.pernpeintner (1727 views)
2017-01-24 22:39:11

h.pernpeintner (1685 views)
2017-01-24 22:38:32

Galdo (2266 views)
2017-01-12 13:44:09

Archive (2183 views)
2017-01-02 05:31:41
List of Learning Resources
by elect
2016-09-09 09:47:55

List of Learning Resources
by elect
2016-09-08 09:47:20

List of Learning Resources
by elect
2016-09-08 09:46:51

List of Learning Resources
by elect
2016-09-08 09:46:27

List of Learning Resources
by elect
2016-09-08 09:45:41

List of Learning Resources
by elect
2016-09-08 08:39:20

List of Learning Resources
by elect
2016-09-08 08:38:19

Rendering resources
by Roquen
2016-08-08 05:55:21 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!