Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (540)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (603)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  JAVA3D and RMI failing  (Read 5110 times)
0 Members and 1 Guest are viewing this topic.
Offline jibbylala

Senior Newbie





« Posted 2010-11-17 04:58:57 »

Dear experts,

My intention was to create RMI version of  Networked Tour3D

example in the 3d book here:http://fivedots.coe.psu.ac.th/~ad/jg/ch21/index.html.

which is about moving sprites on multiple client and navigate together through virtual world simultaneously but i  m failing.

i refactor the  class Sprite3d  to get the Transform3d from remote object on server so when all clients get the same transform 3d all change their position hence "Network tour of sprites in virtual worlds' can be achieved .

i m  beginner programmer  and i dived into these advanced things and now i have no idea, why it is not working may be i m doing some  silly mistake. I don't know what to do  and  now  the code is much i can't paste all on some forum.

this is code in which the methods are calling remote but sprites are NOT moving simulataneously :

this is class which is getting the tranform3d from server other class on client site are calling this class for getting the objectgroup or transformgroup

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  
this is remote class from where i m getting the transform3d:

 

[code]package ServerSite;

// Sprite3D.java
// Andrew Davison, April 2005, ad@fivedots.coe.psu.ac.th

/* Sprite3D loads a 3D image, placing it at (0,0,0).
   We assume that the object's actual position is (0,0) in the XZ plane.
   The Y position will vary but probably the base of the object is
   touching the XZ plane.

   Movements are restricted to the XZ plane and rotations
   around the Y-axis.

   An object cannot move off the floor, or travel through obstacles
   (as defined in the Obstacles object).

   Very sinmilar to Sprite3D in Tour3D.
   New net-related code:
     - a userName above the sprite that stays oriented along +z axis;
     - return a detachable branchgroup for the scene;
     - store the current rotation around the y-axis, and methods to return
       and set it.
 */



import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.text.DecimalFormat;
import java.util.Enumeration;
import java.util.Vector;
import javax.media.j3d.*;
import javax.vecmath.*;

public class Sprite3DImpl extends UnicastRemoteObject implements  Sprite3D
{

    private static final long serialVersionUID = 1L;
    private MySerTransform3D t3d, toMove, toRot;    // for manipulating objectTG's transform
    private double currRotation;

    private DecimalFormat df;   // for simpler output during debugging

    public Sprite3DImpl()throws RemoteException {
        super();
        t3d = new MySerTransform3D();
        toMove = new MySerTransform3D();
        toRot = new MySerTransform3D();

        df = new DecimalFormat("0.###");  // 3 dp
        currRotation = 0.0;
        System.err.println("In remote constructor");
    }

    public void doMove(Vector3d theMove)throws RemoteException
    //  // Move the sprite by the amount in theMove
    {
        toMove.setTranslation(theMove);    // overwrite previous trans
        t3d.mul(toMove);
        System.err.println("In remote doMove");
    }  // end of doMove()

    public Point3d tryMove(Vector3d theMove)throws RemoteException
    /* Calculate the effect of the given translation but
     do not update the sprite's position until it's been
     tested.
     */

    {
        toMove.setTranslation(theMove);
        t3d.mul(toMove);
        Vector3d trans = new Vector3d();
        t3d.get( trans );
        // printTuple(trans, "nextLoc");
        System.err.println("In remote tryMove");
        return new Point3d( trans.x, trans.y, trans.z);

    }  // end of tryMove()

    public void doRotateY(double radians)throws RemoteException
    // Rotate the sprite by radians amount around its y-axis
    {
        toRot.rotY(radians);   // overwrite previous rotation
        t3d.mul(toRot);
        System.err.println("In remote doRotateY");
    } // end of doRotateY()

    public void setCR(double radians)throws RemoteException
    {
        currRotation += radians;
    } // end of setCurrRotation()

    public Point3d getCurrLoc()throws RemoteException
    {  
        Vector3d trans = new Vector3d();
        t3d.get( trans );
        System.err.println("In remote getCurrLoc");
        // printTuple(trans, "currLoc");
        return new Point3d( trans.x, trans.y, trans.z);
    }
    public void setCurrRotation(double rot)throws RemoteException
    {
        double rotChange = rot - currRotation;
        doRotateY(rotChange);
        System.err.println("In remote setCurrRotation");
    } // end of setCurrRotation()


    public double getCurrRotation()throws RemoteException
    {  System.err.println("In remote getCurrRotation");
    return currRotation;  }


    private void setT3d(MySerTransform3D t3d)throws RemoteException {
        this.t3d = t3d;
    }
    public MySerTransform3D getT3d() throws RemoteException{
        if(t3d!=null){
            return t3d;}
        else
            System.err.println("t3d is null");
        return t3d;
    }
    private void setToMove(MySerTransform3D toMove) throws RemoteException{
        this.toMove = toMove;
    }
    public MySerTransform3D getToMove()throws RemoteException {
        return toMove;
    }
    private void setToRot(MySerTransform3D toRot)throws RemoteException {
        this.toRot = toRot;
    }

    public MySerTransform3D getToRot()throws RemoteException {
        return  toRot;
    }
   
    private void printTuple(Tuple3d t, String id)throws RemoteException
    // used for debugging
    {
        System.out.println(id + " x: " + df.format(t.x) +
                ", " + id + " y: " + df.format(t.y) +
                ", " + id + " z: " + df.format(t.z));
    }  // end of printTuple()
}  // end of Sprite3D class
 


 

Other classes include behavior class and WrapNetTour3D according to changed design because of RMI may be there is some issue in those but first i would like to confirm and have some review on these main classes  and why it is not working and how it can be implemented with RMI.(other files and code everything you can look at the link)

If somebody need i can send the whole project because i just wanted that working and i thought i did the major changes and spent lot of time on it.

 

please help i would be really thankful

jibby lala[/code]
Offline gouessej
« Reply #1 - Posted 2010-11-18 15:04:56 »

Hi!

I have a working example of (very limited) multiplayer 2D fighting game using RMI, maybe it could help you. Would you like to see the source code?

Offline jibbylala

Senior Newbie





« Reply #2 - Posted 2010-11-18 20:47:03 »

i m glad to have atleast some reply  Smiley
actually my aim is to create the multiuser game/environment leveraging JAVA3D and all its all capabilities that'S why i approach that application from book but ok i can have a look how u r using RMI.    
but
i m disappointed that nobody is interested in my question Sad

thanks
jibby lala
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline princec

« JGO Spiffy Duke »


Medals: 437
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #3 - Posted 2010-11-18 21:05:46 »

RMI is exactly the wrong technology to use for realtime client/server graphical applications. Use straight TCP/IP sockets, or UDP. I suggest TCP as you don't seem to know what you're doing anyway.

Cas Smiley

Offline jibbylala

Senior Newbie





« Reply #4 - Posted 2010-11-18 21:28:16 »

yes you are right but now i m on the way and i m totally unaware of other technologies for networking and have no time to start from scratch
thanks
J
Offline princec

« JGO Spiffy Duke »


Medals: 437
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #5 - Posted 2010-11-18 21:38:00 »

TCPIP will be easier.

Cas Smiley

Offline jibbylala

Senior Newbie





« Reply #6 - Posted 2010-11-18 21:49:27 »

and secondly the aim is to have a "generic network layer" for variety of games , and this will going to be really long journey if now i start with TCPIP...and heard that are lot of low level concepts involve which really need time to understand and grasp Sad
thanks
 Smiley
Offline Nate

« JGO Bitwise Duke »


Medals: 158
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #7 - Posted 2010-11-18 23:50:35 »

The path to success doesn't generally involve skipping fundamental steps. Smiley

Offline princec

« JGO Spiffy Duke »


Medals: 437
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #8 - Posted 2010-11-19 00:06:16 »

RMI will completely baffle you when it doesn't work, and the reason you can't and shouldn't use it will become apparent with a more thorough understanding of TCP/IP, and then how RMI works on top of TCP/IP.

Cas Smiley

Offline jibbylala

Senior Newbie





« Reply #9 - Posted 2010-11-19 00:26:44 »

OK lets say  i consider your advice,  can i have some generic network layer  based on TCP/IP which can be valid for different real time MP games(because i heard there are constraints also in TCP/IP than other people will say why not UDP)  and if how much complex that would be  and how much time will it take to develop (yaw its subjective question)?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline jibbylala

Senior Newbie





« Reply #10 - Posted 2010-11-19 00:44:48 »

and actually it's not that much hard problem its raising, my problem is not related to RMI i thought , i m calling remote methods and getting back the objects(Transform3d)

 i thought it's not matter of  technology u used when the application would have more features and the design will get complicated; these problems will definitely come.

i need some reviews on design i heard about callbacks and i wanted to know whether that is what i need or i need to implement observer pattern for client site as only one class on client site is getting updates and i m feeling others don't have those updates so they are not updating their selves.

but i just need some expert eyes on this  Sad as testing all of these possibilities are taking time and i m also new to java3D library also and its also bothering me to implement what i have written.
Offline gouessej
« Reply #11 - Posted 2010-11-20 21:22:07 »

Hi!

i m glad to have atleast some reply  Smiley
actually my aim is to create the multiuser game/environment leveraging JAVA3D and all its all capabilities that'S why i approach that application from book but ok i can have a look how u r using RMI.     
but
i m disappointed that nobody is interested in my question Sad
this is my address:gebrawn@hotmail.com
thanks
jibby lala
That's here:
http://membres.lycos.fr/javalution/download/fighting.zip

Princec is right, it would be better to use TCP/IP or JGN:
http://code.google.com/p/jgn/

Offline jibbylala

Senior Newbie





« Reply #12 - Posted 2011-04-28 14:31:58 »

The path to success doesn't generally involve skipping fundamental steps. Smiley

if the fundamental steps can reach me to achieve this silly scenario:
http://stackoverflow.com/questions/5370279/sending-receiving-object-references-or-part-of-object-with-javanio

i would really happy =)
Offline gouessej
« Reply #13 - Posted 2011-04-29 09:11:35 »

You have to choose how you represent your balls at a very low level but why do you want to use NIO? Maybe some basic sockets would be enough for your needs, wouldn't they?

Offline tberthel
« Reply #14 - Posted 2011-04-29 16:25:21 »

You have to choose how you represent your balls at a very low level but why do you want to use NIO? Maybe some basic sockets would be enough for your needs, wouldn't they?

LOL

Offline jibbylala

Senior Newbie





« Reply #15 - Posted 2011-04-29 16:40:43 »

finally, they would end up in an object or array of objects, how would i sent the array with IO socket or channels javaNIO?
Offline tberthel
« Reply #16 - Posted 2011-04-29 16:44:09 »

To really mess up my next game I think I will use a mix of RMI, XML-RPC, and SOAP.  Just to make even slower I might throw in some WSDL.  WTH.

Offline gouessej
« Reply #17 - Posted 2011-05-04 11:50:35 »

finally, they would end up in an object or array of objects, how would i sent the array with IO socket or channels javaNIO?
This could be a good starting point:
http://download.oracle.com/javase/tutorial/networking/sockets/readingWriting.html

LOL
What's wrong with what I explained to him? RMI is quite slow, I don't advise anyone to use it for games, I only did it for a blueprint.

Offline cylab

JGO Ninja


Medals: 55



« Reply #18 - Posted 2011-05-04 16:03:54 »

What's wrong with what I explained to him? RMI is quite slow, I don't advise anyone to use it for games, I only did it for a blueprint.

That's the funny thing about language barrier. Your statement could also be read like:

Quote
You need to choose how to illustrate your testicles at a very low level (...) maybe some basic bulb holders would be enough..

Something like that. Since I am german, I don't know, what tberthel really read into this Wink


Mathias - I Know What [you] Did Last Summer!
Offline ra4king

JGO Kernel


Medals: 356
Projects: 3
Exp: 5 years


I'm the King!


« Reply #19 - Posted 2011-05-05 02:26:01 »

Quote
Quote
What's wrong with what I explained to him? RMI is quite slow, I don't advise anyone to use it for games, I only did it for a blueprint.

That's the funny thing about language barrier. Your statement could also be read like:

Quote
You need to choose how to illustrate your testicles at a very low level (...) maybe some basic bulb holders would be enough..

Something like that. Since I am german, I don't know, what tberthel really read into this

ROFLMAO!!!

Offline tberthel
« Reply #20 - Posted 2011-05-05 04:36:03 »

Cylab, even from Germany knew exactly what I was thinking.

The whole thread is a big haha.

jibbylala should read this:  http://www.java-gaming.org/topics/multi-player-architectures/24152/view.html

In fact I started that thread just to make it clear to everyone in the world what you should be doing when making a Multi-Player game.

Offline tberthel
« Reply #21 - Posted 2011-05-05 04:38:12 »

Oh well the creation of the wheel starts again:  http://www.java-gaming.org/topics/the-simplest-and-easiest-game-network-layer-with-kryonet/24164/view.html

I was too late.  Sorry to the world for destroying years of work.

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

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

The first screenshot will be displayed as a thumbnail.

Mr.CodeIt (24 views)
2014-12-23 03:34:11

rwatson462 (53 views)
2014-12-15 09:26:44

Mr.CodeIt (45 views)
2014-12-14 19:50:38

BurntPizza (85 views)
2014-12-09 22:41:13

BurntPizza (110 views)
2014-12-08 04:46:31

JscottyBieshaar (79 views)
2014-12-05 12:39:02

SHC (89 views)
2014-12-03 16:27:13

CopyableCougar4 (97 views)
2014-11-29 21:32:03

toopeicgaming1999 (155 views)
2014-11-26 15:22:04

toopeicgaming1999 (152 views)
2014-11-26 15:20:36
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

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

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
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!