Author Topic: referencing or copying???  (Read 2919 times)

Offline Melssj5

  • double
  • *****
  • Posts: 724
    • View Profile
referencing or copying???
« on: March 20, 2006, 03:11:49 am »
Hi, I have a problem here.

I transmitted a world through a network inside another object, and when the client recieves the World it does World X=Another.getWorld (); to get the World of the object transmited, in this case (another), but after deleting some objects on it, I have problems trying to delete them again on the next time that the World is received.

So, my question is: The World on the client machine is being referenced to the World on the server one??????? or is another new object????????
Nada por ahora

Offline manumoi

  • long
  • ***
  • Posts: 121
    • View Profile
    • http://www.iro.umontreal.ca/~blanchae
referencing or copying???
« Reply #1 on: March 20, 2006, 05:51:20 am »
Hello,

Concerning your problem, when programming on network, there should not be direct reference between objects in the server and client sides unless you clearly mention it (and in fact, if feasible - and i m not sure of it in JAVA at least- I don't see the usefulness of such a thing in this case...)
In your case, you must keep in mind that JAVA uses a garbage collector so it s sometime difficult to determine when the memory is effectively cleared... And maybe your problem doesn t concern memory allocation. A piece of code concerning the client and server communication methods (and also your method to delete World) could help understand what your problem is.

Manu

PS: i m also unsecure about the fact of having a World object on the server side if your topology is a classical server <--> clients. Why not just having the World object on the client side and sending updates of the game/application logic as processed by the server side in order to create/delete/update objects in the world of the clients side? In general, the 3D environment is rendered only on the client side. But maybe your application has some specificities that needs it also on the server side. Hope this helps  :?