Java-Gaming.org Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (549)
Games in Android Showcase (139)
games submitted by our members
Games in WIP (593)
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 ... 5
1  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [Slick2D] Why the F is it so slow? [SOLVED] on: 2015-01-12 08:39:04
Well it is better than what i did. I just did all of that in my game.
2  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [Slick2D] Why the F is it so slow? on: 2015-01-10 12:22:51
I solved it, i just get the image from the animation. YAy
3  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [Slick2D] Why the F is it so slow? on: 2015-01-10 10:02:49
Yea i am doing that, one more problem i am using only one spritesheet for everything and how do i draw animation it only has draw? And when i draw it it goes to the 0,0 no matter what!
4  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [Slick2D] Why the F is it so slow? on: 2015-01-09 21:50:52
Thx it runs very fast! <3
5  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [Slick2D] Why the F is it so slow? on: 2015-01-09 12:13:09
I dont think so......
6  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [Slick2D] Why the F is it so slow? on: 2015-01-09 12:01:29
When i use start() and end() my game brakes.... ? It does not show the player (Animation) and it only shows some of the sprites.....
7  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [Slick2D] Why the F is it so slow? on: 2015-01-09 11:41:22
Here you go the whole project https://www.mediafire.com/?9h7o6mmy97919di
8  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [Slick2D] Why the F is it so slow? on: 2015-01-09 11:10:11
Nope that is not the problem i checked that first when i saw the FPS.
9  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [Slick2D] Why the F is it so slow? on: 2015-01-09 11:03:57
I did i draw one tile and it still slows down... when i dont draw tiles the FPS goes to 60 (target FPS 60) and when i draw one it goes to 57 FPS
10  Game Development / Newbie & Debugging Questions / Re: Kryonet Connection ID Safety on: 2015-01-09 10:51:37
Well you can have the client send an packet that will have the id (login packet) and the server would have a txt file where the id will be stored and if it has that id the server will send a packet (conform login packet) and if not server would disconnect the client. Simple.
11  Java Game APIs & Engines / Engines, Libraries and Tools / [Slick2D] Why the F is it so slow? [SOLVED] on: 2015-01-09 10:35:27
I am recreating my previous project https://github.com/GNecro1/TROTMGRO, it was java2D no libs nothing, pure java. Now i am using Slick2D and it is crap. In Java2D i was creating a world 128x128 tiles(300+ FPS), now i am creating (in Slick2D) a world 32x32 tiles (9 FPS). So wtf is wrong?
How I do the rendering:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
 // Only 1 chunk, rendering
public void render(GameContainer c, StateBasedGame game, Graphics g) throws SlickException {
   for (int i = 0; i < tile.length; i++) {
      for (int j = 0; j < tile[0].length; j++) {
         tile[i][j].render(c, game, g);
      }
   }
}
// tile rendering

public void render(GameContainer c, StateBasedGame game, Graphics g) throws SlickException {
   img.draw(x, y,2);
}


And how i did it in Java2D :

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
// world
public void render(Graphics2D g) {
   for (int i = 0; i < tiles.length; i++) {
      for (int j = 0; j < tiles[0].length; j++) {
         tiles[i][j].render(g);
      }
   }
}
//tile

public void render(Graphics2D g) {
   g.drawImage(RL.grass, x, y, width, height, null);
}


So anyone care to explain?
12  Game Development / Newbie & Debugging Questions / Re: A little problem..... (Rendering) on: 2015-01-06 21:48:20
I need an a explenation i really don't understand how would i port that? xD
13  Game Development / Newbie & Debugging Questions / A little problem..... (Rendering) on: 2015-01-06 21:36:24
So I am playing around, testing stuff etc... And I saw this :

First one is like okey, but i walk down and WTF?
I am using slick2D, Code:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
private Player p;
private StrangeMan sm;

public void init(GameContainer c, StateBasedGame game) throws SlickException {
   sm = new StrangeMan(300,300);
   p = new Player(100, 100,AnimationHandler.Player);
}


public void render(GameContainer c, StateBasedGame game, Graphics g) throws SlickException {
   g.translate(-p.getX()+c.getWidth()/2-p.getWidth()/2,-p.getY()+c.getHeight()/2-p.getHeight()/2);
   p.render(c, game, g);
   sm.render(c, game, g);
}


The question : How can i make my player, when walks in front of the man, render/draw/whatever in front?
14  Game Development / Newbie & Debugging Questions / Re: 2D Game image rendering alternatives? on: 2015-01-04 17:25:56
You should use openGL..... It is way faster and very good i suggest using slick2D for start. Or libGDX it is way better... Using JFrame to do the rendering is not good for a game, it is for aplications buttons a
nd stuff xD !
15  Game Development / Newbie & Debugging Questions / Re: Copying jar files? on: 2015-01-02 14:01:52
My jar file game.jar and i want to copy it to lets say appdata but how do i do it? So how do i get my jars location and how do i copy it to appdata? And must do it in java + i don't know its location!
16  Game Development / Newbie & Debugging Questions / Copying jar files? on: 2015-01-02 13:53:52
I want to copy my jar file to another location.... How do i do that?
17  Game Development / Newbie & Debugging Questions / Dynamic lighting, ray casting soft shadow etc in slick2D. on: 2014-11-16 12:26:02
I want to make lighting in my game and get results like with box2dlights. I don't want to use libgx and box2dlights that is the last option. So are there any libs that i can use with slick2D to make lights like that? Do i use some kind of a shader? I really don't have a clue.......
18  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Slick2D not drawing Images? on: 2014-08-23 16:01:51
I just did -.-'
My image is corupted omg ! thx
19  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Slick2D not drawing Images? on: 2014-08-23 15:52:16
It is it works when the image has no transparent pixels! hhmmmmm
20  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Slick2D not drawing Images? on: 2014-08-23 15:46:29
Slick PNGDecoder Error - java.lang.UnsupportedOperationException: Unsupported format for this image
I got this error........ omg and it doesnt show in the console, when i have no transparent pixels i can see the image and get this error and when i have transparent pixels no error no image showing! NO LD FOR ME!e
21  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Slick2D not drawing Images? on: 2014-08-23 11:31:33
no i tried everything it just wont draw i thought that it is small so i put the scale like that no errors nothing!
22  Java Game APIs & Engines / Engines, Libraries and Tools / Slick2D not drawing Images? on: 2014-08-23 03:13:01
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  
package net.ld.invalid.main;

import net.ld.invalid.res.resImages;

import org.newdawn.slick.Animation;
import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;

public class Game extends BasicGameState {
   Image i;

   @Override
   public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
      i = new Image("/res/Ghost.png", Color.white);
   }

   @Override
   public void render(GameContainer gc, StateBasedGame sbg, Graphics g)throws SlickException {
      i.draw(100, 100, 300);
   }

   @Override
   public void update(GameContainer gc, StateBasedGame sbg, int Int) throws SlickException {
   }

   @Override
   public int getID() {
      return 0;
   }

}

And it is not working i dont know why?
pls help!
23  Games Center / Contests / Re: Ludum Dare 30 (Theme Voting Open) on: 2014-08-21 07:56:28
I won't be able to join!  Emo They are making me go to a lake, A LAKE!!!!!Why  Clueless ? I am depressed!  Cry
24  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?
25  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........
26  Games Center / WIP games, tools & toy projects / Re: SOLIS on: 2014-08-09 16:10:57
Are you going to relese a demo?
27  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
28  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
29  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);
   }
}
30  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?
Pages: [1] 2 3 ... 5
 

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

The first screenshot will be displayed as a thumbnail.

Archive (25 views)
2015-01-29 04:26:08

theagentd (22 views)
2015-01-28 15:33:52

GamerIDGoesHere (32 views)
2015-01-27 01:23:23

GamerIDGoesHere (33 views)
2015-01-27 01:22:15

CopyableCougar4 (39 views)
2015-01-27 00:34:41

CopyableCougar4 (28 views)
2015-01-26 04:47:56

Olo (19 views)
2015-01-25 21:26:00

Olo (24 views)
2015-01-25 18:44:22

Robo11 (42 views)
2015-01-25 06:14:26

basil_ (34 views)
2015-01-17 22:29:32
2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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
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!