cjbruce's Forum Posts

  • Hi everyone,

    I've tried the AirConsole plugin (downloaded yesterday from github), but it doesn't work with more than 1 player.

    I did the following :

    - exported the Pong example (HTML5, embed style), renamed "index.html" to "screen.html", added the provided "controller.html" file

    - ran my game from AirConsole (address looks like : http://www.airconsole.com/?http=1#http: ... e-game-is/) on Firefox

    - added 2 controllers one after the other (a phone and a tablet)

    The game and the 2 controllers display correctly and start running. Two player icons (one for each controller) appear on the AirConsole bar, on top of the game. The following messages appear on Firefox console (among some WebGL errors) : "WebRTC active for device_id 1" then "WebRTC active for device_id 2".

    However, only one player (the first who joined the game) can actually play and only the red paddle on the left appears. It seems like the "On device join" event only triggers once, no matter in which order the controllers join the game.

    I didn't modify any of the provided files, and I'm running Construct 2 r239.

    So how could I get this to work?

    Zoglu, I don't know if you found a fix for this yet, but have you tried setting the AirConsole maximum number of players to something greater than 1 in the editor?

    I just realized this myself after 2 months of extremely convoluted development because only 2 devices were triggering the "On Device Joined" condition.

    In the end, I set the max players to 99 so that I could detect when an unlimited number of players have joined, then sent a "Too many players" message to any device that joins after my in-game player limit of 8 players has been reached.

  • The only problem is that, it works if your Q3DMaster camera position is static. You'll have to account/calculate the new screen space manually when the camera moves, which I guess you're probably already aware of

    fuego96, thanks for looking into this! I do have a camera that pans around, changes direction, and moves in and out to follow the characters, so I was having a tough time determining what the .xw and .yw expressions were actually giving me. Maybe when I'm done with this project I'll take another crack at the math.

  • > ...Does anyone have a quick and easy way to map 3D space to the 2D screen so that I can label the players?

    >

    > Here's what I am looking to do:

    >

    >

    >

    cjbruce Q3D has a V-2.2 example called "Position & Rotation actions.capx" which should serve your needs.

    https://dl.dropboxusercontent.com/u/82947809/Q3D_Release_Examples/Q3D_V_2_2_Examples.zip

    Thanks for the link! I've been through the examples, and don't see how this helps. I've tried all of the expressions and haven't been able to find any expressions that map 3D screen space (x,y,z, with a perspective camera) to the 2D screen (x,y in flat screen space).

    I suspect that there is a linear algebra transformation that I'm not thinking of that will do the trick, but I can't seem to get anything to work.

  • Has anyone been able to successfully texture a Q3DModel with the Paster plugin? I'm looking to dynamically write text on a model (loading the player's nickname at runtime, then pasting their nickname onto a model). I've tried the following so far, none of which work:

    Q3DModel -> Set Diffuse Map texture to Paster.imageURL (does not load the texture)

    and

    Q3DMaster -> *** TEXTURES / CREATE Create texture "nickname" using image file Paster.imageURL

    Q3DModel -> Set Diffuse Map texture to "nickname" (gives an error stating that the image file has not been loaded yet or does not exist at all)

    I've been able to successfully texture a Q3DSprite this way:

    Q3DSprite -> Load image from Paster.imageUrl (Resize to image size).

  • Psychokiller1888

    We are trying to stay up-to-date on the AirConsole Construct 2 plugin, and are working as a team across multiple computers. We have all downloaded the AirConsole plugin from github at various times. On one of the computers we are getting the following error, and are unable to use the project file. Is this something that is an easy fix?

  • ishmaelmoreno You are welcome! I'm glad it helps. We're big fans of the AirConsole platform at our school, and the better the games are, the better the experience for everyone.

  • Anyone have a smart/easy way to track a 3d object in cam/screen space?

    I'm wanting to basically do this..

    http://zachberry.com/blog/tracking-3d-o ... -three-js/

    With a standard C2 Sprite, tracking a moving Q3D Object.

    edit --

    ah I see this has been discussed a little..

    Page 167 - QuaziGNRLnose said--

    [quote:13x18o6c]for the 2D/3D projection thing, there's no built-in method to get the view-space coordinates or projection matrix. Generally that's supposed to be what you use Q3D sprite for.

    If you know javascript/sdk you can modify Q3D easily enough to give you what you need, just look at the tick2 function for Q3D bone where the debug text is displayed and you can add some new expressions that use a similar process. I'll look into adding it for the final update i'll do, but no word on how long that'll be.

    If anyone has done this already, please pm me. Otherwise I'll be having a go at it myself..

    Incidentally, the specific reason I want this, rather than just using the Q3DSprite, is that my Q3DRendering is being done at a lower resolution than my C2 Layouts. I want my HUD overlay to be super crisp, while my Q3DMaster is fine at a lower resolution.

    I am curious about mapping Q3D objects to the 2D screen space as well. I am submitting a game to AirConsole, and one of their requirements is to show the nicknames of the players onscreen as text, rather than pre-rendered images. Right now I am using a Q3D sprite with pre-rendered text, but I need to be able change the text at runtime. The players are rendered in 3D, but there is no Q3D text, so I would like to use a standard Construct 2 Text object overlaid on the screen.

    Does anyone have a quick and easy way to map 3D space to the 2D screen so that I can label the players?

    Here's what I am looking to do:

  • So we just submitted our game for the 2016 student competition (due today). It was a learning experience for all of us, but one of the biggest challenges we faced was how to use smartphones to control a fast-paced action game.

    This is a summary of the iterations we had to go through:

    1. D-pad with proportional control, sending D-pad position to the screen every 0.1 seconds. This turned out to be completely unplayable due to lag and the fact that your thumb was never where you thought it was.

    2. D-pad with binary control (up-down-left-right-diagonal), sending data every 0.1 seconds. This was playable, but suffered from a ton of lag.

    3. D-pad with binary control, sending data only when the buttons changed. This was WAY more playable, but the buttons were too small, and it was hard to tell where your thumb was.

    4. Left Thumb: up/down. Right Thumb: left/right. This worked really well, but we lost the ability to control primary/secondary weapons. We then had to redesign the game mechanics so that the primary weapon was always on. We still had no way to do a secondary weapon, and we needed a way for people to self-destruct if they had lost all mobility.

    5. Left thumb: forward/self-destruct. Right thumb: left/right. In order to get this to work, we had to totally change the mechanics to eliminate the ability to drive backward, and add an "automatic flipping" feature to the physics engine so that players could always get out of a bad situation.

    The bottom line is that you can't treat an AirConsole game like a regular console game, where designing the controller is secondary. You have to design for a flat touchscreen first, then adjust your game mechanics as necessary so that everything works.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ,

    Zombie Annihilation is great! We did a few playthroughs on AirConsole, and it is a great way to completely zone out for a bit.

  • > Is the simulator working for you?

    >

    FYI: I have updated AC plugin and linked newest AC library to the controller and simulator worked straight away for me with my old project.

    You can see it here:

    https://puu.sh/sksDF/69c6b4673d.png

    https://puu.sh/skszs/5daa0dda91.jpg

    Nice work! Can I assume based on what I see here that you built the controller.html in Construct 2 as well?

    If so, does it all go in the same Construct 2 project? Or did you have two separate projects and somehow change the generated C2 javascript code to look in a different directory for the controller.html files versus the screen.html files?

  • 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">

  • Hey

    Thanks for the answer yet I don't seem to be able to make it work . Here is how am trying this out

    I don't have anything written in the textbox. How weird is that hé ?

    Khelben,

    I'm seeing a problem triggering AirConsole events in Construct 2 as well. "On message is ____ and from _____" doesn't trigger if I am looping through all of the device IDs. Instead, I was able to detect the messages by using two System "Compare Two Variables" conditions, one to check AirConsole.DeviceID, and another condition to check AirConsole.message. I have attached a screenshot of the working event sheet below:

  • There you go. I was planning to make some tutorials for C2 and AirConsole, but really can't find the time recently so hopefully some code snippets will help you a bit.

        var gameplayScreen_joystick = new Joystick("joystick", {
    
            "touchstart": function () {
                airconsole.message(AirConsole.SCREEN, {
                    "message": '{"c2dictionary":true,"data":{"action":"joystick_start"}}'
                });
            },
    
            "touchmove": function (position) {
                rateLimiter.message(AirConsole.SCREEN, {
                    "message": '{"c2dictionary":true,"data":{"action":"joystick_move","x":' + position.x + '}}'
    
                });
            },
    
            "touchend": function (had_direction) {
                airconsole.message(AirConsole.SCREEN, {
                    "message": '{"c2dictionary":true,"data":{"action":"joystick_stop"}}'
                });
            },
    
            "distance": 90,
            "min_delta": 0.01
    
        });[/code:2ca33ac9]
    

    Thanks for the help on this!

    Right now I'm demoing the project with regular <button> tags created by hand. I'll take a crack at modifying the files in "airconsole-controls" maybe later this week.

    So far I have the following for the controller.html file. My students have enjoyed driving little tanks around onscreen with it:

    <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
       * @return {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>[/code:2ca33ac9]
  • Yes you need to do some coding in order to prepare the controller. But for most of controllers (I mean depends how fancy you want to make it) it's just a bit of coding. AirConsole also has a controller generator which helps to prepare standard buttons, joystics etc.

    What I was doing in my AC game, was simply sending the C2 Dictionary JSON from controller to the game itself and read that as a message in C2 project. Then based on Dictionary data I was performing some action.

    Here's the small code snippet to give a better understanding.

    > /** Start SCREEN BUTTONS **/
        var startScreen_readyButton = new Button("ready-button", {
            "down": function () {
                airconsole.message(AirConsole.SCREEN, {
                    "message": '{"c2dictionary":true,"data":{"action":"player_ready"}}'
                });
            },
        });
    
        var startScreen_creditsButton = new Button("credits-button", {
            "down": function () {
                airconsole.message(AirConsole.SCREEN, {
                    "message": '{"c2dictionary":true,"data":{"action":"goto_credits"}}'
                });
            },
        });
    [/code:2v8uoy08]
    
    So as you can see I'm just sending here "player_ready" or "goto_credits" string, depends on which button has been clicked on controller. You can even optimize it to send only this string instead of the whole dictionary JSON and then wrap it in C2 after fetching the string.
    

    Has anyone had any success getting the output of the joysticks to work as a C2 dictionary string? I'm looking to do dual analog joystick control, but the generated code creates a nested javascript object as output:

    {joystick-left: {pressed: true, message: {x: 0.8376799158253391, y: -0.5461614766924299}}}

  • Xeeko,

    System>Reset Global Variables to Default might be what you are looking for

    I've only seen demos of Fusion, but it looked to me like the people running the demo (a high school teacher and her student) used a lot of global variables. I try to stay away from global anything as much as possible in C2 because it can make troubleshooting very difficult. The exception to this is "included" event sheets, which have been really helpful for my latest project.

    As for Layouts/Event Sheets, if you duplicate a layout, the duplicated layout will use the previous event sheet, which you then need to reassign to a new event sheet. If you create a new layout from scratch, it will prompt you whether or not you want to create a new event sheet to go with it. In my current project, I have found that it is easiest to duplicate the layout, then create a new event sheet in the event sheet sidebar.