Author Topic: Virtual Client?  (Read 1675 times)


  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 16
    • View Profile
Virtual Client?
« on: August 05, 2014, 01:40:28 AM »
This is probably a shot in the dark, but is there a way to create a kind of virtual client? Our game originally wasn't intended for Bots, now that request has been added, and there are a lot of "if(tno.isMine)" checks, and so the player playing on the host has bot models set up as if they were meant to be viewed as 1st person player (no body) rather than from someone else's camera, sees all the UI elements the bots would be shown (if they were players), etc... All because the Bots all return true for isMine. I can work around it, but I figured I'd see if there was a way to do this. With this solution there wouldn't need to be special clauses in the code for bots, once they were spawned through some virtual client or something. Thanks in advanced.


  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Virtual Client?
« Reply #1 on: August 05, 2014, 01:54:31 PM »
All AI/bot logic should run in TNManager.isHosting rather than tno.isMine. Only attach player control scripts to objects that will be controlled by the player. Attach UI control scripts to others. Or better yet, have AI script be always there, just check inside it to see if the player is currently controlling the unit, and if so, do nothing. This gives you the ability to seamlessly swap controlled targets on the fly easily.