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.

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.

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.

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.

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.

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.

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.

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?

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.

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.

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

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 andhelpful to such a small account. The provider for my site, www.Boardspace.net is www.steadfast.net and I amvery satisfied with their service.

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.

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.

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.

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.

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.

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.

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.

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.

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