Hello javagaming community.
I am working on a multiplayer game using kryonet. I am trying to send an arraylist over the network but everytime I send the it, the server crashes and there is no exception thrown.
How can I fix this bug? ??? ???
Sending the bullets over the network:
public void update(float delta)
{
//networkBullets and bullets are arraylists
if(networkBullets != bullets)
{
//send bullets over to the server
PacketUpdateBullet packet = new PacketUpdateBullet();
packet.bullet = bullets;
network.client.sendUDP(packet);
networkBullets = bullets;
}
}
Adding to the bullets arraylist:
public void shoot() {
if(bullets.size() == MAX_BULLETS) return;
bullets.add(new Bullet(x, y, radians));
Jukebox.play("shoot");
Spaceoids.cam.project(new Vector3(x, y, 0));
}
Thank you for your support.
EDIT: Thank you chrislo27, VaTTeRGeR, basil_ for helping me solving this problem