Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
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 / Newbie & Debugging Questions / Re: Top Down Shooter Multiplayer and Box2D questions on: 2013-12-19 03:32:44
I'll help you, since you are a nice guy.
It could mean Tower Defence Software... or Tower Defence Super! Even Tower Defence Sexy!
2  Game Development / Newbie & Debugging Questions / Re: Top Down Shooter Multiplayer and Box2D questions on: 2013-12-19 02:52:39
TDS = Top Down Shooter.
Isn't meant to be simple, I wont be coding this alone.

As for server side only collisions, 65k is right. An alternative would be doing client box2d as a low priority 'visual' physics while the client waits for the server snapshot. When the snapshot comes, the client then compares the simulations and if necessary, interpolates to server positions.
3  Game Development / Newbie & Debugging Questions / Re: Top Down Shooter Multiplayer and Box2D questions on: 2013-12-18 21:17:29
I could do that, totally... the AABB version... but I think I'm able to get it working with Box2D.
Simulate all physics server side, and on the clients only interpolate.
Using the same principle I'm using now, clients send input and process input locally. Client receive snapshot,
interpolate all entities to their 'server positions' (if they are far from the position).
I just don't get what would be the problem here... everything is simulated on the server. Client only renders and interpolates.

I mean, writing a GRID or QuadTree for broad... that is quite easy.
Collisions would be entirely serverside, handeling and all. The only thing the client do is send input.
I shouldn't even need a collision message. The server handle states of the entities, even simulates their animations.
4  Game Development / Newbie & Debugging Questions / Top Down Shooter Multiplayer and Box2D questions on: 2013-12-18 18:59:43
Hey guys! Its me again, the cockdefenders guy!

I'm so thankful for the help I got here the last time, when I managed to make a multiplayer 'game-prototype' that mimics valve networking protocol...
This time I've got some other questions. Its about a TDS that I'm planning, and I want to make it right. The game will be multiplayer with customizable ships
and Box2D if possible.

hmmm... lets get to the questions then!
  • 1- In my previous networking 'prototype' I synchronized about three events per entity, creation, update, deletion. That was done manually with a individual message for each.
    I thought though that I could automate that probably with an interface and a manager, so that I don't have to code sync code for each new entity. This way I can code only if the
    entity has other atributes that need sync. The question is, has anyone done that before? Any tips or cool desings for those?
    Just to help out understanding, my last design was:
    Client send input changes to server.
    Server simulates everything.
    Each 33ms server sends a snapshot to all clients containing world entities, a timestamp, and removed entities.
  • 2- As I said, I want to use Box2D for nice physics. I've got some questions about that. The first question is how I'm I going to code bullets? Does Box2D support bullets?
  • 3- And ho about laser beams? Do I use Box2D to check intersection between line and poligon? Does Box2D have methods for that (handling rotated poligons)?
5  Game Development / Networking & Multiplayer / Re: Server game loop and syncronization questions on: 2013-11-15 22:36:53
I'm back here just to say thanks again. Seeing this working is a total dream of mine.
Multiplayer means much to me..
I've added the rest of the game to the server now and it is just amazing seeing that I've coded
that and it is not crashing nor flickering nor nothing actually. Is just amazing.
I'll study now how to generalize this architecture a bit and try to provide either a tutorial or
library (on top of kryonet) to make that super easy for people starting into games. Just like the libs I'm using
made that easy for me.
Something like 'extends LiveEntity' with a few '@ID and @Sync' annotations, a 'client.processLastSnapshot()'....
<a href="http://www.youtube.com/v/pA_sJwbLeoA?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/pA_sJwbLeoA?version=3&amp;hl=en_US&amp;start=</a>
6  Game Development / Newbie & Debugging Questions / Re: Open License on: 2013-11-14 02:29:52
OMG Nate replied! *.* You are a hero!

Does new BSD force the 'users' to stay opensource?
7  Game Development / Newbie & Debugging Questions / Re: Open License on: 2013-11-13 20:58:34
If I create a license like "MY CODE IS PROVIDED AS IS, GET IT AND RUB ALL OVER YOU! JUST SAY MY NAME SOMEWHERE." (just an example), I could use it? Who makes this licenses a legal thing? Is there a entity that controls this kind of stuff?
8  Game Development / Newbie & Debugging Questions / Open License on: 2013-11-13 20:49:43
What is the best 'do what ever you want to with my code, just remember me' license?  Grin
BSD, GPL, Copyleft?
9  Game Development / Networking & Multiplayer / Re: Server game loop and syncronization questions on: 2013-11-13 04:56:45
Yeah, that or he just want to stick with paint tool sai forever, and will never touch photoshop =P

Well, thanks for the help. I'll code a framework for this kind of sync and if everything goes ok, I'll post and teach about it XD
10  Game Development / Networking & Multiplayer / Re: Server game loop and syncronization questions on: 2013-11-13 04:06:29
My 'artist' friend doesn't know the meaning of .png
11  Game Development / Networking & Multiplayer / Re: Server game loop and syncronization questions on: 2013-11-13 00:06:07
ORGASM.
<a href="http://www.youtube.com/v/oZai73uc4g8?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/oZai73uc4g8?version=3&amp;hl=en_US&amp;start=</a>

Success! Now I can proceed to implement a framework XD.
12  Game Development / Networking & Multiplayer / Re: Server game loop and syncronization questions on: 2013-11-12 19:58:00
I see now!  Grin
So in your game the client pull server updates... I think I'm going for the server pushing snapshots.
I also understood that the messages of input should be "fireShip" instead of "mouseButton1".
nice.

I'll try to sync a throw-away prototype that I have...
13  Game Development / Networking & Multiplayer / Re: Server game loop and syncronization questions on: 2013-11-12 17:34:39
Something like this?

14  Game Development / Networking & Multiplayer / Re: Server game loop and syncronization questions on: 2013-11-12 17:21:38
Many thanks!!

Let me see if I got it:
The server will have its own thread, that run endlesly.
The server will then have its own FPS.
The player should send messages like "mouseButton1Down" "mouseButton1Up" and only when the state changes.
All messaging will be TCP.

If that is good then I'm a happy dev and you deserve TONs of good coffe, with cookies.

The server snapshots have a timestamp?
The thing that stills bother me is that the server have its own fps...
imagine that the client is running at a framerate of 60, and the ship travels 100 pixels,
then the server sends an update, but there the fps is 200 and the ship travelled 350.2 pixels...
(I compute the position using RK4 integrations but still... this sync thing is hard to grasp)
15  Game Development / Networking & Multiplayer / Server game loop and syncronization questions on: 2013-11-12 15:54:29
Hello! I'm studying how to make multiplayer games and I came across something I don't understand how to do correctly: The game loop on the server side.
I'm thinking about a space top down shooter now, just to limit the scope. In my case, it is a kryonet application with LIBGDX. What I have planned for the multiplayer follows:
Client sends spawn message TCP.
Server handles the message, spawning the client ship.
Server responds the message with a snapshot TCP.

--> if there are more than two players
Server sends a start game message TCP (for UI) and starts the game (spawning of aliens).
During game:
Client streams player input through UDP.
Server process the input simulating all players.
Server sends snapshots TCP/UDP? to players each server tick.

--> if game over condition is met
Server sends end game message TCP.

I have several questions though....
Q1 - How will the server run by it self? I though of making a separate thread that calls the methods for sending stuff to the client (the snapshots).
Q2 - How much time a server tick should have? Wouldn't this depend on the clients game loop delay?
Q3 - I currently sync the spawning of bullets to the ship firing animation... is that going to be a problem since the rendering is client side?
Q4 - Valve's article says in source that object positions are processed both locally and server side, with interpolation to always use the server over the client. Can that be
applied to shooting?
Q5 - Should the player send a input message each game loop tick? Or should I sample the input with time intervals?
Q6 - Should the server snapshots be sent over UDP or TCP?
Q7 - What calls the server update loop? Won't the server simulation run without sync with the client?

Thanks so much for taking your time to read all this!
If there is any good article about this, or a example game, even books, send me the names! =)
16  Game Development / Shared Code / Re: Java Quadtree Implementation on: 2013-05-06 23:33:05
Grids are very good for handeling objects the same size. But when size varies quadtrees can do a bit better.
17  Game Development / Shared Code / Re: Java Quadtree Implementation on: 2013-05-06 22:21:50
People people, I'm here to solve all the problems with my google-fu:
http://gamedev.tutsplus.com/tutorials/implementation/quick-tip-use-quadtrees-to-detect-likely-collisions-in-2d-space/

S2 all of you =)
18  Game Development / Game Play & Game Design / Re: Destructible/deformable terrain help on: 2013-05-06 12:29:59
Is that polygon based? Maybe he is generating and averaging points around his mouse, and making the poly from them....
anyway, seems good for collision detection =)
19  Game Development / Game Play & Game Design / Re: Destructible/deformable terrain help on: 2013-05-06 10:45:52
Hey guys! I'm fairly new here but I code java for a long while now and I know a tip about this... If you learn how to render good quadtrees (the datastructure) you can generate points where you explode stuff. Worms use quadtrees to make those awesome smooth maps and the results are better than using pixel-perfect. Also pixel perfect consume a lot of time to process compared to quadtree operations.

This video ilustrates quad tree usage for 2d terrain with awesome results:
<a href="http://www.youtube.com/v/NdHhwXzRfR4?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/NdHhwXzRfR4?version=3&amp;hl=en_US&amp;start=</a>

And here an awesome blog post on terrain rendering:
http://chrisbunner.wordpress.com/2011/01/23/terrain-rendering/

Also,
http://chrisbunner.wordpress.com/2011/01/23/deformable-terrain/

I wish I could help you with a tutorial but for that I would have to code the renderer my self and I'm too lazy now. Also I would probably make something ineficient and some godlike coder here would hit me with a bazooka. But if you need help with quad tree's PM me.
20  Game Development / Newbie & Debugging Questions / Re: Overriding a method question. on: 2010-04-19 19:18:13
MAN! I LUV YOU! Thank you so much!
21  Game Development / Newbie & Debugging Questions / Re: Overriding a method question. on: 2010-04-19 00:04:17
Well, thats all my code so far... I'm running(calling) the Game class where I extend the base class.
22  Game Development / Newbie & Debugging Questions / Overriding a method question. on: 2010-04-18 21:48:20
Hello, and thanks for reading this.
I'm pretty new to Java development and i caught myself here in this AWESOME  Grin site were things seems to work better than trying every thing all alone.
I am trying to use a game base engine that i found here in the tutorial section but for some reason i can't override any class. I create the base class and a Game main class to place the game code separately, than i extended the Game class to the base class this way i could override the update method and the render method. For some weird reason none of those are accepting my overrides Cry .

The code:

---------------------The (modified) Base 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  
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  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.DisplayMode;
import java.awt.Graphics2D;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.image.BufferStrategy;

import javax.swing.JFrame;
import javax.swing.JPanel;


public class Base implements Runnable{
   
   int WIDTH = 1024;
   int HEIGHT = 768;
   
   JFrame frame;
   Canvas canvas;
   BufferStrategy bufferStrategy;
   
   private GraphicsDevice  gd;
   private DisplayMode defaultDM;
   
   public static final DisplayMode DefaultDisplaySet[]={
      //640x480
     new DisplayMode(640,480,32,0),
      new DisplayMode(640,480,16,0),
      //800x600
     new DisplayMode(800,600,32,0),
      new DisplayMode(800,600,16,0),
      //1024x768
     new DisplayMode(1024,768,32,0),
      new DisplayMode(1024,768,16,0),
      //1440x900
     new DisplayMode(1440,900,32,0),
      new DisplayMode(1440,900,16,0)
   };
   
   public Base(){
      GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
      gd = env.getDefaultScreenDevice();
      defaultDM = gd.getDisplayMode();
     
      frame = new JFrame("Basic Game");
      frame.setUndecorated(true);
        gd.setFullScreenWindow(frame);
        if (gd.isDisplayChangeSupported())
        {
            gd.setDisplayMode(checkCompatibleMode(DefaultDisplaySet[7]));
            this.WIDTH = gd.getDisplayMode().getWidth();
            this.HEIGHT = gd.getDisplayMode().getHeight();
        }
         
      JPanel panel = (JPanel) frame.getContentPane();
      panel.setPreferredSize(new Dimension(WIDTH, HEIGHT));
      panel.setLayout(null);
     
      canvas = new Canvas();
      canvas.setBounds(0, 0, WIDTH, HEIGHT);
      canvas.setIgnoreRepaint(true);
     
      panel.add(canvas);
     
      canvas.addMouseListener(new MouseControl());
     
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.pack();
      frame.setResizable(false);
      frame.setVisible(true);
     
      initialize();
     
      canvas.createBufferStrategy(2);
      bufferStrategy = canvas.getBufferStrategy();
     
      canvas.requestFocus();
   }
   
   //diplay mode handlers
  public DisplayMode[] getCompatibleDisplayModes(){
      return gd.getDisplayModes();
   }
   
   public DisplayMode checkCompatibleMode(DisplayMode mode){
      DisplayMode goodModes[] = getCompatibleDisplayModes();
         for(int j=0;j<goodModes.length;j++){
            if (DisplayModesMatch(mode,goodModes[j])){
               return mode;
            }
      }
      return null;
   }
   
   //compara displaymodes
  public boolean DisplayModesMatch(DisplayMode d1, DisplayMode d2){
      if(d1.getWidth() != d2.getWidth() || d1.getHeight() != d2.getHeight()){
         return false;
      }
      if(d1.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && d2.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && d1.getBitDepth() != d2.getBitDepth()){
         return false;
      }
      if(d1.getRefreshRate() != DisplayMode.REFRESH_RATE_UNKNOWN && d2.getRefreshRate() != DisplayMode.REFRESH_RATE_UNKNOWN && d1.getRefreshRate() != d2.getRefreshRate()){
         return false;
      }
     
      return true;
   }
   
   
   //initialize - override
 
   protected void initialize(){}
   
   //the keyInput for shutting down
 
   private class KeyInputHandler extends KeyAdapter
   {
                   public void keyPressed(KeyEvent e)
                   {
                           if(e.getKeyCode()==27)
                   {
                                   gd.setDisplayMode(defaultDM);
                                   gd.setFullScreenWindow(null);
                           System.exit(0);
                   }
                   }
                 
                   public void keyReleased(KeyEvent e)
                   {
                         
                   }
   }
   
   //the mouse listeners
 
   private class MouseControl extends MouseAdapter{
     
   }
   
   long desiredFPS = 100;
    long desiredDeltaLoop = (1000*1000*1000)/desiredFPS;
   
   boolean running = true;
   
   //the separate thread func
 
   public void run(){
     
      long beginLoopTime;
      long endLoopTime;
      long currentUpdateTime = System.nanoTime();
      long lastUpdateTime;
      long deltaLoop;
     
      while(running){
         beginLoopTime = System.nanoTime();
         
         render();
         
         lastUpdateTime = currentUpdateTime;
         currentUpdateTime = System.nanoTime();
         update((int) ((currentUpdateTime - lastUpdateTime)/(1000*1000)));
         
         endLoopTime = System.nanoTime();
         deltaLoop = endLoopTime - beginLoopTime;
           
           if(deltaLoop > desiredDeltaLoop){
               //Do nothing. We are already late.
          }else{
               try{
                   Thread.sleep((desiredDeltaLoop - deltaLoop)/(1000*1000));
               }catch(InterruptedException e){
                   //Do nothing
              }
           }
      }
   }
   
   //rendering
 
   private void render() {
      Graphics2D g = (Graphics2D) bufferStrategy.getDrawGraphics();
      g.clearRect(0, 0, WIDTH, HEIGHT);
      render(g);
      g.dispose();
      bufferStrategy.show();
   }

   int counter = 0;
   
   //updating - overriding
 
   public void update(int deltaTime){
   }
   
   //rendering - overriding
 
   public void render(Graphics2D g){
      g.setColor(Color.black);
      g.fillRect(0, 0, this.WIDTH, this.HEIGHT);
   }
   
   //main thread func
 
   public static void main(String [] args){
      Base ex = new Base();
      new Thread(ex).start();
   }
   
}


---------------------The Main Game 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  
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.JOptionPane;

public class Game extends Base{
   
   BufferedImage bg = null;
   int counter = 0;
   
   protected void initialize(){
   try {
       bg = ImageIO.read(new File("bg.png"));
   } catch (IOException e) {}
   }
   
   public void update(int deltaTime){
      counter++;
      if (counter > 100){
         counter = 0;
         JOptionPane.showMessageDialog(null, "UPDATE FUNCIONANDO."); //NOT WORKING
     }
   }
   public void render(Graphics2D g){
      g.setColor(Color.blue);
      g.fillRect(0, 0, 1024, 768); //NOT WORKING EITHER
     //g.drawImage(bg, 0, 0, canvas);
  }

}
Pages: [1]
 

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

The first screenshot will be displayed as a thumbnail.

pw (37 views)
2014-07-24 01:59:36

Riven (38 views)
2014-07-23 21:16:32

Riven (26 views)
2014-07-23 21:07:15

Riven (28 views)
2014-07-23 20:56:16

ctomni231 (59 views)
2014-07-18 06:55:21

Zero Volt (50 views)
2014-07-17 23:47:54

danieldean (42 views)
2014-07-17 23:41:23

MustardPeter (44 views)
2014-07-16 23:30:00

Cero (60 views)
2014-07-16 00:42:17

Riven (57 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!