A buddy and I have been programming a code game over the last 2 weeks, it is intended to be a multiplayer game with the ability to have 2 players play against each other.
I am running into an issue when I try and implement the server-client relationship. My client crashes when it tries to receive information from the server.
The main issue is in the GameplayState.java file. the getTile() method makes the client crash, so I am assuming the issue lies with how I'm handling the information being sent from the server.
Is there a way to fix this and prevent the crashing? would there be a better way to achieve what I am trying to do?
We are using the lwjgl, Slick2d libs
Specifically its the call: serverIn.readLine(); that makes crap go crazy.
Finally receive an error
Wed Jun 13 21:03:58 ADT 2012 ERROR:For input string: ",B6,W5,B2,W7,B,B,W,W" java.lang.NumberFormatException: For input string: ",B6,W5,B2,W7,B,B,W,W" at java.lang.NumberFormatException.forInputString(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at GameplayState.getTile(GameplayState.java:168) at GameplayState.update(GameplayState.java:124) at org.newdawn.slick.state.StateBasedGame.update(StateBasedGame.java:268) at org.newdawn.slick.GameContainer.updateAndRender(GameContainer.java:657) at org.newdawn.slick.AppGameContainer.gameLoop(AppGameContainer.java:408) at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:318) at CodaClient.main(CodaClient.java:34) Wed Jun 13 21:03:58 ADT 2012 ERROR:Game.update() failure - check the game code. org.newdawn.slick.SlickException: Game.update() failure - check the game code. at org.newdawn.slick.GameContainer.updateAndRender(GameContainer.java:663) at org.newdawn.slick.AppGameContainer.gameLoop(AppGameContainer.java:408) at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:318) at CodaClient.main(CodaClient.java:34)
Relevant server source code below:
Because I'm getting flak for putting all the code in, for ease, I will bold the statements that say what files the issue arises in
Client Code
Server Code


try catchblock around your networking code and see what pops out. Or use the debugger and step through some simple cases. – Byte56 Jun 13 '12 at 23:28tileListortileclasses? Does this crash immediately on startup or after some action? You say it's when the client tries to read from the server, so you must at least be able to narrow it down to one or two classes? Perhaps two functions? What's the error message being produced? – Byte56 Jun 13 '12 at 23:38