Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (109)
games submitted by our members
Games in WIP (536)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1] 2 3 ... 6
1  Game Development / Networking & Multiplayer / Re: Is TCP truly "guaranteed delivery"? on: 2011-03-17 01:04:54
While TCP is "reliable" it should be noted that a connection can go dark without throwing exceptions per say. That is the connection become a black hole direct to /dev/null. I have noticed to get solid TCP reliability i need to have my own timeouts where i then treat this the same as a socket exception (connection closed by... etc).

I have heard of this happening previously.  However, I was under the impression that setting a timeout using .setSoTimeout() would allow this condition to be caught?  I have set up a ping-pong type communication between the server and the client per a suggestion in a previous thread.  I was under the impression that if a thread blocked on say in.readLine() for longer than the time set with .setSoTimeout() a socket exception would be thrown.  Is this incorrect?
2  Game Development / Networking & Multiplayer / Re: Is TCP truly "guaranteed delivery"? on: 2011-03-14 02:21:11
 

My games have a
(a) a reader thread that reads messages from the TCP stream and queues them for the game
thread to process.
(b) a game thread that processes messages from the reader thread (and also other sources of input
such as the mouse and keyboard).  It queues outgoing messages for a writer thread to deliver, but
never waits for them to be sent.
(c) a writer thread that sends messages that were queued for it to send.


I do something similar for receiving but I never thought of doing that on the sending part.  I have a thread that queues messages that are received and then processed by the update thread of the game cycle (ie. update, render, draw).  Even if this isn't my problem doing it for the sending part would be a good idea.  Thanks for the info.
3  Game Development / Networking & Multiplayer / Re: Is TCP truly "guaranteed delivery"? on: 2011-03-12 09:17:56
Ok yea that makes sense, at least for testing on a local machine I can see why that would be useful.

Like philfei suggested it was where both opponents were waiting.  However, it was not something that I could duplicate and still haven't seen it happen since.  Thus I was wondering if TCP could possibly just lose information that way (my original question).

Abstractly this is how my game functions:

p1 connects to server.
p2 connects to server.
when two players are connected the server pairs them and creates a game.

p1 takes his turn.
the turn is animated on p1's applet.
the information from the turn is then sent to the server.
server does necessary checking for cheating etc. and send the turn to p2.
p2 then animates p1's turn.
p2 then takes his turn.
...
cycle repeats.

the game froze after I took my turn.  the turn was successfully animated on my applet.  thus I would think that data was also sent.
this is where logging would have been helpful.

it just seemed strange to me that it was such a random occurrence.  however the game has not been thoroughly tested thus maybe the occurrence isn't so random.

i'm going to set up a log and that should get me moving in the right direction.  if anyone thinks the abstraction part above doesn't sound like I'm doing something correctly let me know.
4  Game Development / Networking & Multiplayer / Re: Is TCP truly "guaranteed delivery"? on: 2011-03-10 01:22:15
Eli can you be more specific?  How does logging help me?  And I'm assuming you mean on the server side program?  Or server and client?
5  Game Development / Networking & Multiplayer / Re: Is TCP truly "guaranteed delivery"? on: 2011-03-07 20:12:38
Just to clarify: you are talking about keeping a single connection open and sending multiple messages down it?

Yes I am.

However, I currently send everything as a string and parse it for whatever data is needed. I'm going to check my code must be my mistake. Thanks for the info guys.
6  Game Development / Networking & Multiplayer / Re: Is TCP truly "guaranteed delivery"? on: 2011-03-07 09:03:40
ok thats what I was thinking but just wanted to make sure.  Just to clarify, there is no possible way that messages will get out of order either right?  Meaning if there is a problem with a certain message the connection will timeout rather than send the next message?
7  Game Development / Networking & Multiplayer / Is TCP truly "guaranteed delivery"? on: 2011-03-07 07:21:16
Ok so i know TCP is supposed to be guaranteed delivery and delivered in the correct order but I have come across a situation where it would seem that a TCP "message" was lost all together.  Is this possible or is this a flaw in my code?

In detail:

I have a turn based game and it worked perfectly well for 3 or 4 games but on the 5th game a strange thing occurred where me and the person I was playing got stuck on a screen that said "waiting for opponent to take their turn."  However, I don't think the entire connection was blown since me and the other player could send "chat" messages back and forth (using the same port and socket).  Therefore leading me to believe that the data for my turn was simply lost.
8  Game Development / Game Play & Game Design / Re: Alphabetically arrange user objects on: 2010-12-08 00:40:25
My bad I honestly thought that was a link to comparable not comparator.  I think at that point I didn't even know that comparator existed.

That being said, whats wrong with defining the natural ordering of my objects.  My objects are now similar to int, string, etc. that all have a natural ordering with no need to define a comparator.  All of those objects implement comparable, why can't my objects do the same? 
9  Game Development / Game Play & Game Design / Re: Alphabetically arrange user objects on: 2010-12-08 00:23:36
I agree Riven you are right Comparator is better but I had already written the code before I read your replies.  ryanm told me to use comparable so thats what I did.  Currently i only have the need to sort them in one way.  Plus it is possible to use both comparable and comparator.  By implementing comparable my objects now have a natural ordering.  If at some point I need to sort in a different way a comparator will still work.  I don't see whats so bad about the way I have done it.

Not trying to pick a fight but i wasn't being stubborn.  Enlighten me as to why what I have done is so bad....
10  Game Development / Game Play & Game Design / Re: Alphabetically arrange user objects on: 2010-12-05 22:15:48
thanks guys i got it working implementing comparable but at some point i'll probably switch to using comparator so i can arrange the list in different ways, such as by score.
11  Game Development / Game Play & Game Design / Re: Alphabetically arrange user objects on: 2010-12-05 03:30:27
so have the objects implement comparable and then in the compareTo method for my objects call username1.compareTo(username2)?
12  Game Development / Game Play & Game Design / Alphabetically arrange user objects on: 2010-12-05 00:09:00
Ok so I have an online game and for each connection the server program creates a "user object."  I would like to be able to arrange these user objects in a list (or arraylist or vector etc...)  by alphabetical order by username.  I know sorting would be easy if these were just strings but the user objects encapsulate other data besides the username.  I know it would be possible to traverse the list in a for loop and then compare each username character by character but it seems like this is highly inefficient. 

Anyone know of an easier way? 

I looked at using Collections.sort(list); but in order for this to work there has to be a "natural ordering" of my user objects.  How do you specify the natural ordering?
13  Game Development / Networking & Multiplayer / Re: General Architechture of Server on: 2010-10-06 20:50:20
A socket timeout only works for reading from a socket.

Upon a timeout, exactly nothing will happen to the underlying connection: it will remain open and valid, it's just that the read() call will throw a SocketTimeoutException.

You set a timeout to make sure your app doesn't endlessly wait if the tcp-connection gets screwed up (unclean disconnect). You have to set the timeout on both server and client.

I understand all of this.   Seems to me like it would be best to somehow have two streams going.   One that has a socket timeout and the other that doesnt.  The one with timout is constantly sending data back and forth while the one without timeout sends game data.  In the event of a timeout both streams are killed or reconnected.  Is this how it is done or are they merged together?

edit: nevermind i guess it would be really easy to merge them.  two streams arent necessary
14  Game Development / Networking & Multiplayer / Re: General Architechture of Server on: 2010-10-06 20:42:43

Create a tcp channel, that handles both your traffic *and* ping/pong behind the scenes (interleave streams). If the ping fails or the pong timeouts, reconnect. Again, this is all behind an abstraction layer. At the game-code level, you're simply sending and receiving bytes (or highlevel game-packets), regardless of all the mess that occurs behind the scenes.


sorry to bring up an old thread but I need some advice again.  How do you set up this ping/pong?  Is socket timeout set on both the client and the server?

Currently this is what I am doing on my socket....

1  
2  
3  
socket = new Socket(ip,portNum);
            out = new PrintWriter(socket.getOutputStream(),true);
            in = new BufferedReader(new InputStreamReader(socket.getInputStream()));


for the game data i send strings over the socket and then parse the strings upon arrival.  in order to set up this ping/pong would i create another socket and have the client and server constantly sending data back and forth?

edit: what is an interleave stream?
15  Game Development / Networking & Multiplayer / Re: Game/Server communication security on: 2010-10-06 20:33:40
ok this may be a little off topic but following from number 1 of your suggestions DzzD, how would i go about keeping someone from connecting for 1 minute?
16  Game Development / Networking & Multiplayer / Re: Game/Server communication security on: 2010-10-06 08:39:15
Thats what I was thinking.  My game is physics related, similar to worms.  So i was thinking maybe just have the server "filter" what is sent from client to client.  As well as make sure that clients are in sync and all moves are legitimate(ie. character has not moved past a structure or through it).  However, i would also like to keep clients from hacking my game to always send perfect hits but I guess that can't be helped...

Is there anything that would at least make hacking the game a pain?  Some sort of deterant? 
17  Game Development / Networking & Multiplayer / Re: Game/Server communication security on: 2010-10-06 08:14:46
I was afraid thats what the answer was going to be Sad.    Doesn't this put a large burden on the server though? 
18  Game Development / Networking & Multiplayer / Game/Server communication security on: 2010-10-06 07:06:39
What stops someone from playing my game as an applet and then reverse compiling the classes and modifying the game to their advantage?

I recently put my game out on the net as an applet and I have been wondering about this.  It seems like it would be fairly easy for someone to do this.  Is there some way to program a secret passkey into my code that must be transmitted to the server on initialization?
19  Game Development / Networking & Multiplayer / Using VPS For Game Servers on: 2010-10-01 00:37:57
thanks riven! screen is awesome! just what i needed.
20  Game Development / Networking & Multiplayer / Using VPS For Game Servers on: 2010-09-30 20:12:38
@Nate my email is g.scov@hotmail.com.  I like it alot so far.  I have never run a server before or even used linux but i was able to get my server program up and running in less than a day.  Everything is done through SSH, which was something new to me.

@Eli you just buy one from them.  but it is virtual private hosting, meaning you share the box with other people but you have full root access.

on a side note, do either of you know much about linux?  the server i have is running ubuntu 10.04.  i need to run my java application and leave it running.  so far the only way i have been able to run my program is through SSH.  How do you start a java program and leave it running even when i am not connected through ssh?  i talked to some admin at slicehost and they mentioned a linux startup script or something like that?
21  Game Development / Networking & Multiplayer / Re: Server has 100% CPU usage and 5% memory usage?? [solved] on: 2010-09-30 11:02:31
nevermind.  infinite while loop was causing the problem.
22  Game Development / Networking & Multiplayer / Server has 100% CPU usage and 5% memory usage?? on: 2010-09-30 10:06:12
Ok so i just bought a slicehost server.  The minimum one with 256MB ram and 10GB disk space.  I ran a simple java server program I have, I can post the code if necessary, and it caused my slice to have 100% cpu usage and 5% memory usage.  Any idea why this is or how i can track what is causing this?

A little about the server program.  It is a multi-threaded server application.  All it basically does is multiplex data across sockets to the two clients playing a game.  Even with no clients connected it has 100% cpu usage.

Any help is greatly appreciated.
23  Java Game APIs & Engines / Engines, Libraries and Tools / Re: New to Slick2D, help getting started on: 2010-09-19 00:51:51
where would this line of code go in my app? 
24  Java Game APIs & Engines / Engines, Libraries and Tools / Re: New to Slick2D, help getting started on: 2010-09-18 22:42:23
For deployment as an executable jar or batch script the natives will be in folders (not in jars) to which you simply link to on the classpath with the -Djava.library.path="path" parameter.

for an executable jar how do you set the -Djava.library.path="path" ??
do i just put this path in the class-path: in the manifest file?

sorry I tried searching the web and can't find much on this....

thanks riven.  so for distribution i should put the 64 bit and 32 bit dlls in the windows natives file?  will the JRE automatically pick the correct ones?
25  Java Game APIs & Engines / Engines, Libraries and Tools / Re: New to Slick2D, help getting started on: 2010-09-15 03:29:14
just out of curiousity can 64 bit systems use the 32 bit natives?  I downloaded lwjgl and they have both 32 bit and 64 bit natives included.  granted this has not solved my problem but again assuming that i get this working how does that play into distribution? just include both sets of natives?

edit: upon using NetBeans it works flawlessly.  Also I used the 32 bit .dlls and it ran on my machine so I guess they do work.

However, what if the user has the 64 bit JRE.  Would they too be able to use the 32 bit .dlls?

haha sorry for being all over the board with the questions.  At least i can start coding using netbeans.  hopefully i'll leave you alone soon kapta Smiley
26  Java Game APIs & Engines / Engines, Libraries and Tools / Re: New to Slick2D, help getting started on: 2010-09-15 00:30:59
I still can't get it to work. This doesn't make any sense.  I wonder if there is a problem with me running Java 32 bit even though my machine is 64 bit.  I guess I'll try using eclipse and see if that changes anything
27  Java Game APIs & Engines / Engines, Libraries and Tools / Re: New to Slick2D, help getting started on: 2010-09-14 23:43:45
I'm using JCreator and whenever i type in java -Djava.library.path="c:\lwjgl" the command outputs the same help stuff as if i just typed java.
28  Java Game APIs & Engines / Engines, Libraries and Tools / Re: New to Slick2D, help getting started on: 2010-09-14 23:08:37
ok still having problems.  I extracted the files from natives-win32.jar and got lwjgl.dll, jinput-dx8.dll, jinput-raw.dll, and openal32.dll.  I put all of these in a folder.  From the command line I tried to set the VM argument like you said but it keeps telling me that it can't find the main class.  What am i doing wrong?  can you tell me exactly what i have to type in the command line?

i was doing:  java -Djava.library.path="folder location"
29  Java Game APIs & Engines / Engines, Libraries and Tools / Re: New to Slick2D, help getting started on: 2010-09-14 12:05:14
ok cool so i need to add slick.jar and lwjgl.jar as well as add the natives to the VM.

another question.  say I want to distribute my game, how is that handled?  do i include all three natives (ie. windows, mac, linux)?  package it all into a jar?
30  Java Game APIs & Engines / Engines, Libraries and Tools / New to Slick2D, help getting started on: 2010-09-14 06:36:52
Ok so I don't know who saw my other post but I'm trying to convert my game to Slick2D but I am having a bit of trouble getting started.  Everything compiles correctly but when I try and run just an empty application with Slick2D i get "Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path" what all do i have to do to use Slick?  I added slick.jar, lwjgl.jar, and ibxm.jar to my project.  Apparently I'm missing another step....

Also just out of curiousity what is ibxm.jar?  I just added it according to some tutorial.
Pages: [1] 2 3 ... 6
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CogWheelz (18 views)
2014-07-30 21:08:39

Riven (27 views)
2014-07-29 18:09:19

Riven (16 views)
2014-07-29 18:08:52

Dwinin (14 views)
2014-07-29 10:59:34

E.R. Fleming (35 views)
2014-07-29 03:07:13

E.R. Fleming (13 views)
2014-07-29 03:06:25

pw (44 views)
2014-07-24 01:59:36

Riven (44 views)
2014-07-23 21:16:32

Riven (30 views)
2014-07-23 21:07:15

Riven (31 views)
2014-07-23 20:56:16
List of Learning Resources
by SilverTiger
2014-07-31 18:29:50

List of Learning Resources
by SilverTiger
2014-07-31 18:26:06

List of Learning Resources
by SilverTiger
2014-07-31 13:54:12

HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54
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!