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] 2 3
  ignore  |  Print  
  Networked Gaming  (Read 13446 times)
0 Members and 1 Guest are viewing this topic.
Offline neoskunk

Junior Member





« Posted 2008-10-26 21:36:43 »

so i have this game sort of like worms where you choose angle and power and attempt to hit your opponent.  Im new to java however and i was wondering how hard would it be to make this game networked?

whats some good websites to learn networking in java?
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #1 - Posted 2008-10-27 00:02:40 »

Take a look at Sockets and Java's tutorial on them:

http://java.sun.com/developer/onlineTraining/Programming/BasicJava2/socket.html

A warning - networked stuff can be pretty damn difficult. If it's a simple game though it shouldn't be too much of a problem.

See my work:
OTC Software
Offline neoskunk

Junior Member





« Reply #2 - Posted 2008-10-27 03:15:55 »

i have been looking at stuff like that.  im guessing i want tcp not udp right?  and as far as games go its just 2d and turn based, nothing real time.  so i would think i only need to pass along 3 or 4 values just to let one person know what the other person did on their turn.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #3 - Posted 2008-10-27 16:07:56 »

If it's turn based, TCP will work fine. The potential problem with TCP is that things may lock up while waiting for packets that were never sent or died on delivery. UDP doesn't have this issue, although packets can be sent in any order or not at all. Any game that needs to send a lot of information (like Warcraft, Team Fortress, etc.) use UDP.

See my work:
OTC Software
Offline Addictman

Senior Member


Medals: 3
Projects: 1


Java games rock!


« Reply #4 - Posted 2008-10-27 17:07:55 »

Unless you're asbsolutely certain you need to use UDP, don't.

As for popular games like Warcraft, it is not true that they use UDP. Warcraft 3 uses UDP to broadcast the hosting of a game, so that when users over the world refresh their game lists, your game will pop up. Nothing crashes if user X can't see your game. Hence, UDP.  Data transfer and game negotiation is done over TCP. The biggest game out there today, World of Warcraft, also uses TCP.
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #5 - Posted 2008-10-27 17:45:56 »

Unless you're asbsolutely certain you need to use UDP, don't.

As for popular games like Warcraft, it is not true that they use UDP. Warcraft 3 uses UDP to broadcast the hosting of a game, so that when users over the world refresh their game lists, your game will pop up. Nothing crashes if user X can't see your game. Hence, UDP.  Data transfer and game negotiation is done over TCP. The biggest game out there today, World of Warcraft, also uses TCP.

Really?!? I thought I had read that all those games had to use UDP.

And in my experience with TCP if I'm requesting information too fast it hangs because it doesn't arrive fast enough. Obviously I'm not as good as Blizzard is, but after reading this : http://www.java-gaming.org/topics/udp-vs-tcp-ip/608/view.html incredibly long discussion that's the conclusion I came up with. You simply can't use TCP for "real-time" stuff because it will wait for missing packets. Like when things get all choppy and jump around, that's because you're dropping packets. With TCP that wouldn't be choppiness, it would be freezing up.

See my work:
OTC Software
Offline Addictman

Senior Member


Medals: 3
Projects: 1


Java games rock!


« Reply #6 - Posted 2008-10-27 18:19:28 »

I'd say intensive First-Person shooters are games that would benefit from using UDP. It requires lots of packets back and forth, but each packet is relatively small. UDP has less inherent overhead, so the total data amount will be smaller. Also, because the graphics of these games update really quickly (as opposed to human reaction), a missed packet should not be more than a slight hiccup graphically (because the next update comes so fast after).

Remember that very few games can enjoy a "I don't care" mentality on its sent and received data. And in these situations, the game needs software replacements for the guaranteed delivery contract. This is far from trivial to implement in any software that's beyond tic-tac-toe.
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #7 - Posted 2008-10-27 19:47:57 »

Yeah I read up on it some more and Warcraft certainly does use TCP, although I was right that most FPS's use UDP. I must have had some weaksauce code when I've written TCP networked programs, because I've gotten complete lockups while the server waited for a missing package.

See my work:
OTC Software
Offline neoskunk

Junior Member





« Reply #8 - Posted 2008-10-27 22:37:28 »

so given all the above you would recommend tcp if im building a 2d, 2 player, turn based game?

in the end i would like to implement a lobby where players could wait and chat and challange one another.
once they finish a match they return to the lobby.

can all this be done using tcp?

also how do you go about developing a game like this?  in order to test it do you need a server?
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #9 - Posted 2008-10-27 22:49:58 »

Absolutely do it with TCP. It's much easier.

And yes you can do all that, although it can get pretty complicated to make lobbies and stuff. You might want to check out something like Game Gardens to do all this for you. Otherwise, yes you're going to need to set up a server. However, all you need to do for that is to run a server and a client on the same machine, and have the client connect to "localhost" or "127.0.0.1" as either will work.

See my work:
OTC Software
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline neoskunk

Junior Member





« Reply #10 - Posted 2008-11-05 07:11:52 »

so how exactly does one go about setting up a game?  ive read things saying you can host a server from home but that doesnt sound very reliable or like it can handle much traffic.  are there hosting companies out there that will host games?  if so what are some?  any of them free?   how are professional games hosted?
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #11 - Posted 2008-11-05 09:12:10 »

You'll have hard luck finding somebody who will host a custom application for you. Your best bet at this point is just to plug a machine into your wall and leave it on.

See my work:
OTC Software
Offline Jackal von ÖRF

Junior Member





« Reply #12 - Posted 2008-11-05 13:09:58 »

There are companies which lease servers and then you can host any applications on a server which is dedicated to you. Google for server hosting. Where I live, the prices for a virtual server are 30+ EUR/month, and the prices for a dedicated server are 100+ EUR/month.

Offline neoskunk

Junior Member





« Reply #13 - Posted 2008-11-05 14:55:07 »

so what is the upload rate with cable/broadband?  will the service provider even let you host a server/have access to port 80?
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #14 - Posted 2008-11-05 17:34:13 »

There are companies which lease servers and then you can host any applications on a server which is dedicated to you. Google for server hosting. Where I live, the prices for a virtual server are 30+ EUR/month, and the prices for a dedicated server are 100+ EUR/month.
Yeah but most of those don't let you run your own server app. I remember doing a search a long time ago and there were a lot of services for hosting counterstrike etc. games, but not for installing my own Java server application. There's a big difference there because of possible security issues.

See my work:
OTC Software
Offline neoskunk

Junior Member





« Reply #15 - Posted 2008-11-05 19:03:30 »

yea i did the same search and they will all host cs and call of duty etc.  will all internet providers allow you to host a server?
Offline ewjordan

Junior Member





« Reply #16 - Posted 2008-11-05 19:31:36 »

My brother tells me that Amazon's EC2 service is very straightforward for this type of thing, and they let you configure your "machine" literally amy way you want (you upload an image of the thing). The only catch is that it's 10 cents per hour, so that's about $75 a month. Not terrible, but it's not cheap either and that's only for the smallest unit of computation and does not factor in bandwidth, which can add significant cost if you see high usage..
Offline ddyer

Senior Member


Medals: 5



« Reply #17 - Posted 2008-11-05 21:48:53 »

Plenty of providers rent virtual private servers where you have root access and can do anything you want,
starting at about $30/mo for low end systems.  The only trick is finding a provider that will be reliable and
helpful to such a small account.   The provider for my site, www.Boardspace.net is www.steadfast.net and I am
very satisfied with their service.
Offline Jackal von ÖRF

Junior Member





« Reply #18 - Posted 2008-11-05 22:11:22 »

Yeah but most of those don't let you run your own server app. I remember doing a search a long time ago and there were a lot of services for hosting counterstrike etc. games, but not for installing my own Java server application. There's a big difference there because of possible security issues.
I was talking about server hosting where you get a root access to the server and can do anything you like with it.

Offline neoskunk

Junior Member





« Reply #19 - Posted 2008-11-05 23:04:47 »

so what about just hosting a site from home to begin with.....is it possible with just a basic internet/broadband provider?
Offline Abuse

JGO Knight


Medals: 12


falling into the abyss of reality


« Reply #20 - Posted 2008-11-05 23:35:47 »

so what about just hosting a site from home to begin with.....is it possible with just a basic internet/broadband provider?

Unless you are using a very restrictive ISP, ofcourse you can.

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline aldacron

Senior Member


Medals: 9
Exp: 16 years


Java games rock!


« Reply #21 - Posted 2008-11-06 02:49:54 »

so what about just hosting a site from home to begin with.....is it possible with just a basic internet/broadband provider?

Your users likely won't have great connectivity, though. I would recommend a VPS (virtual private server). Both SliceHost and Linnode have plans starting at US $20/mo, with enough memory/bandwidth to get you started (and you can always upgrade, or get more nodes, if you need). You have full control over your node/slice and have the option of several different Linux distros to install. At any time, you can wipe it and start over with a fresh install in a matter of minutes using the tools they provide. The support is top-notch (especially at SliceHost) and there are plenty of resources to help with setup and maintenance. If you need to run multiple nodes, Linnode will exclude internode bandwidth usage from your total.

I've got a VPS with SliceHost that I've been using for personal stuff for a few months now and have no complaints.
Offline ewjordan

Junior Member





« Reply #22 - Posted 2008-11-06 03:02:28 »

Unless you are using a very restrictive ISP, ofcourse you can.
Most ISPs that I know of will allow this on a technical level, but prohibit any sort of server running at the TOS level, and reserve the right to shut you down if they notice (Comcast definitely does this). Fios is the only exception I know of (for the lucky few that have that option), unless you get a business plan from your provider.
Offline Abuse

JGO Knight


Medals: 12


falling into the abyss of reality


« Reply #23 - Posted 2008-11-06 11:14:15 »

Most ISPs that I know of will allow this on a technical level, but prohibit any sort of server running at the TOS level, and reserve the right to shut you down if they notice (Comcast definitely does this). Fios is the only exception I know of (for the lucky few that have that option), unless you get a business plan from your provider.

Wow, US ISPs must realy suck?!
Unless you are trying to operate a commerical website through a residential broadband connection, ISPs here in the UK generally don't care what you do - so long as you don't exceed whatever your bandwidth cap is.

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #24 - Posted 2008-11-06 22:26:18 »

As far as I know on Comcast (my US ISP) I can host whatever the hell I want.

See my work:
OTC Software
Offline ddyer

Senior Member


Medals: 5



« Reply #25 - Posted 2008-11-06 22:33:49 »

- so long as you don't exceed whatever your bandwidth cap is.
Bandwidth cap?  Gee, ISPs in the UK must really suck.  We generally have unliminted bandwidth here (at least today..)

Seriously though, hosting at home is fine as a development experiment, but if you're at all successful it results in your home machine becoming unavailable to you.   Limited or not not, you probably have pretty low reliability, low speed, and high latency compared to a regular service provider.
Offline SunshineKiller

Junior Member





« Reply #26 - Posted 2008-11-19 04:40:16 »

check out i think its vps-link or something like that, google them. a small vps server is only 7 bucks USD a month for 64 ram, a good amount of bandiwdth and enough space, then if your server does get that traffic and makes your bandwidth go sky high, you can upgrade it.  Whats great about vps servers is you pick your operating system, putty into it and do whatever you want, install java, mysql, tomcat, etc... and vps link is very good and the cheapest around. I currently have a plan with them right now, i managed to run it using lighttpd mysql sendmail all under 64 ram sql takes up a heck of alot.

<b>Check out my Development Blog:</b> <a href="http://www.scottscreations.com">Scotts Creations</a> | <b>Games in Development: </b> <a href="http://mechwarfare.scottscreations.com">Mech Warfare</a> | Mech Warfare: Facebook Edition | Game Master
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #27 - Posted 2008-11-19 17:13:51 »

Hi

We use The Planet, got root access (we even changed the distro on our server), we have a numer of websites, game servers, email server etc, anything we want. Our server costs something like $80 USD a month for 1500GB of bandwidth, it's quite an old machine (celeron 1.7) and we upgraded the RAM, but it woks nicely.

HTH

Endolf

Offline Addictman

Senior Member


Medals: 3
Projects: 1


Java games rock!


« Reply #28 - Posted 2008-11-19 18:13:27 »

Just pay some of the tech guys at your nearest university, and place your little server under someone's table there, and enjoy their (usually) awesome bandewith Wink
Offline neoskunk

Junior Member





« Reply #29 - Posted 2008-11-19 23:15:28 »

wow all great ideas.  i might look into the university thing since i currently attend the university of texas.  although while on the subject of networking i have one quick question. 

my game is turn based thus data is not constantly sent back and forth between the two games.    However, is there a good way to show animations while waiting for data to come in?   to be more specific the applet alone has a run method that (without networking) handles gameplay.  However, i have come to learn that putting code in the existing run method for networking causes the run method to stop while waiting for data to come in.   thus my question is whats the best way (or is there a way) to allow animation to continue and wait for data to come in at the same time?

i tried creating a second thread that just looped on in.readLine(); but this just made things screwy.
Pages: [1] 2 3
  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.

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

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

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

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

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

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

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

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

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

mitcheeb (37 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!