[Plugin] AirConsole - local multiplayer for your game

0 favourites
From the Asset Store
The I18N (Translation) is a Construct plugin created to translate text in game.
  • I need help please. I do not get to operate the controller. The game loads on the computer screen, however I copied the following code in a file controller.html and the driver does not appear in the device:

    <html>

    <head>

    <!--<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0"/>-->

    <meta name="viewport" content="user-scalable=yes"/>

    <style type="text/css">

    html, body {

    height: 100%;

    overflow: hidden;

    }

    body {

    background-color: #222;

    }

    button {

    margin-bottom: 1px;

    width: 48%;

    height: 48%;

    border: 0;

    box-sizing: border-box;

    font-size: 40px;

    color: #FFFFFF;

    background-color: #333333;

    outline: none;

    }

    </style>

    </head>

    <body>

    <div style="width:100%;float:left;">

    <button id="leftup">UP</button>

    <button id="rightup">UP</button>

    </div>

    <body>

    <div style="width:100%">

    <button id="leftdown">DOWN</button>

    <button id="rightdown">DOWN</button>

    </div>

    <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>

    <script type="text/javascript" src="https://www.airconsole.com/api/airconsole-1.3.0.js"></script>

    <script type="text/javascript">

    var air_console = new AirConsole();

    // Let the screen know we are here

    var sendHandshake = function() {

    air_console.message(AirConsole.SCREEN, {

    handshake: true

    });

    };

    air_console.onReady = function() {

    sendHandshake();

    };

    air_console.onMessage = function(device_id, data) {

    if (data.handshake) {

    sendHandshake();

    }

    };

    var down_event = isMobile() ? 'touchstart' : 'mousedown';

    var up_event = isMobile() ? 'touchend' : 'mouseup';

    $("#leftup").on(down_event, function () {

    air_console.message(AirConsole.SCREEN, {

    message: 'leftup'

    });

    });

    $("#leftdown").on(down_event, function () {

    air_console.message(AirConsole.SCREEN, {

    message: 'leftdown'

    });

    });

    $("#leftup").on(up_event, function () {

    air_console.message(AirConsole.SCREEN, {

    message: 'leftstop'

    });

    });

    $("#leftdown").on(up_event, function () {

    air_console.message(AirConsole.SCREEN, {

    message: 'leftstop'

    });

    });

    $("#rightup").on(down_event, function () {

    air_console.message(AirConsole.SCREEN, {

    message: 'rightup'

    });

    });

    $("#rightdown").on(down_event, function () {

    air_console.message(AirConsole.SCREEN, {

    message: 'rightdown'

    });

    });

    $("#rightup").on(up_event, function () {

    air_console.message(AirConsole.SCREEN, {

    message: 'rightstop'

    });

    });

    $("#rightdown").on(up_event, function () {

    air_console.message(AirConsole.SCREEN, {

    message: 'rightstop'

    });

    });

    /**

    * Returns true if device is a mobile device

    * {Boolean}

    */

    function isMobile() {

    if (navigator.userAgent.match(/Android/i) ||

    navigator.userAgent.match(/iPhone/i) ||

    navigator.userAgent.match(/iPad/i) ||

    navigator.userAgent.match(/iPod/i) ||

    navigator.userAgent.match(/BlackBerry/i) ||

    navigator.userAgent.match(/Windows Phone/i) ||

    navigator.userAgent.match(/Opera Mini/i) ||

    navigator.userAgent.match(/IEMobile/i)) {

    return true;

    } else {

    return false;

    }

    };

    </script>

    </body>

    </html>

    How do I have to create the driver?

    Thank you.

  • iherwis

    Sorry, you will have to code a little bit if you want to make a controller.

    In the same directory of your web-exported construct2 files, create a controller.html

    There are some examples at: github.com/AirConsole/airconsole-controls

    DatapawWolf

    the plugin is currently being updated and showing ads will follow soon

  • amariscal I don't understand what you mean with "driver". Can you please elaborate?!

  • FraConsole,

    Kudos to the AirConsole team for pulling everything together! My students are looking forward to entering the student competition in December, and I just received the blog post about requiring the 1.6 API so that people don't have to buy a premium account to play our game. I was hoping we could start pulling everything together next week (Thanksgiving here in the US) so that we could do play testing and final artwork. Along with this we were hoping to not have to worry about changing the code after next week.

    Any idea when the new version of the plugin will be available that is compliant with the 1.6 API? Any chance it will be by next week? If not, its not the end of the world, but we were hoping to get everything wrapped up before the December 15th deadline.

    In any case, here is what we have so far. Thanks to QuaziGNRLnose for the incredible Q3D plugin, and the AirConsole team for making an awesome way to play multiplayer!

    https://www.airconsole.com/#https://dl. ... irconsole/

    PS - Join with as many devices as you can, wait for the 3-minute timer to run out, and watch the AI take over. We aren't planning to include any limits on the number of devices that can join the game. So far we have tried it with a room full of 15 robotics club team members. Way better than a 4-player console game -- Total Robot Mayhem! <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

  • The AirConsole plugin got updated to API 1.6.0 adding ads support, AirConsole team just merged my Github pull request.

    Don't forget that implementing ads in your games is due for February 2017

    Added in version 1.4.4

    • Update to API 1.6.0 don't forget to update your controller.html api link!
    • New conditions:
      • OnAdComplete - Trigger - Triggered when showing ads is finished - Use it to unmute your sounds per exemple
      • OnPremium - Trigger - Triggered when a premium device joins or a device gets premium - Use for special cases for premium, premium don't get ads per exemple
    • New actions:
      • ShowAd - Displays adds on screen and controllers. Triggers OnAdComplete when done
    • New expressions:
      • IsPremiumJoin - Returns 1 if the last controller that joined is premium, else 0
      • IsPremiumMessage - Returns 1 if the last controller that sent a message is premium, else 0
      • IsPremium(deviceId) - Returns 1 if the deviceId is premium, else 0
    • Reordering expressions by using categories

    Check it out on Github:

    Official AirConsole repo: https://github.com/AirConsole/airconsole-construct2

    My fork: https://github.com/Psychokiller1888/airconsole-construct2

    Feel free to contact me for additions, missing parts etc etc

  • Awesome work, thanks Psychokiller1888

  • Version 1.4.5 available on my fork https://github.com/Psychokiller1888/air ... construct2

    Adding NavigateHome : Requests all devices to open AirConsole store

    Adding NavigateTo: Requests all devices to load a game by url

  • Version 1.4.5 got merged on official sources, but I must apology to all users, I messed up isPremiumJoin and isPremiumMessage by misspelling the variables (and not being at home using my editor I did not notice). Just saw that today when starting the whole in PhpStorm that warned me about unsued variables. A pull request for fix is waiting, for those that can't wait, the fix is available on my repo

    EDIT

    For clarity, this does just touch expressions and not triggers/conditions

  • I commited, on my repo, a new branch that adds support for real messages with complex structures as the controller generator does generate

    https://github.com/Psychokiller1888/air ... MessageKey

    If anybody wants to try it out and maybe return the experience I'd be glad. Be aware this is experimental and subject to changes, that's why it's commited on a separate branch!

    This allows, per exemple, messages sent like

    airConsole.message(AirConsole.SCREEN, {
      rejoin: "12345",
      name: "Psycho",
      age: "hmmm",
      country: "Switzerland",
      controls: {
        dpad: true,
        buttons: true,
        swipe: false,
        joystick: false
      }
    });
    [/code:251zjsb1]
    
    It is recursive. Getting the data is made through AirConsole.GetMessageProperties. Load a C2Dictionary with it
    
    [img="https://puu.sh/sKnHH.png"]
  • My pull request just got merged and introduces, in my opinion, more advanced functions to the plugin. Let me explain you the changes:

    AirConsole version 1.4.6

    • Conditions
      • OnMessageKey - Trigger - Depracated. This method wasn't really doing what it should have be doing. This is flagged as deprecated, so you cannot use it anymore but your projects using it should load just fine and still work
      • OnMessageKey - Trigger - Triggered when any message comes in with a different key than 'message'
      • OnMessageKeyIs - Trigger - Triggered when a message comes in with only one property and that property is what you are waiting for
      • OnMessageKeysContain - Trigger - Triggered when a message comes in and its properties contain the specified key
    • Expressions
      • GetMessageProperties - Returns all the properties that were sent in the last message in the form of a C2Dictionary
      • GetMessageProperty - Returns the specified property value
      • GetMessagePropertiesCount - Returns the number of properties set in the last message
      • IsMessagePropertySet - Returns 1 if the last message had the specified property set, else 0

    This might get a bit confusing, so here is a link to the pull request and all the screenshots I did back then: https://github.com/AirConsole/airconsol ... t2/pull/18

    Some images

    Most important is that GetMessageProperties is full recursive and now supports the actual controller generator for AirConsole as complexe messages are now supported. So there is no problem sending messages like:

    airConsole.message(AirConsole.SCREEN, {
      dpad: true,
      swipe: false,
      nickname: "Psycho",
      options: {
        sound: "mute",
        vfx: 10,
        privacy: {
          world: true,
          region: true,
          city: false,
        }
      }
    });
    [/code:1xyfqgio]
    
    are easily captured and read by something like (make 'subList' be 'options' and 'subSubList' be 'privacy' <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink"> ):
    [img="https://puu.sh/sMVRr.png"]
    
    As always, download the plugin on the official chanel:
    [url=https://github.com/AirConsole/airconsole-construct2]https://github.com/AirConsole/airconsole-construct2[/url]
    
    Or on my repo if you want access to my latest additions not yet merged:
    [url=https://github.com/Psychokiller1888/airconsole-construct2]https://github.com/Psychokiller1888/air ... construct2[/url]
    
    [b]Coming next[/b]
    [ul]
    [li]Complete support for highscore and reading data[/li]
    [li]Persistant data support[/li][/ul]
    
    [b]Happy new year to you all![/b]
    
    And again, I'm not working for N-Dreams, I'm just coding for fun and they do appear to appreciate that I pull request all these changes. Still, you can pm me if you have any questions about the plugin.
  • BUG? FraConsole

    Psychokiller1888

    After installing the official plugin this problem jumps:[quote:2efqraxc]

    ---------------------------

    Construct 2 Check failure

    ---------------------------

    Check failure! This is probably a bug:

    ACE table: expression does not specify one return flag - did you specify more than one, or forget it entirely?

    Condition: return_flags == 1

    File: c:\c2\source\exporters\html5\..\..\common\ERAHelpers.h

    Line: 285

    Function: void __cdecl era::ACETable::AddExpression(int,int,const class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > &,const class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > &,const class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > &,const class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > &,void (__cdecl *)(const class era::StaticResult **,int,class era::StaticEvaluation *))

    Build: release 241 (64-bit) checked

    Component: HTML5 exporter

    (Last Win32 error: 0)

    You are using a 'checked' release of Construct 2, intended for testing, which causes certain errors to be reported this way. Hit Ctrl+C to copy this messagebox - it's useful information for the developers, so please include it with any bug reports! Click 'Abort' to quit (unsaved data will be lost!),'Retry' to turn off messages for this session and continue, or 'Ignore' to continue normally.

    The first thing that i can see is that this is looking for C:\c2\ and that doesn't exists, i dont have construct there...

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • And more errors:

  • From where did you install? I can't repro that. I did download the plugin from the main git, install it to overwrite my own dev one, close and ran C2 again, nothing there. Then as your logs do speak about exporting which doesn't seem to be as you say directly after installing the plugin, I did try to export the project, I didn't get anay C2 error. Concerning the second topic, these are Webgl errors and not plugin errors, as for the slow connection that's C2's problem, most prolly because you switched window? They are not real errors as long asthey don't keep coming when you go back to the game

  • All I have implemented persistent data support as well as completed highscores support on my github fork

    https://github.com/Psychokiller1888/air ... construct2

    Data is as always parsed to a C2Dictionary, JSON string is retrievable by the according Expression (Airconsole.PersistentData and AirConsole.Highscores).

    Would be glad if some could give it a shot and report back to me for eventual problems before I pull request to the offical github repo

  • i did a clean install using Beta 241 and the problem is in this plugin. That error jumps up when installing the plugin. looks like the plugin keeps working but there is that warning.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)