Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Easy WiFi Controller- Turn your mobile phone into a controller!

Discussion in 'Assets and Asset Store' started by greggtwep16, Mar 9, 2015.

  1. Francsois114

    Francsois114

    Joined:
    Mar 21, 2014
    Posts:
    5
    Sorry, but finally that doesn't work. Like I said, my control have the same name on the server and the client scene and my function and my control are not on the same Game Object. But evrytime I print(touchpad != null), the answer is false, so mapDataStructureToAction() is never calles.

    void Update()
    {
    print(touchpad != null);
    if (touchpad != null && touchpad.serverKey != null && touchpad.playerNumber != EasyWiFiConstants.PLAYERNUMBER_DISCONNECTED)
    {
    mapDataStructureToAction();
    }
    else
    {
    touchpad = (TouchpadControllerType)EasyWiFiUtilities.checkForClient(control, (int)player);
    }
    }


    public void mapDataStructureToAction()
    {
    SendMessage(notifyMethod, touchpad, SendMessageOptions.DontRequireReceiver);
    }
     
  2. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,502
    If touchpad stays null then the checkForClient method has not found your control yet (but yet you see the telemetry in the console so it's there). The two things to check are.

    1. That the control name on the client and the server are exactly the same (case sensitive) the default for touchpads is "Touchpad1" on both the client and the server. If you've changed this to something custom make sure they match exactly and don't conflict with any other of your controls.

    2. If you are sure the control names are the same, then make sure your player number matches what phone is connected. Assuming you are testing currently with just one phone obviously the server side should be marked as "player 1"

    If you still have issues/questions don't hesitate to let me know and I'll look into it further.
     
  3. Francsois114

    Francsois114

    Joined:
    Mar 21, 2014
    Posts:
    5
    Nope, I checked my control name and my player number and evrything seems alright.
     
  4. Francsois114

    Francsois114

    Joined:
    Mar 21, 2014
    Posts:
    5
    I finally found the problem and it was stupid. I had to force the application to stop evry time I wanted to test the game in the editor.
     
  5. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,502
    Ah I didn't realize you ever got it to work intermittently, I thought it was never working. The next version of the product which is going to be submitted in the next few days, is going to update the connection system drastically, which will make it so you don't need to restart the controller app anymore. Glad you figured it out.
     
  6. CommunityUS

    CommunityUS

    Joined:
    Sep 2, 2011
    Posts:
    172
    Ok great I plan to purchase in next few days I will email you invoice then. Thanks!
     
  7. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,502
    Easy WiFi Controller 1.8 has now been submitted for review and should be live on the store in about a week.

    Release Notes:
    -Drastically improved connection system. You no longer need to restart the controller app if you have server only changes.

    -New "Any Player" option on server controls. This is useful for menus.

    -New controller select example. Shows how to do a Super Smash Bros. style player select screen. Also, this example includes two server side scenes to demonstrate that Easy Wifi Controller can keep connections across scenes.

    -Updated documentation with previous requests

    -Other miscellaneous fixes/improvements.
     
    Pikkukala likes this.
  8. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,502
    Version 1.8 is now live on the store. Thanks for the speedy review Unity!
     
  9. bitbutter

    bitbutter

    Joined:
    Jul 19, 2012
    Posts:
    60
    Is there currently a way to allow a wifi client to respond to the host game app being quit?

    More concretely i'd like to have different 'screens' display on my client depending on the state of the client-host relationship (not yet connected, connected, 'game joined'). I've managed to get these transitions working in a forward direction, but it's not clear to me how i could transition from connected back to 'not yet connected' when the host application quits.

    [EDIT] It looks like the new 'heartbeat' properties could be used for this. Does the Heartbeat Timeout on the 'client' peer type refer to how long it will wait for heartbeats sent by the server before disconnecting? And is there a way to add a callback to the disconnect event on the client, or should i be repeatedly comparing the status of EasyWiFi.Core.EasyWiFiController.clientState to EasyWiFiConstants.CURRENT_CLIENT_STATE.NotConnected? Thanks!
     
    Last edited: Oct 23, 2015
  10. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,502
    Yes the new connection system has 3 properties (two on server and one on client) that handle the non normal disconnects (things like just quitting the app, forced closes, or network goes down). These are in addition to voluntarily disconnecting properly via the connection widget.

    Heartbeat Timeout(client only)-
    When you set to something besides 0 this is activated. This is the rate at which the client checks for server heartbeats. If this check fails twice in a row the client assumes it's been disconnected from the server.

    Client Timeout(server only)-
    When you set to something besides 0 this is activated. If the server doesn't hear from a particular controller in this amount of seconds it will mark the controller as disconnected.

    Server Send Heartbeat rate(server only)-
    When you set to something besides 0 this is activated. This is the rate at which the server will send heartbeat messages to each client. This is how the client controllers will know if it gets disconnected from the server.


    You will see that all the example scenes have been updated with values for these. In particular for your case you'd want to set the heartbeat timeout to detect the host app going away. As the documentation states it waits for this check to fail twice and then it sets EasyWiFi.Core.EasyWiFiController.clientState to disconnected and goes back to "discovery mode" to look for another server or if the same server has come back. I have put a callback on the server that passes whether a controller just connected or disconnected and an int for which player number. On the client side there is no callback but there is also no real information it has here so there is no real difference between "connected" and "game joined" here from the client. It either knows it's in a session with the server or not and doesn't really know anything else, unless you add some states for your game from the server via backchannels (which would be custom to your game). If you want to display the connection state I would simply query clientstate.

    Hope this helps and hope you like the update. Certainly as always if you have any suggestions or improvements don't hesitate to ask and I'll try my best to add them.
     
  11. bitbutter

    bitbutter

    Joined:
    Jul 19, 2012
    Posts:
    60
    Thanks again for the clarification.

    I'm struggling a bit with getting the colouring system to work in the way I'd like while also gracefully handling host quits and restarts of the game.

    What I think would make it easier for me would be a way to send distinct 'messages' from the host to the client from time to time, rather than a continually updated stream of data (which the backchannels seem like a perfect fit for). Am i perhaps overlooking a way to do this, or if not are there any plans to implement something like this?
     
  12. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,502
    The system is designed around consolidating each machines traffic and is not a per control tuning. So lets say your controller has 8 controls or your server has 8 backchannels. EWC is not spitting out 8 packets it is spitting out 1 with all the 8 controls information in it. This is why if you have 1 out of 8 controls that you'd like to send infrequently there is no option to do so. The option of sending rate is on Easy WiFi Manager but will only give you general options like "cap at 60hz", "cap at 90hz", "cap at 30hz", "send infrequently once per second", etc. and will effect the sending rate of all controls.

    In general, this (consolidating) is much more friendly to not using up all your wifi bandwidth than providing individual tuning per control which would require splitting up packets and is why there are no options to do so. Most people don't realize that as long as you stay under the typical routers max packet size (512 bytes) that there is virtually no difference in sending 300 bytes vs 400 bytes and that sending two small packets (say 30 bytes) is worse than 1 larger packet. In general this is why the receiving end on bool and string data types (backchannels too) have the option in their inspector for the notify method between "always" and "only_when_changed". That way you can still write your methods to be more event driven if you want, even though the data is always coming.

    In a general purpose network tool you do usually get both styles (rpc's and every frame sync). However, with EWC it's obvious that almost all traffic will be sync and that fact is actually used to facilitate the consolidation. It does mean though that it's not designed for RPC style traffic, though.

    Hope this helps.
     
  13. Contract-killer

    Contract-killer

    Joined:
    Sep 21, 2012
    Posts:
    41
    HI greggtwep16
    I want to buy this plugin for making the video stream share between two device at same time. Do you think it is possible from this plugin ?
     
  14. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,502
    Audio/Video is a lot of data, so no this plugin wouldn't work for that. It's primarily designed to work as a controller. It can work for general purpose data as well, but in my testing it can handle about 4096 bytes per frame with 2 players, 2048 bytes per frame with 4 players, 1024 bytes per frame with 8 players, and 512 bytes per frame with 16 players on average/poor wifi network. Obviously, with strong wifi it can handle more but 4kb wouldn't be enough to handle an audio/video stream. Controller data, object data, or most other data requirements are much smaller so the product handles that just fine even up to 16 players on the same network.

    There are users that have been successfully been able to "share" their screen by transmitting the Unity object data instead, but an audio/video stream directly won't be of any use at that small of a size even if you lower the resolution. When application like skype, netflix, or others do it, they use pretty involved compression algorithms and obviously aren't trying to play a game at the same time.
     
    Last edited: Dec 18, 2015
  15. HD30

    HD30

    Joined:
    Dec 30, 2015
    Posts:
    5
    First of all, Great asset! Help's me alot with many different projects. It will be great if there will be an option to not send data every frame for the backchannel controls. I always have to find workarounds for this problems.

    So my first question is: do you have any advice what is the best way to send out one time data between server and client and vice versa. For example, a button that sends a specific number that makes the server do something... Right now I have to send the number many times every frame instead of just once.

    My seconds question: Is there a way for the client to know the player number that was given to him on connection to the server?

    Thank you very much!
     
  16. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,502
    One time data transmission is not currently built into the product as it's designed around continuous data streams (controller data, telemetry data like the spedometer needle back to the controller in the example, etc). On the surface, it's easy to mistake how major of a change this is to implement. One time data updates, especially on UDP, would require acknowledgements to be built into the product, since you will be only sending it once you need to make sure it got there. When you start down the road of acknowledgements, you also generally need to start building timestamps and the syncing of different machines timestamps. This is in addition to the normal infrastructure around sending variable sized messages and other things that would be required. It essentially would change much at the core of the product.

    At least at the current time, I don't have any immediate plans to add this to the product. You are not the first to want this functionality and I certainly understand the desire. For now I think the simplicity of the current design outweighs the need to put this in. Also, in general in each case that I've talked with people in the past about this they were generally unaware of the lack of performance impact of repeated sending of information. In general as long as all your data is under 512 bytes per frame there is virtually no impact to sending the data all the time. When you get above that size routers will break up what used to be one packet into multiple and then it does start to matter (it impacts the number of concurrent players you can have) but until you reach that threshold it is not really making any significant difference in performance. Are you near this threshold?

    This information is not known by default by the client (only the server knows the logicalPlayerNumber). That being said you can certainly send this piece of data back to the client via a backchannel.
     
  17. HD30

    HD30

    Joined:
    Dec 30, 2015
    Posts:
    5
    Thank you very much for the quick response!
     
  18. OzzyBozzy

    OzzyBozzy

    Joined:
    Jan 26, 2012
    Posts:
    3
    Hi,

    Could you direct us on how to control the camera via gyroscope? We intend to turn around, look up and down, in a very similar way like head tracking in VR. We have tried to use and customize match orientation script from the controllerskitchensink and steeringwheel example scenes. However, we could not manage to achieve a decent tracking. we have changed the quartenion values from + to minus at some point which got us closer a bit, but still we need a helping hand on this. Maybe an example like a gyro to mouse look script could do the trick. Thx,
     
  19. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,502
    The match orientation script would indeed be the closest. Can you elaborate on what wasn't "decent tracking" at that point? Was it behaving as you intended (turn left looked left, tilted up looked up, etc.) but just wasn't precise enough? Or was there a fundamental portion that wasn't mapped how you wanted?
     
  20. mcmonk

    mcmonk

    Joined:
    Sep 22, 2014
    Posts:
    13
    Great asset, I really like the simplicity but I'm having problems customizing it :)

    How would you go about creating a scene like this one:
    http://www.blogcdn.com/www.joystiq.com/media/2011/02/5414737814399200e96eo_530x300.jpg

    I have tried to send a custom bool value from the controller to the scene, that reflects if the controller is connected or not. So when the controller is on it sends a true boolean, and when the controller is set to off, it sends a false right before disconnecting. The problem is that this does not work, the controller never receives the false value, even though I send it before it actually disconnects.

    So how would you go about creating this scene? I want players to be automatically assigned a player number when they press connect, and remove them from the game if they disconnect? In your documentation there is no guide on how to check who is connected and how to reassign player values to them.
     
  21. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,502
    The multiplayerControllerSelect example scenes will show you how to create this. Essentially for any controller select screen you need to remap the id given to a controller when it connected to the one that they select. Then generally you remap and switch the logicalPlayerNumber while you are loading your actual game scene so that when the game starts you are the player that you selected.

    The example shows a Super Smash Bros. style select screen where on connection each player gets a prefab that they then select what player they want to be. The only difference in the screenshot you provided is that you want the player to hit a button to take the next available player instead of controlling a prefab and hovering over an area. Essentially you would want to do everything the same as the example except in addition you'll want to keep track of how many players have "joined" because when the next player hits the button he'll need to take the next slot. Also, if one disconnects you'll need to track that as well since you probably don't want to shuffle all of the other players down. Other than that logic everything else would be the same that when everyone is ready you'll have a map that corresponds to what player they selected. For example perhaps the fifth phone connected selected player 1. You will have in your map that this needs to happen and then reassign the player to player 1 before you load the game scene. The example has all of the logic on how to accomplish this for you to look at.

    Hope that helps.
     
    mcmonk likes this.
  22. mcmonk

    mcmonk

    Joined:
    Sep 22, 2014
    Posts:
    13

    Great Feedback! I was able to do it in the first try after your description! :D
     
  23. rsynnest

    rsynnest

    Joined:
    Apr 29, 2015
    Posts:
    3
    Really loving this asset so far, thanks for making it.

    I do have one question/debugging request:
    I've added the ControllerConnected script to my Scene, but it is creating an infinite amount of PlayerPrefab objects, and I'm only testing with a single Phone client.
    Debugging shows that the bool flags messageIsConnect and messageWaiting, which are assigned by EasyWifiController upon a new client connection, are not being reset to False and are remaining True on each frame after the initial connection is made.
    Any reason you can think why this would be happening?
    Judging by the EasyWifiManager DebugLog, it seems like the phone keeps rebroadcasting at a new port, maybe thinking that it's not connecting when in fact it is?
    I've tried increasing my Timeout and decreasing my Heartbeat and that didn't help.
    Any ideas?

    Attached is my paraphrased Debug Log.

    EDIT: This problem was solved later in this thread, turned out to be user error (I was missing a Text GameObject as Child of StartGameButton) http://forum.unity3d.com/threads/ea...-into-a-controller.308553/page-3#post-2536846
     

    Attached Files:

    Last edited: Mar 3, 2016
  24. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,502
    That is definitely not normal behaviour for the Multiplayer Controller Select Example. Does this occur in the example as well or just in a new scene you are trying out?

    To me the most likely culprit is going to be your heartbeat/timeout settings on the server and the client. ServerSendHeartbeatRate is how often it sends the heartbeat message in seconds, clientTimeout is how long the server will declare the client dead if it doesn't see data, and heartbeat timeout is how long until the client disconnects and tries to find a server again if it doesn't see any heartbeats. If you have these settings not aligned the server or the client could definitely keep disconnecting/reconnecting (for example if you have heartbeat timeout as .1f and ServerSendHeartbeatRate as 1f its going to keep disconnecting, because heartbeats come once a second but the phone is checking for a heartbeat every tenth of a second). What do you have these set to?

    Also, when debugging with breakpoints it's also important to note that means if you stop on a breakpoint too long, the other end could very well assume the other has lost wifi or otherwise disconnected.
     
    Last edited: Mar 2, 2016
  25. rsynnest

    rsynnest

    Joined:
    Apr 29, 2015
    Posts:
    3
    This problem is not occurring in the MultiplayerControllerSelect example, only in my custom scene. I'm not using Debug Breaks. I'm using the exact same WifiManager settings and scripts as the MultiplayerControllerSelect example (Client Timeout = 3 , Server Send Heartbeat Rate = 0.5). I tried testing with higher timeout values (up to 14) and shorter heartbeat rates (down to 0.1). Is it possible that our game code could be interfering with the Wifi Controller somehow?

    I tested this in an empty scene, and it still happens. Maybe something in our Project Settings.
    Maybe I'm missing something in my setup?
    Steps taken:
    Added EasyWifiManager, set timeout =5, heartbeat rate = 0.3
    Added Canvas
    Added ControllerConnected script to the Canvas
    Added playerPrefab to Player Badge Object in ControllerConnected
    Added sprites for P1 Area, P2 Area etc.
    Start Scene
    Infinite playerPrefabs generated! Ahh!

    EDIT: This problem was solved later in this thread, turned out to be user error (I was missing a Text GameObject as Child of StartGameButton) http://forum.unity3d.com/threads/ea...-into-a-controller.308553/page-3#post-2536846
     
    Last edited: Mar 3, 2016
  26. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,502
    It definitely has to be something different if the example works for you but similar code in your scene it doesn't work. It wouldn't hurt to see the client logs as well to get the picture from the other side (normally you could just check "log verbose" on both ends and the server would log both but since the issue is on connection it obviously can't log for something that might not be connected).

    You didn't mention what you have heartbeat timeout set to on the client side, to me it's the most important piece of the puzzle here. Your logs from earlier to me seem to indicate that since messageWaiting stayed true that the callback for a connection/disconnection kept getting called. To me the most likely culprit from this is that the heartbeatTimeout on the client side is too small and it's disconnecting and then reconnecting. To know for sure it would be helpful to see the client side logs as well.
     
  27. rsynnest

    rsynnest

    Joined:
    Apr 29, 2015
    Posts:
    3
    I didn't realize there was a heartbeat setting on the client side. It's even in the docs! *facepalm* That definitely sounds like the culprit. Will check and update this post in a bit.

    UPDATE: Ok I figured it out. It wasn't the Client side heartbeat timeout (which I did try). It was something dumber than that.
    The problem was my StartGameButton was throwing a Null pointer exception in the alphaBlink script on line 33: myText.color = currentTextColor; because my StartGameButton Object didn't have a Text GameObject child. I have a bunch of benign errors due to another script so I was missing the Null pointer exception.

    Problem was solved by either removing the StartGameButton and all references in script (since I'm not using it), or by modifying alphaBlink script if you want to remove Text from the StartButton, or by adding a Text child to the StartGameButton object to accurately imitate the MultiplayerCharacterSelect example scene.

    Thank you greggtwep16 very much for the quick responses to such a blatant user error problem. Will definitely be recommending you guys to other Unity devs!
     
    Last edited: Mar 3, 2016
  28. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,502
    Not a problem, glad you figured it out.
     
  29. ahmidou

    ahmidou

    Joined:
    Sep 17, 2012
    Posts:
    79
    Hi,
    I'm using your asset on a project, and everything was going fine so far, until I found that I couldn't get it working in the built project (windows). It's working when playing in the editor so I belive I missed something but I can't figure out what :(
    Any idea?

    Thanks
    -A
     
  30. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,502
    Definitely will work in standalone. The easiest way to investigate is usually to look at the logs with "log verbose" checked on both ends. Are there any errors showing in the output log file from the standalone build?
     
  31. ahmidou

    ahmidou

    Joined:
    Sep 17, 2012
    Posts:
    79
    Everything seems fine server side, it's listening but it's not getting any communication.
    where can I find the client side log on my samsung S6?
     
  32. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,502
    On android it isn't a file, but rather gets logged to the logcat console. If you have eclipse or android studio installed simply open up the logcat window with your phone connected via usb. If you have neither installed you should be able to get logcat open from the command prompt by locating your android sdk install and using "adb logcat" when already connected to your phone.

    If you've never used this before, it's usually best to create a filter because you will by default get everything you're phone is logging which is a lot on android. That way you only see the Unity logging.
     
  33. ahmidou

    ahmidou

    Joined:
    Sep 17, 2012
    Posts:
    79
    Hi,
    I got adb working, but I'm not sure it's going to help a lot,
    and this what the device log look like:
    Code (CSharp):
    1. D/Unity   (29954):  GL_ARM_rgba8 GL_ARM_mali_shader_binary GL_OES_depth24 GL_OES_depth_texture GL_OES_depth_texture_cube_map GL_OES_packed_depth_stencil GL_OES_rgb8_rgba8 GL_EXT_read_format_bgra GL_OES_compressed_paletted_texture GL_OES_compressed_ETC1_RGB8_texture GL_OES_standard_derivatives GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_EGL_sync GL_OES_texture_npot GL_OES_vertex_half_float GL_OES_required_internalformat GL_OES_vertex_array_object GL_OES_mapbuffer GL_EXT_texture_format_BGRA8888 GL_EXT_texture_rg GL_EXT_texture_type_2_10_10_10_REV GL_OES_fbo_render_mipmap GL_OES_element_index_uint GL_EXT_shadow_samplers GL_OES_texture_compression_astc GL_KHR_texture_compression_astc_ldr GL_KHR_texture_compression_astc_hdr GL_KHR_debug GL_EXT_occlusion_query_boolean GL_EXT_disjoint_timer_query GL_EXT_blend_minmax GL_EXT_discard_framebuffer GL_OES_get_program_binary GL_OES_texture_3D GL_EXT_texture_storage GL_EXT_multisampled_render_to_texture GL_OES_surfaceless_context GL_OES_texture_stencil8 GL_EXT_shader_pixel_local_storag
    2.  
    3. D/Unity   (29954): e GL_ARM_shader_framebuffer_fetch GL_ARM_shader_framebuffer_fetch_depth_stencil GL_ARM_mali_program_binary GL_EXT_sRGB GL_EXT_sRGB_write_control GL_EXT_texture_sRGB_decode GL_KHR_blend_equation_advanced GL_OES_texture_storage_multisample_2d_array GL_OES_shader_image_atomic GL_EXT_robustness
    4.  
    5. I/Unity   (29954): Initializing Easy WiFi Controller...
    6.  
    7. I/Unity   (29954):
    8.  
    9. I/Unity   (29954): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
    10.  
    11. I/Unity   (29954):
    12.  
    13. I/Unity   (29954): Sending out client broadcast...
    14.  
    15. I/Unity   (29954):
    16.  
    17. I/Unity   (29954): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
    18.  
    19. I/Unity   (29954):
    20.  
    21. I/Unity   (29954): Client_Log:Sending out client broadcast...
    and server side log:

    Code (CSharp):
    1. <RI> Initializing input.
    2.  
    3. XInput1_3.dll not found. Trying XInput9_1_0.dll instead...
    4. <RI> Input initialized.
    5.  
    6. <RI> Initialized touch support.
    7.  
    8. UnloadTime: 0.870358 ms
    9. Initializing Easy WiFi Controller...
    10. UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
    11. UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
    12. UnityEngine.Logger:Log(LogType, Object)
    13. UnityEngine.Debug:Log(Object)
    14. EasyWiFi.Core.EasyWiFiController:initialize(String, String, Int32, Int32, Boolean, Boolean) (at E:\DIANA\DIANA_project\Assets\Easy WiFi Controller\Scripts\Core\EasyWiFiController.cs:109)
    15. EasyWiFiManager:Awake() (at E:\DIANA\DIANA_project\Assets\Easy WiFi Controller\Scripts\Core\EasyWiFiManager.cs:59)
    16. (Filename: E:/DIANA/DIANA_project/Assets/Easy WiFi Controller/Scripts/Core/EasyWiFiController.cs Line: 109)
    17.  
    18. listening for communication...
    19. (Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)


    while hitting play in the editor gives me client side:

    Code (CSharp):
    1.  
    2. 03-14 18:34:54.906: D/Unity(32371):  GL_ARM_rgba8 GL_ARM_mali_shader_binary GL_OES_depth24 GL_OES_depth_texture GL_OES_depth_texture_cube_map GL_OES_packed_depth_stencil GL_OES_rgb8_rgba8 GL_EXT_read_format_bgra GL_OES_compressed_paletted_texture GL_OES_compressed_ETC1_RGB8_texture GL_OES_standard_derivatives GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_EGL_sync GL_OES_texture_npot GL_OES_vertex_half_float GL_OES_required_internalformat GL_OES_vertex_array_object GL_OES_mapbuffer GL_EXT_texture_format_BGRA8888 GL_EXT_texture_rg GL_EXT_texture_type_2_10_10_10_REV GL_OES_fbo_render_mipmap GL_OES_element_index_uint GL_EXT_shadow_samplers GL_OES_texture_compression_astc GL_KHR_texture_compression_astc_ldr GL_KHR_texture_compression_astc_hdr GL_KHR_debug GL_EXT_occlusion_query_boolean GL_EXT_disjoint_timer_query GL_EXT_blend_minmax GL_EXT_discard_framebuffer GL_OES_get_program_binary GL_OES_texture_3D GL_EXT_texture_storage GL_EXT_multisampled_render_to_texture GL_OES_surfaceless_context GL_OES_texture_stencil8 GL_EXT_shader_pixel_local_storag
    3. 03-14 18:34:54.906: D/Unity(32371): e GL_ARM_shader_framebuffer_fetch GL_ARM_shader_framebuffer_fetch_depth_stencil GL_ARM_mali_program_binary GL_EXT_sRGB GL_EXT_sRGB_write_control GL_EXT_texture_sRGB_decode GL_KHR_blend_equation_advanced GL_OES_texture_storage_multisample_2d_array GL_OES_shader_image_atomic GL_EXT_robustness
    4. 03-14 18:34:55.426: I/Unity(32371): Initializing Easy WiFi Controller...
    5. 03-14 18:34:55.426: I/Unity(32371):
    6. 03-14 18:34:55.426: I/Unity(32371): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
    7. 03-14 18:34:55.436: I/Unity(32371): Sending out client broadcast...
    8. 03-14 18:34:55.436: I/Unity(32371):
    9. 03-14 18:34:55.436: I/Unity(32371): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
    10. 03-14 18:34:55.446: I/Unity(32371): Client_Log:Sending out client broadcast...
    11. 03-14 18:34:55.446: I/Unity(32371):
    12. 03-14 18:34:55.446: I/Unity(32371): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
    13. 03-14 18:34:55.476: I/Unity(32371): Recieved Server Broadcast Response... Broadcast_ServerResponse:192.168.0.101
    14. 03-14 18:34:55.476: I/Unity(32371):
    15. 03-14 18:34:55.476: I/Unity(32371): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
    16. 03-14 18:34:55.476: I/Unity(32371): Client_Log:Recieved Server Broadcast Response... Broadcast_ServerResponse:192.168.0.101
    17. 03-14 18:34:55.476: I/Unity(32371):
    18. 03-14 18:34:55.476: I/Unity(32371): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
    19. 03-14 18:34:55.516: I/Unity(32371): Sending out client Inventory...Client_Inventory:192.168.0.102:Button#wink_in,Button#Expression2,Button#fear,Button#pointFinger_in,Button#stupid_in,Button#raisingHand_in,Button#Pose6,Button#trueHappyness,Button#Expression3,Button#applauding_in,Button#surprise,Button#raisingPunch_in,Button#scratching_in,Touchpad#Glitch,Button#Pose1,Button#showPhone_in,Button#no_in,Button#Expression1,Button#Expression4,Button#yes_in,Button#showBoard_in,Button#think_in,Button#cocky_in,Button#question_in,Button#wavingHand_in,Button#kiss,Button#laugh_in,Button#Pose8,Button#seductive_in,
    20. 03-14 18:34:55.516: I/Unity(32371):
    21. 03-14 18:34:55.516: I/Unity(32371): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
    22. 03-14 18:34:55.516: I/Unity(32371): Client_Log:Sending out client Inventory...Client_Inventory:192.168.0.102:Button#wink_in,Button#Expression2,Button#fear,Button#pointFinger_in,Button#stupid_in,Button#raisingHand_in,Button#Pose6,Button#trueHappyness,Button#Expression3,Button#applauding_in,Button#surprise,Button#raisingPunch_in,Button#scratching_in,Touchpad#Glitch,Button#Pose1,Button#showPhone_in,Button#no_in,Button#Expression1,Button#Expression4,Button#yes_in,Button#showBoard_in,Button#think_in,Button#cocky_in,Button#question_in,Button#wavingHand_in,Button#kiss,Button#laugh_in,Button#Pose8,Button#seductive_in,
    23. 03-14 18:34:55.516: I/Unity(32371):
    24. 03-14 18:34:55.516: I/Unity(32371): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
    25. 03-14 18:34:55.536: I/Unity(32371): Received Server's Inventory Response... Inventory_ServerResponse:192.168.0.102wink_in#wink_in,192.168.0.102Expression2#Expression2,192.168.0.102fear#fear,192.168.0.102pointFinger_in#pointFinger_in,192.168.0.102stupid_in#stupid_in,192.168.0.102raisingHand_in#raisingHand_in,192.168.0.102Pose6#Pose6,192.168.0.102trueHappyness#trueHappyness,192.168.0.102Expression3#Expression3,192.168.0.102applauding_in#applauding_in,192.168.0.102surprise#surprise,192.168.0.102raisingPunch_in#raisingPunch_in,192.168.0.102scratching_in#scratching_in,192.168.0.102Glitch#Glitch,192.168.0.102Pose1#Pose1,192.168.0.102showPhone_in#showPhone_in,192.168.0.102no_in#no_in,192.168.0.102Expression1#Expression1,192.168.0.102Expression4#Expression4,192.168.0.102yes_in#yes_in,192.168.0.102showBoard_in#showBoard_in,192.168.0.102think_in#think_in,192.168.0.102cocky_in#cocky_in,192.168.0.102question_in#question_in,192.168.0.102wavingHand_in#wavingHand_in,192.168.0.102kiss#kiss,192.168.0.102laugh_in#laugh_in,192.168.0.102Pose8#Pose8,192.168.0.102s
    26. 03-14 18:34:55.536: I/Unity(32371): Client_Log:Received Server's Inventory Response... Inventory_ServerResponse:192.168.0.102wink_in#wink_in,192.168.0.102Expression2#Expression2,192.168.0.102fear#fear,192.168.0.102pointFinger_in#pointFinger_in,192.168.0.102stupid_in#stupid_in,192.168.0.102raisingHand_in#raisingHand_in,192.168.0.102Pose6#Pose6,192.168.0.102trueHappyness#trueHappyness,192.168.0.102Expression3#Expression3,192.168.0.102applauding_in#applauding_in,192.168.0.102surprise#surprise,192.168.0.102raisingPunch_in#raisingPunch_in,192.168.0.102scratching_in#scratching_in,192.168.0.102Glitch#Glitch,192.168.0.102Pose1#Pose1,192.168.0.102showPhone_in#showPhone_in,192.168.0.102no_in#no_in,192.168.0.102Expression1#Expression1,192.168.0.102Expression4#Expression4,192.168.0.102yes_in#yes_in,192.168.0.102showBoard_in#showBoard_in,192.168.0.102think_in#think_in,192.168.0.102cocky_in#cocky_in,192.168.0.102question_in#question_in,192.168.0.102wavingHand_in#wavingHand_in,192.168.0.102kiss#kiss,192.168.0.102laugh_in#laugh_in,192.168.0.102Pose8#Pose8,192
    27. 03-14 18:34:55.596: I/Unity(32371): Sending controller data... Client_ControllerData:0:192.168.0.102wink_in#0
    28. 03-14 18:34:55.596: I/Unity(32371): 192.168.0.102Expression2#0
    29. 03-14 18:34:55.596: I/Unity(32371): 192.168.0.102fear#0
    30. 03-14 18:34:55.596: I/Unity(32371): 192.168.0.102pointFinger_in#0
    31. 03-14 18:34:55.596: I/Unity(32371): 192.168.0.102stupid_in#0
    32. 03-14 18:34:55.596: I/Unity(32371): 192.168.0.102raisingHand_in#0
    33. 03-14 18:34:55.596: I/Unity(32371): 192.168.0.102Pose6#0
    34. 03-14 18:34:55.596: I/Unity(32371): 192.168.0.102trueHappyness#0
    35. 03-14 18:34:55.596: I/Unity(32371): 192.168.0.102Expression3#0
    36. 03-14 18:34:55.596: I/Unity(32371): 192.168.0.102applauding_in#0
    37. 03-14 18:34:55.596: I/Unity(32371): 192.168.0.102surprise#0
    38. 03-14 18:34:55.596: I/Unity(32371): 192.168.0.102raisingPunch_in#0
    39. 03-14 18:34:55.596: I/Unity(32371): 192.168.0.102scratching_in#0
    40. 03-14 18:34:55.596: I/Unity(32371): 192.168.0.102Glitch#0,0,0
    41. 03-14 18:34:55.596: I/Unity(32371): 192.168.0.102Pose1#0
    42. 03-14 18:34:55.596: I/Unity(32371): 192.168.0.102showPhone_in#0
    43. 03-14 18:34:55.596: I/Unity(32371): 192.168.0.102no_in#0
    44. 03-14 18:34:55.596: I/Unity(32371): 192.168.0.102Expression1#0
    45. 03-14 18:34:55.596: I/Unity(32371): 192.168.0.102Expression4#0
    46. 03-14 18:34:55.596: I/Unity(32371): 192.168.0.102yes_in#0
    47. 03-14 18:34:55.596: I/Unity(32371): 192.168.0.102showBoard_in#0
    48. 03-14 18:34:55.596: I/Unity(32371): 192.168.0.102think_in#0
    49. 03-14 18:34:55.596: I/Unity(32371): 192.168.0.102cocky_in#0
    50. 03-14 18:34:55.596: I/Unity(32371): 192.168.0.102question_in#0
    51. 03-14 18:34:55.596: I/Unity(32371): 192.168.0.102wavingHand_in#0
    52. 03-14 18:34:55.596: I/Unity(32371): 192.168.0.102kiss#0
    53. 03-14 18:34:55.596: I/Unity(32371): 192.168.0.102laugh_in#0
    54. 03-14 18:34:55.596: I/Unity(32371): 192.168.0.102Pose8#0
    55. 03-14 18:34:55.596: I/Unity(32371): 192.168.0.102seductive_in#0
    56. 03-14 18:34:55.596: I/Unity(32371):
    57.  
    for the server side log see the picture
    Thanks
     

    Attached Files:

    • log.PNG
      log.PNG
      File size:
      55 KB
      Views:
      318
    Last edited: Mar 14, 2016
  34. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,502
    The two ends don't see each other at all on the standalone logs you showed (editor was fine just like you said). The most likely culprit is windows firewall. Normally, when a new program in windows asks for a connection the first time you get a popup like below (minus the name will be your standalone app).

    Untitled.jpg

    There is no real difference between a standalone build and the editor as far as EWC is concerned, but while you have most likely unblocked unity (same popup usually occurs when you run unity the first time), you might not have for your new standalone build. I don't think it's another item like a router or other firewall that's the issue because the editor on the same machine works. Most likely it's windows firewall. Usually it does pop up the first time you run an app but I have had instances where it didn't and since block is the default it won't work if the firewall is in the way.

    Did this popup for you and you unblocked it the first time you ran the standalone build? If not the first place I would investigate is windows firewall and either click unblock when the popup occurs or manually unblock your standalone build in its settings.
     
  35. ahmidou

    ahmidou

    Joined:
    Sep 17, 2012
    Posts:
    79
    That was it! I'm using a 3rd party firewall in automatic mode so it never asked me about it and just blocked it.
    Would it be possible to add that information to the documentation, or a FAQ?
    Anyway thanks for the help!

    Cheers
    -A
     
  36. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,502
    Sure thing. I'll update the included documentation with the next update push to the store. Glad you got it working.
     
  37. johnchoi313

    johnchoi313

    Joined:
    Jan 19, 2015
    Posts:
    8
    Hi greggtwep16,

    I recently purchased the Easy WiFi Controller Asset, but the server (on the PC) is always stuck on "listening for communication..." when trying to control the demo examples with my Android Phone. It does work however with the server and the client on the same machine as two separate executables. I checked that the Android app has full network permissions, but to no effect. Any ideas what I did wrong?

    Thanks,
    John C.
     
  38. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,502
    Assuming you're running one of the unedited pair of demo scenes (presumably the client version on the phone and the server version on the computer), there are only a couple of things that can get in the way.

    1. If you have a firewall setup in your router than has a port that needs to be open (not common for internetwork communication unless you are in a more secured location like a workplace)
    2. If you have windows firewall or another software firewall on the windows machine that you haven't unblocked the application(this is common on windows that you need to unblock the first time its run from the popup window, and I don't think it would block localhost traffic for your other test)
    3. If you are using a phone as a wifi hotspot to provide the wifi, it's important to note that not all phones actually join the wifi they create. Some do but most don't (meaning 2 other devices on the hotspot would be able to play, but not the phone creating the hotspot).

    If you can post the logs from both sides it would be helpful to try and find the issue. On the windows side are you trying on a standalone build or in the editor?
     
  39. johnchoi313

    johnchoi313

    Joined:
    Jan 19, 2015
    Posts:
    8
    Thanks for the quick reply!

    On the Windows side I tried both the editor and a standalone build. I have added the Unity editor as well as the standalone build to the list of firewall exceptions.

    The Windows log isn't very helpful, but I've attached an image of it regardless.
    As for the phone, I'm not sure how to see its log?
     

    Attached Files:

  40. johnchoi313

    johnchoi313

    Joined:
    Jan 19, 2015
    Posts:
    8
    Edit: Oops, you probably meant the output_log.txt files.
    I've attached them for your perusal. (Note: output_log(Client).txt was with using the client on a desktop. I'm still not sure how to get the log from the Android device?)

    If you aren't seeing any issues with the logs, I suppose this can only mean that I "have a firewall setup in my router than has a port that needs to be open (not common for internetwork communication unless you are in a more secured location like a workplace)". I suppose this would make sense in a university setting...
     

    Attached Files:

  41. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,502
    Universities can be tricky it all depends on the setup. It was awhile ago but where I went to university, some of the dorms had pretty strict settings to prevent some p2p sharing (mostly videos), but other dorms didn't. It seemed to vary widely. Certain universities do run them more like a corporate environment, with firewalls in between the various wifi routers in the dorms. No way to know for sure unless you know the universities administrator of the network.

    The output logs you posted for on the same machine are normal but that's to be expected since you mentioned it works. The editor log for when you test from your phone shows that the server never receives the phones communication. The client logs would be helpful (you can get this from logcat on android) but I have a feeling it will be broadcasting just fine and its a firewall or something in the middle that is preventing the connection.

    Do you or any of your friends at university have a phone capable of creating a hotspot that you could borrow for a few minutes? You could then have your phone and your PC connect to that separate wifi hotspot and see if that works. It would at least let you know for sure if it's universities network getting in the way or something else (this is what I would be leaning to at the moment).

    If we do narrow it down and it is the network perhaps you could try changing the port numbers to some well known ones that aren't likely blocked. This wouldn't be ideal since other traffic might interfere but it would at least get through to have it work.
     
  42. johnchoi313

    johnchoi313

    Joined:
    Jan 19, 2015
    Posts:
    8
    I've tested out your suggestion using the WiFi Hotspot and it worked without any issues. I guess this proves that there must be something in the university's router blocking the transmission.

    That being said, you also mentioned I could try changing the port numbers to some well known ones that aren't likely blocked. Can you recommend me some port numbers?
     
  43. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,502
    The well known ports that have other designated purposes are the most likely to not be blocked. Port 80 is usually used for web traffic, port 21 is usually used for FTP, port 25 for SMTP, port 23 for telnet, etc. You could try changing the server socket port and client socket port in the inspector to a pair of those. It's not ideal for latency but they are the most likely to not be blocked.

    Otherwise usually with a pair of windows machines (yours and a friends) there are some port scanning applications that can be found on google (no idea if they are free) that you could run a scan on all ports to see if your college network administrator has left any open by mistake that don't have a normal designated purpose and then use those. EWC will perform better if its on its own port and not sharing traffic with other data (like the web traffic of your whole dorm) but sometimes in a locked down environment you have to make due, unless by any chance you know the administrator and can convince him to open up a pair of ports.

    Also, it's best to read your universities code of conduct as well. You and a few of your friends using EWC aren't going to flood the network, but sometimes things catch on. If you had a lot of these going on all the floors of the dorm it will most likely bring the network to a screeching halt and you might get noticed after causing a very busy day for the network admin. The last thing you'd want to do is get in trouble at university.

    Hope that helps and best of luck!
     
    Last edited: Mar 18, 2016
  44. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,502
    One other suggestion as well, EWC works in network and doesn't need internet. If you can't get any of the above to work and the network is fully locked down, you can certainly get a router dirt cheap and use that. It doesn't need to be hooked up to the internet, it just needs to have the devices connect to it for playing/testing your game.
     
  45. johnchoi313

    johnchoi313

    Joined:
    Jan 19, 2015
    Posts:
    8
    I tried out the router option, and it works like a charm. I'll probably stick with it as I don't want to take the chance of mucking up the university's internet.
    Thanks for all your help!
     
  46. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,502
    :). Glad you found a solution! Enjoy the product!
     
  47. ahmidou

    ahmidou

    Joined:
    Sep 17, 2012
    Posts:
    79
    Hello,
    So I have that simple UI with a grid of buttons, and the user can eventually do multitouch.
    What's happening in my case is when touching 2 or 3 buttons at the same time, it's also triggering the
    button at the average position of the ones activated.

    Is there a way to avoid that?

    Thanks
    -A
     
  48. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,502
    Below is the relevant code snippet (it does loop through all the touches) for the buttons provided in EWC.

    Code (CSharp):
    1. //touch somewhere on control
    2. if (touch.position.x >= screenPixelsRect.x &&
    3.       touch.position.x <= (screenPixelsRect.x + screenPixelsRect.width) &&
    4.       touch.position.y >= screenPixelsRect.y &&
    5.       touch.position.y <= (screenPixelsRect.y + screenPixelsRect.height))
    6. {
    7.       pressed = true;
    8. }
    As you can see it's simply checking for a touch between the x and y coordinates of each individual button (including if you have transparent corners). Assuming your buttons are far enough apart where they don't overlap (can be verified in the scene view there is a faint white rectangle around the image bounds), it isn't this code that would be causing the behavior you describe. That being said some devices (usually android) actually have a limit to the number of touches supported. If you exceed the number of touches it will actually act like you are pressing exactly in the center (average) of the two presses. Those phones that do this it is at the hardware level and there wouldn't be a way around (although it is certainly not all phones). What is your make/model?
     
  49. ahmidou

    ahmidou

    Joined:
    Sep 17, 2012
    Posts:
    79
    Hi,
    thanks for the detailed explanation, I have a Samsung Galaxy S6 and it's happening from 2 simultaneous touchs .

    Cheers
    -A
     
  50. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,502
    If it's a samsung galaxy s6 then this wouldn't be the issue (it's usually older android phones that were barely multitouch). I'm unable to reproduce this locally though on any of the phones I use. The s6 should support up to 10 distinct touches.

    That being said there is a point on almost all hardware if the touches are too close together where they will behave as one touch (like if you pinch/zoom all the way closed). Also the bounding boxes of the images matter quite a bit that they aren't overlapping. Can you post a screenshot in editor with the buttons and their bounding boxes? Also, which controls are these I've tested all buttons locally was it a combination?