Author Topic: Network creation and pooling  (Read 1912 times)

bravery

  • Guest
Network creation and pooling
« on: August 08, 2013, 05:37:02 AM »
Hello,

I'm building a game for mobile where I do use a pooling technique to spawn dyanmic object during the gameplay.

As suggested by TNet tutorial , I need to replace the instantiate function with TNManager.Create function, so what will happen with pooling at this time?

Or is there any confilict between pooling mechanism and creating objects for networking?

Thanks

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Network creation and pooling
« Reply #1 on: August 08, 2013, 09:01:46 AM »
If you use pooling, don't use TNManager.Create. Instead just use an RFC call to activate / deactivate existing objects.

bravery

  • Guest
Re: Network creation and pooling
« Reply #2 on: August 09, 2013, 12:14:01 AM »
Thanks for the reply.

But in-order to only activate/deactivate my created objects (not creating them using TNet), then how will the TNet know that these spawned dynamic objects need to be sync with other players? Should attaching TNObject to them is suffecient?

Thanks.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Network creation and pooling
« Reply #3 on: August 09, 2013, 04:10:08 PM »
You will create the object using TNManager.Create once, and after that you will use some kind of a sync function that will inform everyone whether they should be enabled or disabled. If I was doing it, I would basically keep the object enabled so that its RFCs work, but I would disable its children so that nothing happens until I "re-enable" it.