AirConsole Game Dev Contest 2017

Discussion and feedback on Construct 2

Post » Sat Oct 15, 2016 11:01 am

@arod17pr did you make sure to change the index.html to screen.html and that screen.html and controller.html are on the root?

Also to test your test it's http://airconsole.com/simulator/#debug:YOUR_HOST_OR_URL using the #debug.

Eg. http://www.airconsole.com/simulator/#de ... mes.co.nf/

Hope this helps :)
Image
B
60
S
32
G
5
Posts: 118
Reputation: 8,325

Post » Sat Oct 15, 2016 2:47 pm

@piszozo

The controller creator says it does not work for C2.
The "workaround" is this thread.
Music & Sound.
B
35
S
22
G
9
Posts: 47
Reputation: 7,822

Post » Sat Oct 15, 2016 4:58 pm

Current plugin allows only to send simple messages. The trick I'm using as you saw in my earlier post is that I'm sending a C2 Dictionary JSON as a message string. As you know you can have as many data as you want with C2 Dictionary. So basically the trick is to send all data from Controller to Screen with C2 Dict JSON and then pick it with the screen (C2 app) and load into some Dictionary. Once it's loaded you have easy access to all data you sent with JSON.

Code: Select all
 airconsole.message(AirConsole.SCREEN, {
                "message": '{"c2dictionary":true,"data":{"action":"player_ready"}}'
            });
ImageImageImage
B
33
S
19
G
82
Posts: 1,039
Reputation: 46,257

Post » Sat Oct 15, 2016 5:49 pm

Im having an issue. I first was able to load the game and the controller. Now it stays loading.
Music & Sound.
B
35
S
22
G
9
Posts: 47
Reputation: 7,822

Post » Sun Oct 16, 2016 1:04 pm

Hello everyone,
Thanks for sharing the contest with us. I will try to participate. I just have one question. How do I settup my controllers ? :D
I have tried planty of things but I really don't know javascript.
I tried to reproduce exemples given in the github but without success. I also tried using the controller generator but then, I dunno how to get the data back on c2.
Could someone give an exemple of a working controller using a Dpad and how he gets the message ?
All the best
Love
B
7
S
1
Posts: 29
Reputation: 481

Post » Sun Oct 16, 2016 8:36 pm

BackendFreak wrote: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.
Code: Select all
/** 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"}}'
            });
        },
    });


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}}}
www.simbucket.com - HTML5 Science Simulations / https://www.airconsole.com/#!play=com.n ... obotrumble - Robot Rumble on AirConsole
B
53
S
17
G
26
Posts: 436
Reputation: 18,117

Post » Sun Oct 16, 2016 8:43 pm

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.

Code: Select all
    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

    });
ImageImageImage
B
33
S
19
G
82
Posts: 1,039
Reputation: 46,257

Post » Sun Oct 16, 2016 9:46 pm

Hey mate, thanks for sharing but.. Do you know how to make it work with generated controller ?
B
7
S
1
Posts: 29
Reputation: 481

Post » Mon Oct 17, 2016 12:47 am

I just can't believe there is a contest for C2 "devs" and there is not a propper tool kit for it. Just a link with "snippets" of information done by sombody not involved with airconsole.
Music & Sound.
B
35
S
22
G
9
Posts: 47
Reputation: 7,822

Post » Mon Oct 17, 2016 1:07 am

I have a question that I hope someone might be able to answer... If a device connects, the trigger event is as I would expect. However, if a device disconnects, the trigger event asks you for the id of the device you are checking for. This seems a little recursive... Am I correct to load the trigger expression as below?

Code: Select all
<condition name="On device left" type="AirConsole">
                            <param name="DeviceID">AirConsole.DeviceIDLeft</param>


Thus the trigger will check against the device id that triggered the trigger...?

Thanks.

Edit - very early stages of looking into this and I have nothing to test yet.
A big fan of JavaScript.
B
76
S
20
G
76
Posts: 2,296
Reputation: 47,576

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 10 guests