Author Topic: How to mock up a 2nd connected player, when testing?  (Read 479 times)

scornflake

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 1
  • Posts: 15
    • View Profile
How to mock up a 2nd connected player, when testing?
« on: April 04, 2017, 06:20:57 PM »
How might i get a second actual player into the world (as a TNet.Player) for testing purposes (within the game game instance)?

Lots of things in the code are static (TNManager for example), so I can't create two managers...
As far as I can tell TNet has been built around the assumption that there will be a single running player in a Unity game instance.  Am I wrong in thinking that?

---

What I'm trying to do is be easily able to test as though two players are connected, without having to actually connect two devices.
My game is also location based, and ideally the two players would be some distance apart. Connecting two real devices will work, but is a bit of a pain.

What I was hoping for was a way to connect a "fake" player to the existing server, and set their internal player data so they look like they are someplace else.
But I can't see how I'd have two players connected, and setup as owners of objects in the scene...   

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: How to mock up a 2nd connected player, when testing?
« Reply #1 on: April 07, 2017, 06:48:39 PM »
TNManager.player is your client. You can build your game around having multiple game players (split screen etc), but TNet's player just means "current game executable".

If you need to connect multiple actual players though, with "player" meaning "TNet's player", then you need multiple executables. Just run the EXE multiple times.