Author Topic: Synchronizing a Team list efficiently  (Read 3434 times)

swizzersweet

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 2
  • Posts: 6
    • View Profile
Synchronizing a Team list efficiently
« on: April 23, 2014, 08:45:23 AM »
Let's say I have an online multiplayer game with two teams, team A, and team B.

1) I'd like to efficiently synchronize which player is on which team efficiently. Unfortunately, I can only save packets per RFC, meaning I'd have to resync the whole team list everytime there is a change to the list (bad). I'm wondering if you could add in the ability to save RFC's from another id that you provide, rather than providing as many RFC's as there are players, and saving each of those RFC's (also bad). Otherwise, I will have to implement this.

2 )Additionally, is there a way to know which player called an RFC? Eg, if a client says SendRequestTeam(2) to the host, there's no way for the host to know which player asked to change team. I have to pass in the player, which as well.

Thanks for your help,

Jon

ldw-bas

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 2
  • Posts: 32
    • View Profile
Re: Synchronizing a Team list efficiently
« Reply #1 on: April 23, 2014, 10:46:13 AM »
RFCs are saved per TNObject, so not per class or something like that. So you could fix you problem by creating a TNObject for every player. With an RFC that is something like player.JionTeam(1). I guess this will also solve you second issue.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Synchronizing a Team list efficiently
« Reply #2 on: April 24, 2014, 01:36:11 AM »
Having a separate TNObject for each player makes sense to me. When the player leaves, that TNObject can be destroyed. Just make sure that this player object is created by each player, so that they "own" it.

I am doing the same exact thing in Windward, actually. I even separated it some -- the players are invisible objects with important sync scripts on them (like joining a team, choosing colors, choosing a symbol, etc). Each player can also create a ship to control, which is a separate created object. This way a player can "die" (their ship can be destroyed), but doing so won't actually destroy the player -- just the controlled ship (think: avatar).