How do I Make connection between java and construct2

Get help using Construct 2

Post » Sat Dec 19, 2015 12:32 pm

Hello guys, how do i make connection between java and construct2
example:

i make a socketserver in java and i want to use this socketserver in my c2's game.

thanks.
B
6
Posts: 14
Reputation: 285

Post » Sat Dec 19, 2015 12:40 pm

matheusben wrote:Hello guys, how do i make connection between java and construct2
example:

i make a socketserver in java and i want to use this socketserver in my c2's game.

thanks.


The only thing I can think of is for you to use the C2 SDK and write your own plugin to act as a 'middle man' between the two.

I have no idea of how - or even if - this would be possible.

It comes down to how much interaction you would need, i.e. what information needs to pass between them.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
136
S
31
G
86
Posts: 5,483
Reputation: 59,752

Post » Sat Dec 19, 2015 12:45 pm

There is the Ajax plugin to communicate with websites outside your game,
aso the browser object has execute javascript action..

If (a combination of) these don't work for you, writing your own plugin would probably be your best shot..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Dec 22, 2015 4:25 pm

i was thinking in JAVA SDK, not javascript sdk, Is this possible?
B
6
Posts: 14
Reputation: 285

Post » Tue Dec 22, 2015 4:48 pm

matheusben wrote:i was thinking in JAVA SDK, not javascript sdk, Is this possible?


C2 has nothing to do with Java, so what is it you actually mean or are trying to do?
If your vision so exceeds your ability, then look to something closer.
Moderator
B
136
S
31
G
86
Posts: 5,483
Reputation: 59,752

Post » Wed Dec 23, 2015 8:05 pm

I tried to do this (a centralized Java-based web socket servlet) and failed, because the Construct is inherently a peer-to-peer architecture. The only way you can make it work (short of writing a whole new multiplayer plugin) is to have your "host peer" as a browser running on your web-server.

Barring that, you would have to create a completely new Multiplayer plugin that runs on an external customizable API.

I am going to do this eventually, but it requires more time than I have at the moment.

If you do create such a plugin, put it on Github so that other folk can help develop it. I would also recommend using http://socket.io/

See these posts for reference:
viewtopic.php?f=146&t=122599
viewtopic.php?f=147&t=161343
viewtopic.php?f=146&t=150315
viewtopic.php?f=146&t=162260
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
23
S
6
G
1
Posts: 1,419
Reputation: 4,857

Post » Thu Jan 07, 2016 6:40 pm

thanks i will search more about this.
B
6
Posts: 14
Reputation: 285

Post » Fri Jan 08, 2016 5:14 pm

We use and abuse the AJAX to connect our Construct client to our Java servlets. Then we just make calls according to a preset API. That is the "easy" way rather than writing a full scale web socket solution.

We are using periodic polling to update "real time" information. We also run parallel calculations on both the client and server that give the impression that everything is being updated in real time, when in reality the numbers are only updated from the server whenever the user executes an action.
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
23
S
6
G
1
Posts: 1,419
Reputation: 4,857


Return to How do I....?

Who is online

Users browsing this forum: Elliott and 2 guests