Ok, every ship has synchronized boolean isUptodate now which will be set to true in the network thread and evaluated in the next frame of the Slick thread. I hope the synchronized-modifer is enough to prevent exceptions because of concurrent using.

Ah, thanks. The ship generation method is called by the network thread - after the server notifies the client about ship changes.How could the network thread tell the Slick thread to call getSprite() ?

Hey,I'm trying to create an image of a space ship that consist of different parts,but I'm getting a NullPointerException at the Image(int, int) constructor.

Quote

Exception in thread "Client" java.lang.NullPointerException at org.lwjgl.opengl.GL11.glGenTextures(GL11.java:1372) at org.newdawn.slick.opengl.InternalTextureLoader.createTextureID(InternalTextureLoader.java:106) at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:359) at org.newdawn.slick.opengl.InternalTextureLoader.createTexture(InternalTextureLoader.java:343) at org.newdawn.slick.opengl.InternalTextureLoader.createTexture(InternalTextureLoader.java:329) at org.newdawn.slick.Image.<init>(Image.java:238) at net.aichix3.devrays.Ship.getSprite(Ship.java:32) at net.aichix3.devrays.Shipslot.<init>(Shipslot.java:29) at net.aichix3.devrays.Network$1.received(Network.java:74) at com.esotericsoftware.kryonet.Connection.notifyReceived(Connection.java:270) at com.esotericsoftware.kryonet.Client.update(Client.java:296) at com.esotericsoftware.kryonet.Client.run(Client.java:332) at java.lang.Thread.run(Unknown Source)

I prefer to not create a txt with an image index. This does not seem to be very productive and slows down the developement. I finally created a data initialization that automatically checks if it is a jar or not during the runtime and chooses the correct way to load files, works perfect for me:

Hey,I am thinking much about modeling an efficient game the last time. I'm using Java since six months and making games since about 5 years, but this is the first time I want to realize a whole game in Java. I planned a Space-Shooter MMORPG with Java7, Slick2D and Kryonet.

The only problem that I have right know is that I dont know how to switch between main menu, login screen, option panel, pause screen and The Game. This is some of my current code:

This works fine, but what should I do to only run an instance of a MainMenu class at first?I could create an int gamestate and do a switch(gamestate) at render() and update(),but I would come up with an undynamic clump of bad written code.

You should name your class to something else than Connection, because at the moment the received method doesn't override anything because Listener class doesn't obviously have corresponding method for receiving your Connection objects This is why suppressing warnings is bad if you don't know what they mean.

Damn, thank you, that was right,the name Connection is already used by a parameter class. Everything works fine now, thank you guys!

Try to add some System.out.println()s in the received method, BEFORE the instanceof. That will help you detect if you're actually receiving anything at all.

Eclipse said that I should remove method reiceive() because "The method received(Connection c, Object o) from type new Listener(){} is never used locally". Looks like the GC takes something away from me. I updated the code in my first post.

Hey,I have started using the Kryonet lib and I have some trouble with the network communication.I followed the kryonet instruction, but either the server does not send a package or the client does not receive anything.

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