AirConsole HTML5 Game Contest 2016

Chat about anything not covered in these forums, but keep it civil!

Post » Mon Mar 14, 2016 9:03 am

Hi guys,

I am the developer of the AirConsole Construct2 plugin.

We have a controller-generator with which you can actually build your own controllers pretty quickly and easy.

However, its true that it does not work yet with Construct2. Instead you have to be able to write some JS and HTML code to create your own controller.

I am pretty new to Construct2 and I wonder if there is a way to parse JSON data in Construct2.

E.g. an JSON object like:
Code: Select all
dpadrelative-left: {
  message: {
     direction: "down",
     pressed: false
  }
}


Or s.t. like:
Code: Select all
{
  message: {
    x: 2,
    y: -23
  },
  pressed: true
}

If that works in Construct2, it would be much easier to adapt the Controller-Generator also for Construct2.
Any ideas?

Thank you!
B
7
S
1
Posts: 15
Reputation: 470

Post » Wed Mar 16, 2016 10:54 am

@FraConsole: This kind of question should rather be searched for and asked in the Javascript SDK forum.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
293
S
117
G
96
Posts: 7,310
Reputation: 71,069

Post » Wed Mar 16, 2016 12:41 pm

@FraConsole in C2 you can load only strings and numbers. You can load JSON into Dictionary object but it needs a specific format.

Solution for now is to send specific C2 JSON from the controller to C2 and load it into Dictionary so you can use the data. This is the solution which I've implemented in Zombie Annihilation so you can check my controller.html there.

BTW: Just realized that probably better solution would be to send only data and wrap it with C2 Dictionary JSON header inside C2 already. That way less data would be send every message. I will make an update to my controller later.

But obviously it would be the best if AC C2 plugin would parse incomming data by itself.
ImageImageImage
B
28
S
16
G
82
Posts: 1,030
Reputation: 45,804

Post » Thu Mar 17, 2016 7:51 am

@BackendFreak

were you able to customize your controller graphics or did you use the basic template?

also, have you considered writing a post explaining your process and experiences with publishing to airconsole? it is a very interesting platform with a lot of potential. so others may be wanting to know how to get started.
B
81
S
32
G
23
Posts: 1,053
Reputation: 35,965

Post » Thu Mar 17, 2016 8:15 am

@BackendFreak Thank you!

I just had a look at your code. So basically something like this:
Code: Select all
airconsole.message(AirConsole.SCREEN, {
  "message": '{"c2dictionary":true,"data":{"action":"joystick_move","x":' + position.x + '}}'
});


Would be easier if I just send the data property:
Code: Select all
airconsole.message(AirConsole.SCREEN, {
    action: "joystick_move",
    x: position.x
});


And the AirConsole Plugin adds the c2dictionary attribute etc.
And in Construct2 you would have to always use the dictionary to parse the data
Would that be better?

Thank you!
B
7
S
1
Posts: 15
Reputation: 470

Post » Thu Mar 17, 2016 12:16 pm

harrio wrote:@BackendFreak

were you able to customize your controller graphics or did you use the basic template?

also, have you considered writing a post explaining your process and experiences with publishing to airconsole? it is a very interesting platform with a lot of potential. so others may be wanting to know how to get started.


AirConsole controller is basically a web page. You are able to customize it anyhow you imagine. They just provide API and some useful examples. But it's not mandatory to use AC buttons etc. you can make your own.

But as I wrote before. Controller has to be made manually (programming). There is no way to do it in C2 for now.

Yes I was thinking to write about C2 and AirConsole, but I'm sure there are changes comming so I don't want my text to be deprecated just after publishing ;).

@FraConsole I understand you are rebuilding AC C2 plugin?

So here are the issues I consider should be rebuilded:

1. Fetching Data
Right now there is no way to fetch any other data than the "message" key. In order to fetch generic data I had to do a trick. Looks simple but it took me a while before I figured it out (!).
Image
So as you see I fetch any data. It is simply always TRUE. And then I parse data in C2.

2. Loosing data
As you can send only "message" data you cannot use RateLimiter for multiple elements. RateLimiter overrides the same keys and sends only the newest data. So if you send movement with "message" and some actions in "message" then with RateLimiter you will get your packages lost. You know how RateLimiter is important.
I tried my Zombie A. controller on iPhone 4S without RateLimiter and it was not playable. With RateLimiter it is perfectly fine.

So these are criticals I would say because they limit development in some way. So once this is fixed then it's already pretty fine. But still a lot could be better.

The fastest solution for you IMO would be just to implement C2 Dictionary "wrapping" in AC C2 plugin.
So simply saying once message arrives to AC C2 plugin, change it to JSON string and add C2 Dictionary entries to it. Then we will handle it with C2 Dictionary.

If plugin would take care of this wrapping, then we would be able to use AC Controller Generator and RateLimiter without problems.
ImageImageImage
B
28
S
16
G
82
Posts: 1,030
Reputation: 45,804

Post » Fri Mar 18, 2016 1:36 pm

Ok thanks a lot! I will let you know when I updated the plugin!
B
7
S
1
Posts: 15
Reputation: 470

Previous

Return to Open Topic

Who is online

Users browsing this forum: No registered users and 7 guests