Author Topic: Can a TNObject belong to multiple channels?  (Read 3574 times)

lance

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
Can a TNObject belong to multiple channels?
« on: February 12, 2018, 02:29:49 AM »
It seems that although a TcpPlayer can listen to multiple channels, a TNObject can only exist in one channel. Given image below, a TNObject is attached to each player. Client1 and Client2 is fighting at channel edge. All collision detection and damage calculation is done on Host. But Host can not see Client2 because Host does not listen to Channel2(She's too far away). How could I handle this situation? Can a TNObject join and leave channels just like TNManager?




lance

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
Re: Can a TNObject belong to multiple channels?
« Reply #1 on: February 12, 2018, 02:33:39 AM »
BTW, TNObject's uid get changed when it transferred to another channel. Could this uid be consistent?

cmifwdll

  • Global Moderator
  • Sr. Member
  • *****
  • Thank You
  • -Given: 0
  • -Receive: 149
  • Posts: 285
  • TNet Alchemist
    • View Profile
Re: Can a TNObject belong to multiple channels?
« Reply #2 on: February 12, 2018, 11:20:32 PM »
You'd have to iterate every other UID in the channel to make sure it's unique then handle cases where it wouldn't be unique.

If you want the host to have authority, then the host has to know everything that's pertinent to its authority. You'd have to have the host join every channel that a player is in. Or use custom packets to communicate out-of-channel.