Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (408)
games submitted by our members
Games in WIP (293)
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: Question on lockstep model on a RTS on: 2013-01-12 15:06:31
no possible solution?
am I doing something obviously wrong?
2  Game Development / Networking & Multiplayer / Re: Question on lockstep model on a RTS on: 2013-01-07 01:20:27
I give up, it works slow, and I don't understand why, I mean, when I make a localhost test, it works smoothly, but when trying with another pc over lan, it lags a lot...

here is the code:

set_tcp_nodelay is done outside...

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  
private void ReceiveData()
    {

        try{
                if(whoisthis == 1) //for server
               {
                    indata1 = new ObjectInputStream(sk.getInputStream());
                   
                    info_other1 = (Information) indata1.readObject();
                    ProcessInformation(info_other1); //process client info
                   
                    ProcessInformation(info); //process own info
                   
                   
                }
                else //for client
               {
                    indata1 = new ObjectInputStream(sk.getInputStream());
                    indata2 = new ObjectInputStream(sk.getInputStream());
                   
                    info_other1 = (Information) indata1.readObject();
                    info_other2 = (Information) indata2.readObject();
                   
                    ProcessInformation(info_other1);
                    ProcessInformation(info_other2);
                   
                   
                }
               }catch(IOException ioe){} catch(ClassNotFoundException css){System.out.println("nothing to do here");}
   
    }


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  
private void SendData()
    {
       
         
        try{

              if(whoisthis == 2) //this is client
             {
                outdata1 = new ObjectOutputStream(sk.getOutputStream());
               
                outdata1.writeObject(info);
                info.CleanInformation();
                   
                info_other1.CleanInformation();
                info_other2.CleanInformation();
               
               
              }
              else //this is server
             {
                  outdata1 = new ObjectOutputStream(sk.getOutputStream());
                  outdata2 = new ObjectOutputStream(sk.getOutputStream());
                 
                  outdata1.writeObject(info); //send server info
               
                  info.CleanInformation();
                   
                   outdata2.writeObject(info_other1); //send client info
                 info_other1.CleanInformation();
                 
              }

             
            }catch(IOException ioe){}
    }

 
class Information contains a matrix of 6x5 integers.

so, what am I doing wrong here?

thanks for your help.

bye

PD: I read the two generals problem...just...wow..
3  Game Development / Networking & Multiplayer / Re: Question on lockstep model on a RTS on: 2012-12-19 02:40:53
there's a lot of lag, I mean, the game works at an "good" speed for like 2 seconds and then it lags for some milliseconds...like so...
4  Game Development / Networking & Multiplayer / Re: Question on lockstep model on a RTS on: 2012-12-19 02:16:30
it doesn't do just 6 updates per frame, it does all the necessary updates per frame, the only thing is that it only sends 6 commands per frame because is the maximum number of commands a player can make at the same time (for example, you can select 6 units at the moment, and send them to do something)

I added the tcpnodelayoption and works faster, even so, is still very slow...
I'm going to explain in detail what I'm doing so you can help me...

every time the client gives a unit a new order, that order is stored on the Information object.

on the principal thread, client and server are always sending and receiving data, so, in this case, server receives this information object, processes it, and returns it back to the client...

this happens every step, is this causing the game to be slow? it's very frustating you know...
5  Game Development / Networking & Multiplayer / Re: Question on lockstep model on a RTS on: 2012-12-18 16:36:31
So, I have another question!
I want to show you what's the client sending to the server and viceversa:

the client sends an object called information, with a matrix of 6*5.
6 being the maximum number of possible orders in a single moment, and 5 representing
(0) action
(1) id
(2) row
(3) column
(4) step

let's say for example, that server approves a move of the client, it will be like this:

(0) 1 = move
(1) 32
place is going to move:
(2) 4
(3) 5
execute this on this step:
(4) 12


problem is, even with this optimization, I mean, I trying to send as least information of a command possible...well
the game is still is low, should I suppose that the problem is somewhere else?

thanks!!

bye!!
6  Game Development / Networking & Multiplayer / Re: Question on lockstep model on a RTS on: 2012-12-14 18:41:42
excellent, thanks for your advice!
7  Game Development / Networking & Multiplayer / Re: Question on lockstep model on a RTS on: 2012-12-14 16:40:25
B is the server and A is the client, in this case.

the thing is, how does the server knows that the client received the approval?
if the client says, "hey, I received the approval, I'm going to move on next turn!" the how does the client know that
the server received this?

In a short term, If a pack of information is lost, then the game will be desync and I have no way to test that...
8  Game Development / Networking & Multiplayer / Question on lockstep model on a RTS on: 2012-12-14 16:24:50
Hi! the question is simple.
Considering the lockstep model, let's suppose I have user A and B.

A wants to move a unit, so it sends the command to B
B receives the command and tells A that they will execute the command at step 5
A receives the message

the problem is, from the point of view of B, how do B know that A received the message? ok, I can say that A tells B that it received the message succesfully and the will move at step 5...but again....now how do A know that B received this last message?

see my point here? I hope I made myself clear.

thanks, bye!
Pages: [1]
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars and Titan!

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

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (124 views)
2013-05-17 21:29:12

alaslipknot (132 views)
2013-05-16 21:24:48

gouessej (162 views)
2013-05-16 00:53:38

gouessej (154 views)
2013-05-16 00:17:58

theagentd (167 views)
2013-05-15 15:01:13

theagentd (152 views)
2013-05-15 15:00:54

StreetDoggy (196 views)
2013-05-14 15:56:26

kutucuk (220 views)
2013-05-12 17:10:36

kutucuk (219 views)
2013-05-12 15:36:09

UnluckyDevil (223 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.209 seconds with 21 queries.