Author Topic: Using a Smartphone as a gamepad via TNet ?  (Read 3423 times)

ckrin

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
Using a Smartphone as a gamepad via TNet ?
« on: May 12, 2015, 05:03:26 AM »
Hi ArenMook & all other Tnet fans!

Idea:
  • 1 PC  with router & screen.
    This machine should be the host. Its purpose is to handle the inputs recived from the smartphones and apply and display it to the "game scene".
  • 2-8 smartphones connected via wifi.
    The smartphones only act as gamepads, showing a "virtual analogue stick scene".

In other words: i want to send input values from multiple smartphones to a pc that handles and displays the game.
Browsing the forum, i read that displaying different scenes(on smarphone: controller scene / on pc: actual game scene) causes problems  :(

What do i have to keep in mind or take care of for this special type of network implementation or why is it impossible?

Kind regards and thanks in advance!


Lumos

  • Newbie
  • *
  • Thank You
  • -Given: 7
  • -Receive: 4
  • Posts: 21
    • View Profile
Re: Using a Smartphone as a gamepad via TNet ?
« Reply #1 on: May 12, 2015, 08:52:50 AM »
Your idea sounds pretty nice! Instead of having a separate scene, why don't you simply have the "virtual analog sticks" below the actual scene, or on a different layer that isn't rendered by the default cameras and only by the "player" camera on the smartphone?
That way everything will be in the same scene, and you can get away by having only one local instance of the "controller" sticks.

ckrin

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 23
    • View Profile
Re: Using a Smartphone as a gamepad via TNet ?
« Reply #2 on: May 12, 2015, 10:09:31 AM »
hey lumos,
thanks for your answer!

when worse comes to worse, this is the plan.
but imagine you need to download a 400 mb android app on your smartphone to only see a analogue stick   ::)
i'll start prototyping in a few minutes, hopefully it turns out that different scenes are no problem at all.

Lumos

  • Newbie
  • *
  • Thank You
  • -Given: 7
  • -Receive: 4
  • Posts: 21
    • View Profile
Re: Using a Smartphone as a gamepad via TNet ?
« Reply #3 on: May 12, 2015, 12:28:28 PM »
Oh, I didn't think of that. Oops.
Well, a bit of digging around seems to show that you really can't have different scenes on one channel, but here's something I found:
No. Same channel means same scene. You can still send RFCs via private messages to players elsewhere, however.
Perhaps you could have one channel for the "controllers" and one channel for the actual game scene, link them up somehow (I don't know if you can retrieve a list of players on a different channel than yours, but even if you can't, there's probably a workaround for that), then send RFCs using "private messages" (I really have no idea what that means, still a TNet newbie), and have the actual game process the input as per the initial plan.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Using a Smartphone as a gamepad via TNet ?
« Reply #4 on: May 14, 2015, 06:30:06 PM »
I don't recommend you having them share a scene. You don't need the whole scene to send data. tno.Send with Target.Broadcast will send it to everyone. tno.Send with a player target will send a private message to that player. Either way, no need to be inside the same channel to send data. Just make sure that both places have the same TNObject ID / script.