Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (480)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (547)
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 4
1  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Kryo/Kryonet compression and buffer on: 2014-08-18 09:22:29
Why does it sound horrible?
2  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Kryo/Kryonet compression and buffer on: 2014-08-18 00:41:10
Wait what are you sending? I would just send a int for every tile and then the client does the work......
example
int tile = 1; so tile is grass
.
.
.
you understand.... or make the player request the tiles....... do not ever send that much of data it just if you do make it not playable until all data is send like 1000 ints per sending........
3  Games Center / WIP games, tools & toy projects / Re: SOLIS on: 2014-08-09 16:10:57
Are you going to relese a demo?
4  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [kryonet] Disconnecting? on: 2014-08-07 21:14:14
Some times it doesn't disconnect, i don't even know what i did.... xD
5  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [kryonet] Disconnecting? on: 2014-08-07 06:50:36
I am updating as the changes happen and am not continually sending data. And i have tryed to limit it on 0.1 and it sends every 0.1 s x and y and on every change but not working still disconecting!
here is all of the code for server and client
6  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [kryonet] Disconnecting? on: 2014-08-07 00:17:55
client sided network
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  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
package net.main;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import javax.swing.JOptionPane;

import net.packets.PlayerAddPacket;
import net.packets.PlayerRemovePacket;
import net.packets.PlayerXUpdatePacket;
import net.packets.PlayerYUpdatePacket;

import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryonet.Client;
import com.esotericsoftware.kryonet.Connection;
import com.esotericsoftware.kryonet.Listener;

public class Network extends Listener {

   private String ip;
   private int port;
   public Client c;
   private Game game;

   public Network(String ip, int port,Game game) {
      this.port = port;
      this.ip = ip;
      this.game = game;
   }

   public void start() {
      c = new Client();
      c.addListener(this);
      Kryo kryo = c.getKryo();
      kryo.register(PlayerAddPacket.class);
      kryo.register(PlayerRemovePacket.class);
      kryo.register(PlayerXUpdatePacket.class);
      kryo.register(PlayerYUpdatePacket.class);
      c.start();
      try {
         c.connect(10000, ip, port);
      } catch (IOException e) {
         e.printStackTrace();
         reconect();
      } finally {
         System.out.println("Status : " + c.isConnected());
      }
   }
   
   public void sendKeepAlive(int time){
      c.setKeepAliveTCP(time);
   }
   
   public void checkConnection(){
      if(!c.isConnected()){
         try {
            start();
         } catch (Exception e) {
            e.printStackTrace();
         }
      }
   }

   private void reconect() {
      try {
         c.reconnect();
      } catch (IOException e) {
         e.printStackTrace();
         String i = JOptionPane.showInputDialog(null, "Cannot connect to : " + ip + port + " will exit!", 1);
         System.exit(0);
      }
   }

   public void received(Connection c, Object o) {
      if (o instanceof PlayerAddPacket) {
         PlayerAddPacket p = (PlayerAddPacket) o;
         MPPlayer mmp = new MPPlayer(p.x, p.y, p.id, p.name);

         game.players.put(p.id, mmp);
      }
      if (o instanceof PlayerXUpdatePacket) {
         PlayerXUpdatePacket p = (PlayerXUpdatePacket) o;
         game.players.get(p.id).x = p.x;
      }
      if (o instanceof PlayerYUpdatePacket) {
         PlayerYUpdatePacket p = (PlayerYUpdatePacket) o;
         game.players.get(p.id).y = p.y;
      }
      if (o instanceof PlayerRemovePacket) {
         PlayerRemovePacket p = (PlayerRemovePacket) o;
         game.players.remove(p.id);
      }
      c.setKeepAliveTCP(120000);
   }
}

Server side of the code
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  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
package net.main;

import java.util.HashMap;
import java.util.Map;

import net.packets.PlayerAddPacket;
import net.packets.PlayerRemovePacket;
import net.packets.PlayerXUpdatePacket;
import net.packets.PlayerYUpdatePacket;

import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryonet.Connection;
import com.esotericsoftware.kryonet.Listener;
import com.esotericsoftware.kryonet.Server;

public class Network extends Listener {

   private int port, maxP;
   public Server server;
   public Map<Integer, Player> players = new HashMap<Integer, Player>();

   public Network(Properties p) {
      port = p.port;
      maxP = p.maxP;
   }

   public void start() {
      server = new Server();
      server.addListener(this);
      ServerGame.logger.info("Server created!");
      Kryo kryo = server.getKryo();
      kryo.register(PlayerAddPacket.class);
      kryo.register(PlayerRemovePacket.class);
      kryo.register(PlayerXUpdatePacket.class);
      kryo.register(PlayerYUpdatePacket.class);
      ServerGame.logger.info("Registered classes!");
      ServerGame.logger.info("Starting server....");
      try {
         server.bind(port);
         server.start();
         ServerGame.logger.info("Done! Server is operational!");
      } catch (Exception e) {
         ServerGame.logger.severe("Something went wrong with server!");
         e.printStackTrace();
      }
   }

   public void connected(Connection c) {
      // if (server.getConnections().length < maxP) {
     // c.setKeepAliveTCP(0);
     // ServerGame.logger.info("We receved connection ID:" + c.getID() +
     // " IP:" + c.getRemoteAddressTCP());
     // ServerGame.logger.info("Disconected, full server!");
     // } else {
     ServerGame.logger.info("We recs connection ID:" + c.getID() + " IP:" + c.getRemoteAddressTCP());
      for (Player p : players.values()) {
         PlayerAddPacket pack = new PlayerAddPacket();
         pack.x = p.x;
         pack.y = p.y;
         pack.name = p.name;
         pack.id = p.id;
         c.sendTCP(pack);
      }
      c.setKeepAliveTCP(120000);
      // }
  }

   public void setKeepAlive(int time) {
      for (Connection c : server.getConnections()) {
         c.setKeepAliveTCP(time * 100);
      }
   }

   public void disconnected(Connection c) {
      ServerGame.logger.info("We were disconected from ID:" + c.getID() + " IP:" + c.getRemoteAddressTCP());
      PlayerRemovePacket p = new PlayerRemovePacket();
      p.id = players.get(c.getID()).id;
      server.sendToAllExceptTCP(c.getID(), p);
   }

   public void received(Connection c, Object o) {
      if (o instanceof PlayerAddPacket) {
         PlayerAddPacket p = (PlayerAddPacket) o;
         Player p2 = new Player();
         p2.x = p.x;
         p2.y = p.y;
         p2.id = p.id;
         p2.name = p.name;
         p2.c = c;
         players.put(c.getID(), p2);
         server.sendToAllExceptTCP(c.getID(), p);
         ServerGame.logger.info("A player joined the game: " + p2.name);
      }
      if (o instanceof PlayerXUpdatePacket) {
         PlayerXUpdatePacket p = (PlayerXUpdatePacket) o;
         if (players.get(c.getID()) != null) {
            players.get(c.getID()).x = p.x;
            server.sendToAllExceptTCP(c.getID(), p);
         }
      }
      if (o instanceof PlayerYUpdatePacket) {
         PlayerYUpdatePacket p = (PlayerYUpdatePacket) o;
         if (players.get(c.getID()) != null) {
            players.get(c.getID()).y = p.y;
            server.sendToAllExceptTCP(c.getID(), p);
         }
      }
      if (o instanceof PlayerRemovePacket) {
         PlayerRemovePacket p = (PlayerRemovePacket) o;
         players.remove(players.get(players.get(c.getID())));
         server.sendToAllExceptTCP(c.getID(), p);
      }
      c.setKeepAliveTCP(120000);
   }
}
7  Java Game APIs & Engines / Engines, Libraries and Tools / [kryonet] Disconnecting? on: 2014-08-06 17:03:42
Well after i connect to the server and start my game everything is fine but my client disconnects after some time! Why is it doing so?
8  Discussions / Miscellaneous Topics / Re: Pixel art? Creating pixel art from image!? on: 2014-07-29 19:00:09

this is what i i did :\ dont like it!
9  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Shader libs? on: 2014-07-29 14:43:38
I meant i dont have any libs !!
10  Discussions / Miscellaneous Topics / Re: Pixel art? Creating pixel art from image!? on: 2014-07-28 09:15:36
Now animating will be painfull!
11  Discussions / Miscellaneous Topics / Re: Pixel art? Creating pixel art from image!? on: 2014-07-27 21:39:20

Me truing to be an a artist! Not good!
12  Game Development / Newbie & Debugging Questions / Re: [Game] How do i make a camera.class? on: 2014-07-27 20:53:00
You don't have to just get the players x,y and center it on screen translate with Graphics!
13  Java Game APIs & Engines / OpenGL Development / Re: LWJGL Controller Advice [Getting false axis events] on: 2014-07-27 20:51:04
Create a variable for x and y for your stick and set it. After the method is called again check if x,y is the same if not set it to to a difrent x,y
14  Java Game APIs & Engines / Engines, Libraries and Tools / Shader libs? on: 2014-07-27 13:09:52
Is there any lib that provides you with using shaders? What i meant is that I am making a game in java, pure java no libs but i want shaders in my game. So is it posible that you just add it to my game and render it?
15  Java Game APIs & Engines / OpenGL Development / Re: LWJGL Controller Advice [Getting false axis events] on: 2014-07-27 09:43:23
I think that you cant read like that, try somehow getting the angle of your stick, if not just don't use it! Hope i helped Cheesy
16  Discussions / Miscellaneous Topics / Pixel art? Creating pixel art from image!? on: 2014-07-27 09:26:16
Well i am not an a great artist and i need help. Here's the thing i have an image

and i need someone to be kind to make me player 48x48 pixel art up,down,left and right. Thanks!
17  Game Development / Newbie & Debugging Questions / Re: Levels rendered sideways? on: 2014-07-26 22:49:45
Use [ code ] your code [ /code ].
And there are no details maybe the way you load the level? If you are doing it from a image just flip it!
18  Java Game APIs & Engines / OpenGL Development / Re: LWJGL Controller Advice on: 2014-07-26 22:44:43
You should take the pressed key and print it out! You would get numbers and you could insted checking for "A" pressed you check "5" pressed.
19  Games Center / WIP games, tools & toy projects / Re: Prophour23 - a fast-paced, randomized RTS on: 2014-07-24 15:14:21
When will the demo be avalable if you plan a demo?
20  Game Development / Newbie & Debugging Questions / Re: My game gives me a white screen when I run it with tiles moving enabled on: 2014-07-22 15:50:39
Maybe it's moving to fast and you don't see it, try moving it just 10 pixels and stop!
21  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [Lego NXT] Java Libs? on: 2014-07-22 15:40:46
And i found it, Java for your robot Cheesy. Sorry for me saying no to java but i found it! Hope i helped! Cheesy
22  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [Lego NXT] Java Libs? on: 2014-07-22 15:37:32
Rasberry Pi can use java but are you aming for? And how do you think to make your robots? Just wondering.

Edit: There is a link on the bottom of the page Software Dev. Kit and Hardware  Dev. Kit check them out there are no details on the page
23  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [Lego NXT] Java Libs? on: 2014-07-22 15:32:58
There is a download link for the software in the link you posted! xD I dont think it can be programed in java, you have to use that software! It would be cool if you can program it but it has it's own OS-thing that controls it!
24  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-07-21 22:43:21
I am making my character design here is the sketch doing pixel art later :


25  Game Development / Newbie & Debugging Questions / Re: Why does my if statments stop working when I remove System.out statments on: 2014-07-21 22:26:59
try playerHealth < 1 !
26  Game Development / Newbie & Debugging Questions / Re: Why does my if statments stop working when I remove System.out statments on: 2014-07-21 20:57:54
What do you have in gameOver(); ?
27  Game Development / Newbie & Debugging Questions / Re: My bullet(missile,magic) doesn't want to go to mouse x,y!? on: 2014-07-19 14:05:38
Click to Play


Yea it works xD i Just made new x,y floats and and works sometimes i just don't understand computer/java thanks everybody:D
28  Game Development / Newbie & Debugging Questions / Re: My bullet(missile,magic) doesn't want to go to mouse x,y!? on: 2014-07-19 13:41:26
Ok weard stuff is going on xD
Click to Play
29  Game Development / Newbie & Debugging Questions / Re: My bullet(missile,magic) doesn't want to go to mouse x,y!? on: 2014-07-19 13:24:30
Then how can i make it not snapp to 15 degrees?
30  Game Development / Newbie & Debugging Questions / Re: My bullet(missile,magic) doesn't want to go to mouse x,y!? on: 2014-07-19 12:50:25
I use the code like NegativeZero said but i get the effect shown on the screen and i want it to go in a straight line, i tried with vec2 same effect,Is it possible or should I leave it as it is?
http://www.mediafire.com/download/sunoh7d6ctwalf1/game.jar
here you can see what is happening!
Pages: [1] 2 3 4
 

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

The first screenshot will be displayed as a thumbnail.

atombrot (24 views)
2014-08-19 09:29:53

Tekkerue (23 views)
2014-08-16 06:45:27

Tekkerue (23 views)
2014-08-16 06:22:17

Tekkerue (13 views)
2014-08-16 06:20:21

Tekkerue (20 views)
2014-08-16 06:12:11

Rayexar (58 views)
2014-08-11 02:49:23

BurntPizza (38 views)
2014-08-09 21:09:32

BurntPizza (30 views)
2014-08-08 02:01:56

Norakomi (37 views)
2014-08-06 19:49:38

BurntPizza (67 views)
2014-08-03 02:57:17
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

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

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

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!