Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (538)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (601)
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 1802 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


http://t-machine.org


« 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 (127.0.0.1) 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!

http://wiki.java.net/bin/view/Games/JeffFAQ
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.

rwatson462 (29 views)
2014-12-15 09:26:44

Mr.CodeIt (20 views)
2014-12-14 19:50:38

BurntPizza (40 views)
2014-12-09 22:41:13

BurntPizza (76 views)
2014-12-08 04:46:31

JscottyBieshaar (37 views)
2014-12-05 12:39:02

SHC (50 views)
2014-12-03 16:27:13

CopyableCougar4 (47 views)
2014-11-29 21:32:03

toopeicgaming1999 (114 views)
2014-11-26 15:22:04

toopeicgaming1999 (102 views)
2014-11-26 15:20:36

toopeicgaming1999 (30 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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
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!