Java-Gaming.org Hi !
Featured games (88)
games approved by the League of Dukes
Games in Showcase (679)
Games in Android Showcase (194)
games submitted by our members
Games in WIP (733)
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]
1  Game Development / Networking & Multiplayer / Re: Cannot host a game without port forwarding on: 2015-12-17 02:39:49
How can I setup a relay server?
2  Game Development / Networking & Multiplayer / Re: Cannot host a game without port forwarding on: 2015-12-14 04:58:27
There is also Google Play Services.

Can kryonet be integrated with google play?

If not, I will probably use this API.
3  Game Development / Networking & Multiplayer / Cannot host a game without port forwarding on: 2015-12-14 02:23:25
Kryonet(the library I am using) requires a user to be within the same network or forward their ports to host a game server.
Is there a way so users do not need to port forward while still using kryonet or are there other libraries out there that can fufill this task?

Thank you!
4  Game Development / Networking & Multiplayer / [SOLVED] Server discovery on: 2015-12-11 03:57:19
I am writing a multiplayer android app and I am using Kryonet for networking. Does Kryonet support server discovery outside LAN? If it doesn't, how would a multiplayer game support server discovery?

Thank you!  Grin Grin
5  Game Development / Networking & Multiplayer / [SOLVED]Sending coordinates efficiently over the network on: 2015-10-09 03:35:38
Note: the library I am using is kryonet
I am sending over 4 packets for positioning over the network:
DX(delta X), DY(delta Y) and the X and Y coordinates

My approach is to create a temporary "network" variable to check if  the value of one of those variables has changed.
If it changes, it is sent over the network.

The following code is in my update method:

Update method in the player class:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
if(this.dx != this.netDX)
      {
         PacketUpdateDX packet = new PacketUpdateDX();
         packet.dx = this.dx;

         network.client.sendUDP(packet);

         this.netDX = dx;
      }
     
      if(this.dy != this.netDY)
      {

         PacketUpdateDY packet = new PacketUpdateDY();
         packet.dy = this.dy;

         network.client.sendUDP(packet);

         this.netDY = dy;
     
      }
     
      if(this.x != this.netX)
      {

         PacketUpdateX packet = new PacketUpdateX();
         packet.x = this.x;

         network.client.sendUDP(packet);

         this.netX = x;
     
      }

      if(this.y != this.netY)
      {

         PacketUpdateY packet = new PacketUpdateY();
         packet.y = this.y;

         network.client.sendUDP(packet);

         this.netY = y;
     
      }


Server reception of the packets
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
if(o instanceof PacketUpdateX){
               PacketUpdateX packet = (PacketUpdateX) o;
               players.get(c.getID()).x = packet.x;

               packet.id = c.getID();
               server.sendToAllExceptUDP(c.getID(), packet);

            }else if(o instanceof PacketUpdateY){
               PacketUpdateY packet = (PacketUpdateY) o;
               players.get(c.getID()).y = packet.y;

               packet.id = c.getID();
               server.sendToAllExceptUDP(c.getID(), packet);

            }else if(o instanceof PacketUpdateDX){
               PacketUpdateDX packet = (PacketUpdateDX) o;
               players.get(c.getID()).dx = packet.dx;

               packet.id = c.getID();
               server.sendToAllExceptUDP(c.getID(), packet);

            }else if(o instanceof PacketUpdateDY){
               PacketUpdateDY packet = (PacketUpdateDY) o;
               players.get(c.getID()).dy = packet.dy;

               packet.id = c.getID();
               server.sendToAllExceptUDP(c.getID(), packet);

            }


Client side reception of the packets
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
if(o instanceof PacketUpdateX)
      {
         PacketUpdateX packet = (PacketUpdateX) o;
         SpaceoidsClient.players.get(packet.id).x = packet.x;      
      }else if(o instanceof PacketUpdateY)
      {
         PacketUpdateY packet = (PacketUpdateY) o;
         SpaceoidsClient.players.get(packet.id).y = packet.y;      
      }else if(o instanceof PacketUpdateDX)
      {
         PacketUpdateDX packet = (PacketUpdateDX) o;
         SpaceoidsClient.players.get(packet.id).dx = packet.dx;
      }else if(o instanceof PacketUpdateDY)
      {
         PacketUpdateDY packet = (PacketUpdateDY) o;
         SpaceoidsClient.players.get(packet.id).dy = packet.dy;
      }


EDIT: I solved this problem on my own
6  Game Development / Newbie & Debugging Questions / Re: [Kryonet] Problems with sending ArrayList over network on: 2015-09-09 03:21:10
Thank you! This solved my problem  Grin Grin
7  Game Development / Newbie & Debugging Questions / Re: [Kryonet] Problems with sending ArrayList over network on: 2015-09-09 03:02:32
How would I apply the BulletSerializer class in my code?
8  Game Development / Newbie & Debugging Questions / Re: [Kryonet] Problems with sending ArrayList over network on: 2015-09-08 03:43:48
Server registration of classes:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
server = new Server();
      server.getKryo().register(ArrayList.class);
      server.getKryo().register(Bullet.class);
      server.getKryo().register(PacketAddPlayer.class);  
      server.getKryo().register(PacketAsteroids.class);
      server.getKryo().register(PacketRemovePlayer.class);
      server.getKryo().register(PacketUpdateAcceleration.class);
      server.getKryo().register(PacketUpdateBullet.class);
      server.getKryo().register(PacketUpdateDeath.class);
      server.getKryo().register(PacketUpdateFlames.class);
      server.getKryo().register(PacketUpdateHit.class);
      server.getKryo().register(PacketUpdatePosition.class);
      server.getKryo().register(PacketUpdateRotation.class);
      server.getKryo().register(PacketUpdateStats.class);
      for(int i = 0; i < server.getKryo().getNextRegistrationId(); i++)
      {
         System.out.println("Registering: " + server.getKryo().getRegistration(i).toString());
      }
      server.bind(port, port + 1);
      server.start();
      server.addListener(new SpaceoidsServer());
      System.out.println("The server is ready");


Client registration of classes:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
      this.ip = ip;
      this.port = port;
      client = new Client();
      client.getKryo().register(ArrayList.class);
      client.getKryo().register(Bullet.class);
      client.getKryo().register(PacketAddPlayer.class);  
      client.getKryo().register(PacketAsteroids.class);
      client.getKryo().register(PacketRemovePlayer.class);
      client.getKryo().register(PacketUpdateAcceleration.class);
      client.getKryo().register(PacketUpdateBullet.class);
      client.getKryo().register(PacketUpdateDeath.class);
      client.getKryo().register(PacketUpdateDeath.class);
      client.getKryo().register(PacketUpdateFlames.class);
      client.getKryo().register(PacketUpdateHit.class);
      client.getKryo().register(PacketUpdatePosition.class);
      client.getKryo().register(PacketUpdateRotation.class);
      client.getKryo().register(PacketUpdateStats.class);
      client.addListener(this);

      client.start();
      try {
         client.connect(5000, ip, port, port + 1);
      } catch (IOException e) {
         reason = e.toString();
         e.printStackTrace();
      }
   


Packet for sending the bullets:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
import java.util.ArrayList;

import com.waleed.Spaceoids.entities.Bullet;

public class PacketUpdateBullet{
   
   public int id;
   public final int MAX_BULLETS = 4;
   public ArrayList<Bullet> bullet;

}
9  Game Development / Newbie & Debugging Questions / [SOLVED]Problems with sending ArrayList over network on: 2015-09-08 03:08:22
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? Huh Huh

Sending the bullets over the network:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
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:
1  
2  
3  
4  
5  
6  
7  
8  
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
10  Games Center / WIP games, tools & toy projects / Re: GNetLib V0.0.0.3 (A Simple Java Networking Library) on: 2015-04-26 18:25:17
What happened to OP? This project could have went somewhere... Sad Sad
11  Games Center / WIP games, tools & toy projects / Re: GNetLib V0.0.0.2 (A Simple Java Networking Library) on: 2014-10-24 01:25:51
But still, how do I kick a client individually without having to kick all the clients?
12  Games Center / WIP games, tools & toy projects / Re: GNetLib V0.0.0.2 (A Simple Java Networking Library) on: 2014-10-23 00:30:14
Is there a way to kick one specific client from the server(I'm using ClientShutdownPacket by the way)?

My code:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
if(packet.getPacketName().contentEquals("UserPacket"))
            {
               users.add(packet.getEntry("username").toString());
               String test = users.get(0);
               System.out.println(packet.getEntry("IP"));
               
               boolean kick = in.nextLine().contains("kick: ");
                 if(kick)
                 {
                    String[] x = in.nextLine().split(":", -1);
                    System.out.println(x[0]);
                    System.out.println(x[1]);
                   
                     ClientShutdownPacket shutdown = new ClientShutdownPacket(client);
                     client.connected = false;
                     shutdown.addEntry("SHUTDOWN", true);
                     
                     client.sendPacket(shutdown);
                     
                 }
                     return;
            }
13  Games Center / WIP games, tools & toy projects / Re: GNetLib V0.0.0.2 (A Simple Java Networking Library) on: 2014-10-21 02:04:53
Thank you so muchhh  Grin Grin Grin Grin Grin Grin
14  Games Center / WIP games, tools & toy projects / Re: GNetLib V0.0.0.2 (A Simple Java Networking Library) on: 2014-10-20 23:02:30
When will v 0.0.0.3

Also @TehJavaDev:

Add me on skype: waleed.ahmad.ghazal
15  Games Center / WIP games, tools & toy projects / Re: GNetLib V0.0.0.2 (A Simple Java Networking Library) on: 2014-10-20 02:58:10
I am making a GUI and I want to put the logs in a JTextArea, but the only way I can is if I get the log(s) as a string and then append it.
16  Games Center / WIP games, tools & toy projects / Re: GNetLib V0.0.0.2 (A Simple Java Networking Library) on: 2014-10-20 02:35:54
Yes
17  Games Center / WIP games, tools & toy projects / Re: GNetLib V0.0.0.2 (A Simple Java Networking Library) on: 2014-10-20 02:30:13
I have been experimenting with the library, and I'm trying to get the debug log as a string, but I can't seem to do so. How can I do that?
18  Games Center / WIP games, tools & toy projects / Re: GNetLib V0.0.0.2 (A Simple Java Networking Library) on: 2014-10-20 01:43:44
Thanks for clarifying  Grin
19  Games Center / WIP games, tools & toy projects / Re: GNetLib V0.0.0.2 (A Simple Java Networking Library) on: 2014-10-20 01:19:46
What I really mean is the ability to make a client "become" the host, kind of like how online lobbies work.

A game with this feature, for example, would be Counter Strike: Global Offensive

This image can help clarify my idea:

20  Games Center / WIP games, tools & toy projects / Re: GNetLib V0.0.0.2 (A Simple Java Networking Library) on: 2014-10-20 01:03:35
Many multiplayer games have a lobby function to them. Is it possible to make a feature like that so the programmer does not have to write it but rather the library does a lot of it for us?
21  Games Center / WIP games, tools & toy projects / Re: GNetLib V0.0.0.2 (A Simple Java Networking Library) on: 2014-10-16 23:10:40
I love it! It's very user friendly  Smiley Smiley Cool
22  Games Center / WIP games, tools & toy projects / Re: Zombie Nauts [0.4.5] on: 2014-07-25 13:01:25
Really nice game! Keep up the good work
23  Discussions / Miscellaneous Topics / Re: [Girls] How to completely block them from our lives? on: 2014-07-12 02:10:22
Use the isolation technique.
24  Discussions / Miscellaneous Topics / Re: Longest program you have written? on: 2014-07-12 02:07:38
I would say the longest I've written so far is my RTS game(its not even finished yet).
It's currently:
5515+
25  Games Center / WIP games, tools & toy projects / Re: Athanas Quest on: 2014-06-01 21:03:34
My name is Waleed Ghazal, I'm 14 too. I was wondering if I can collaborate with you on this game and possibly help out with programming.
I also know of a tool that can distribute LWJGL projects.
I can also help with the development of an AI, structures and simple building too.
Skype: waleed.ahmad.ghazal
Steam: robocos123
I hope I can be of help.
Thanks
26  Game Development / Networking & Multiplayer / Re: Does anyone know how to host your multiplayer game online? on: 2013-03-15 00:58:58
How do I port forward?
27  Game Development / Networking & Multiplayer / Does anyone know how to host your multiplayer game online? on: 2013-03-15 00:55:01
I created a game with a server and client, and I do not know how to host it online(since my friend wants to join the game and we are not in the same network). If you guys know how please answer in the comments
Pages: [1]
 
DarkCart (13 views)
2016-05-29 02:30:33

Hydroque (25 views)
2016-05-26 14:45:46

Mac70 (44 views)
2016-05-24 21:16:33

theagentd (47 views)
2016-05-14 18:38:35

theagentd (80 views)
2016-05-10 22:37:41

theagentd (88 views)
2016-05-10 22:33:46

IanParcs (114 views)
2016-04-18 14:18:53

KaiHH (113 views)
2016-04-18 08:35:41

KaiHH (134 views)
2016-04-15 12:43:58

theagentd (138 views)
2016-04-14 02:16:17
FPS Camera Tutorial
by Hydroque
2016-05-22 05:40:58

Website offering 3D Models specifically for games for free
by vusman
2016-05-18 17:23:09

Website offering 3D Models specifically for games for free
by vusman
2016-05-09 08:50:56

Website offering 3D Models specifically for games for free
by vusman
2016-05-06 11:10:21

Website offering 3D Models specifically for games for free
by vusman
2016-04-29 12:56:17

List of Learning Resources
by SilverTiger
2016-02-05 09:39:47

List of Learning Resources
by SilverTiger
2016-02-05 09:38:38

List of Learning Resources
by SilverTiger
2016-02-05 09:35:50
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!