• Content count

  • Joined

  • Last visited

Community Reputation

213 Neutral

About miicchhii

  • Rank
  1. Pack images into .jar file?

    Thanks! I guess i will do that, since jPong isn't a game one would play on a LAN-Party. I thought about creating a game-lobby, where one can download the games and directly connect to other players, but that will take a while.
  2. Some Feedback on my Multiplayer Pong Game please!

    [quote name='black_darkness' timestamp='1356001783' post='5012759'] I recommend making the paddle easier to see. It was kind of hard to see on my 1080p monitor. [/quote] I already replaced the line with a bar, its in the new release with the bugfix.
  3. Some Feedback on my Multiplayer Pong Game please!

    Thank you guys so much! [quote name='ultramailman' timestamp='1355978938' post='5012708'] feedback: Nice game, although I think it wouldn't hurt if the ball was a little bit faster. Or make the speed adjustable. It would also be good if you can fix the need to resize the launcher just to reveal the buttons. [/quote] I just moved the "setSize();" after the swing stuff, its now working 100% for me. [CODE] launcherPanel.add(startButtonServer); this.add(launcherPanel); this.setSize(200,151); /** * Connect as Client [/CODE] [quote name='black_darkness' timestamp='1355980420' post='5012709'] I think it will be fun if you make the ball increase in speed depending on the angle. ( I think that is how the original pong worked. [/quote] The speed is currently increasing on every contact with a paddle, but i want to manipulate the direction of the ball depending on the position on the paddel where it collides. [quote name='black_darkness' timestamp='1355980420' post='5012709'] How many more hours are you going to put into this? [/quote] I think i am going to put 20 hours or more into it, to make it a real nice game (better graphics, higher performance, better networking, and of course fixing every little bug) To extend it, i am thinking of adding a list of recent servers for quick-connect, Bonus Items (in- or decrease paddle Size, gravitation,...)
  4. Some Feedback on my Multiplayer Pong Game please!

    Ok, thanks for the feedback i am sorry for that, it worked most of the time for me... Here is the Code for the launcher: [CODE] package jPong_multi; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import java.io.InputStream; import javax.imageio.ImageIO; import javax.swing.*; /** * * @author Michael Langeder * */ public class Launcher extends JFrame implements ActionListener{ /** * */ private static final long serialVersionUID = 1L; /** * Launcher für JPong */ public static void main(String[] args) { // TODO Auto-generated method stub new Launcher(); try { //load Ball String Pathl1 = "img/ball2.png"; InputStream streaml1 = JPong.class.getResourceAsStream(Pathl1); JPong.img_ball = ImageIO.read(streaml1); JPong.ballR=JPong.img_ball.getWidth(); //load Cursor1 String Pathl2 = "img/cursor.png"; InputStream streaml2 = JPong.class.getResourceAsStream(Pathl2); JPong.img_cursor = ImageIO.read(streaml2); //load Cursor2 String Pathl3 = "img/cursor2.png"; InputStream streaml3 = JPong.class.getResourceAsStream(Pathl3); JPong.img_cursor2 = ImageIO.read(streaml3); } catch (IOException e) { System.out.println("At least 1 Picture could not be opened!"); JPong.run=false; } catch (IllegalArgumentException e){ System.out.println("A Picture has not been loaded!"); JPong.run=false; } catch (NullPointerException e){ System.out.println("Could not get size of ball!"); JPong.run=false; } } public Launcher(){ //initialize window properties this.setTitle("jPong Launcher"); this.setSize(200,150); this.setVisible(true); //create elements JPanel launcherPanel = new JPanel(); JLabel launcherLabel = new JLabel(); JButton startButtonClient = new JButton("Connect to Host"); JButton startButtonServer = new JButton("Host Game"); final JTextField adressLine = new JTextField("Type Server IP"); adressLine.setPreferredSize(new Dimension(100,20)); //attach elements launcherPanel.add(launcherLabel); launcherPanel.add(adressLine); launcherPanel.add(startButtonClient); launcherPanel.add(startButtonServer); this.add(launcherPanel); /** * Connect as Client */ startButtonClient.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { String adresse = adressLine.getText(); new JPong(adresse); setVisible(false); } }); /** * Connect as Client */ adressLine.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { String adresse = adressLine.getText(); new JPong(adresse); setVisible(false); } }); /** * start Server and connect as Client */ startButtonServer.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { new Server(); new JPong("localhost"); setVisible(false); } }); } @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub } } [/CODE] I hope someone can tell me where the problem is Thanks already!
  5. Some Feedback on my Multiplayer Pong Game please!

    This is a bug, that i am already aware of. It helps to restart the launcher a few times or use a different JRE version
  6. Hey folks, I am working on a little game called jPong, and i would really like to get some feedback from you! Here's the Link: http://www.langeder.org/wordpress/games/jpong/ It is not finished yet, but already playable in multiplayer. Please note that there is a bug when starting the launcher, which will just open a blank window. This can be fixed by restarting the launcher a few times. So far it took me around 20 hours to make it. Thanks!
  7. Pack images into .jar file?

    Thank you so much! It works, but i had to make a folder inside the Class, not inside src Here is a dl, i would appreciate some feedback! [url="http://www.langeder.org/wordpress/jpong-version-1-1-released-multiplayer-launcher/"]http://www.langeder.org/wordpress/jpong-version-1-1-released-multiplayer-launcher/[/url]
  8. Pack images into .jar file?

    Thanks for the answer! I hope this will solve my problem!
  9. Pack images into .jar file?

    Hello everyone! I just started learning Java and i use eclipse. At the moment i work on a Pong game and i want to include some pictures i.e. a ball instead of a circle, to make it look better. This is the Code i use to load the image: [CODE] try { img_ball = ImageIO.read(new File("/home/michael/Desktop/workspace-java/JPong/src/ball2.png")); } catch (IOException e) { System.out.println("ball2.png not found!"); } [/CODE] As you can see i use absolute paths, because relative would not work at all. But using absolute paths is not what i want since i'm not the only to playing it. Where do i have to place those files to be accessible relatively? I would also like to put it INTO the jar file, so the release is just one file to run without the folders with files Thanks in advance!
  10. Networking to Slow - Java Multiplayer Pong

    Ok, I will try to implement that. Kaptein, Thank you for your advices and all the informations! PsychoticRabbit: But it will only affect the CPU time, not network itself that much i guess?
  11. Networking to Slow - Java Multiplayer Pong

    [quote name='Kaptein' timestamp='1355399101' post='5010161'] ideally, your code should handle 250-500ms lag, and thus you'll need to interpolate between the data sent to you from another player this is a game where lag will affect gameplay, and we don't care about cheating, so, i would just do very simple interpolation in between updates and not worry so much about the actual amount of latency or updates.. the biggest problem you will face is "invariance," here being desynchs, but since you have a centralized server that makes all the decisions this problem is already solved =) i would implement fast interpolation pad_y = (0.9 * pad_y + 0.1 * pad_last_y); pad_last_y = pad_y; [/quote] So i should let the Clients kinda estimate where the ball will be on the next update? Or insert an interpolated point between two of the updates?
  12. Networking to Slow - Java Multiplayer Pong

    [quote name='alexc95' timestamp='1355392369' post='5010125'] - Better network/packet structure [/quote] You mean not to send single lines with auto-flush?
  13. Networking to Slow - Java Multiplayer Pong

    [quote name='BitMaster' timestamp='1355390153' post='5010112'] Have you tried setTcpNoDelay? [/quote] Thank you so much! I added it and its much better now Is there anything else i can do?
  14. Hey all! I created a Pong Game in Java and added Networking, but it seems to slow the whole game down signifficantly. I use a thread for the networking routine, on both server and the two clients. The conversion is as follows: send a marker (so the receiver knows which value will be sent next) send the value send the next marker, etc... This is the Code for the Server: [CODE] /** * * Klasse (Thread) welche die Netzwerkfunktionen abhandelt * */ class Network implements Runnable { Network() { } public void run() { // mit Host verbinden und Kommunizieren try { ServerSocket server = new ServerSocket(8888); System.out.println("Warte auf Verbindung auf Port 8888"); Socket Client1 = server.accept(); System.out.println("Server: Client1 verbunden"); Socket Client2 = server.accept(); System.out.println("Server: Client2 verbunden"); //Client1 einrichten OutputStream out1 = Client1.getOutputStream(); PrintStream ps1 = new PrintStream(out1, true); // Second param: auto-flush on write = true InputStream in1 = Client1.getInputStream(); BufferedReader br1 = new BufferedReader(new InputStreamReader(in1)); //Client2 einrichten OutputStream out2 = Client2.getOutputStream(); PrintStream ps2 = new PrintStream(out2, true); // Second param: auto-flush on write = true InputStream in2 = Client2.getInputStream(); BufferedReader br2 = new BufferedReader(new InputStreamReader(in2)); String line=""; ps1.println("run"); ps2.println("run"); while(true){ //Einlesen Client1 for(int i=0;i<1;i++){ line = br1.readLine(); if(line!=null){ if(line.contains("v1")){ line = br1.readLine(); player1Y=Integer.parseInt(line); } } }//end Einlesen for-Schleife //Einlesen Client2 for(int i=0;i<1;i++){ line = br2.readLine(); if(line!=null){ if(line.contains("v1")){ line = br2.readLine(); player2Y=Integer.parseInt(line); } } }//end Einlesen for-Schleife //Ausgabe an Client1 ps1.println("v2"); ps1.println(""+player2Y); ps1.println("v4"); ps1.println(""+ballY); ps1.println("v3"); ps1.println(""+ballX); ps1.println("v5"); ps1.println(""+player1Score); ps1.println("v6"); ps1.println(""+player2Score); //Ausgabe an Client2 ps2.println("v2"); //gespiegelt für Player 2 ps2.println(""+player1Y); ps2.println("v4"); ps2.println(""+ballY); ps2.println("v3"); ball2X=MAXX-ballX; //gespiegelt für Player2 ps2.println(""+ball2X); ps2.println("v5"); //gespiegelt für Player2 ps2.println(""+player2Score); ps2.println("v6"); //gespiegelt für Player2 ps2.println(""+player1Score); } } catch (IOException e) { // TODO Auto-generated catch block //e.printStackTrace(); System.out.println("Verbindungsfehler aufgetreten"); } } } [/CODE] And the Client: [CODE] /** * * Klasse (Thread) welche die Netzwerkfunktionen abhandelt * */ class Network implements Runnable { String hostAdress; Network(String adress) { this.hostAdress = adress; } public void run() { try { Socket connectionToTheServer = new Socket(hostAdress, 8888); System.out.println("Client: Verbindung zu Server hergestellt"); InputStream in = connectionToTheServer.getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(in)); OutputStream out = connectionToTheServer.getOutputStream(); PrintStream ps = new PrintStream(out, true); String line=""; while(!(line.equals("run"))){line=br.readLine();}//warten auf Start des Spiels while(true){ //Ausgeben ps.println("v1"); ps.println(""+player1Y); //Einlesen for(int i=0;i<5;i++){ line = br.readLine(); if(line!=null){ if(line.contains("v2")){ line = br.readLine(); player2Y=Integer.parseInt(line); }else if(line.equals("v3")){ line = br.readLine(); ballX=Double.parseDouble(line); }else if(line.equals("v4")){ line = br.readLine(); ballY=Double.parseDouble(line); }else if(line.contains("v5")){ line = br.readLine(); player1Score=Integer.parseInt(line); }else if(line.contains("v6")){ line = br.readLine(); player2Score=Integer.parseInt(line); } } }//end Einlesen for-Schleife } } catch (UnknownHostException e) { // TODO Auto-generated catch block //e.printStackTrace(); System.out.println("Verbindungsfehler aufgetreten"); } catch (IOException e) { // TODO Auto-generated catch block //e.printStackTrace(); System.out.println("Verbindungsfehler aufgetreten"); } } [/CODE] Logically everything works fine, but its very slow. I would appreciate some recommendations on how to improve the speed! Thanks in advance!
  15. Beginner Python Game Issue

    [quote name='BMO' timestamp='1355371317' post='5010062'] Geany is a pretty decent IDE for Python imho, but to get it to execute your scripts you'll have to set the path (assuming your using Windows) and might want to set the indentation to just use spaces. But that's pretty easy to setup. [/quote] Geany is really nice for Python