WebSockets: What do you want?

Post your work in progress addons and get feedback

Post » Sat Sep 07, 2013 10:23 am

I'm starting to play with Construct 2 for the first time today, looking to see how I can use my WebSocket client / server technology with it. I can do anything I want re: WebSockets but don't have experience with Construct 2. Just thought it might be a lot more efficient to ask experienced users, who have perhaps tried or constructed apps with WebSockets, what you really need and want.
B
6
S
1
Posts: 76
Reputation: 606

Post » Sat Sep 07, 2013 11:02 am

Not many of us have played with the websockets because we lack the server end of it.
If you get it working, I am definitely interested in your progress.
B
230
S
62
G
33
Posts: 902
Reputation: 40,323

Post » Sat Sep 07, 2013 11:51 am

I have my own server ... built it myself; fully standard compliant. I've had a demo running for about 2 years.
http://highlevellogic.blogspot.se/2011/09/websocket-server-demonstration_26.html

It definitely works and the browser side stuff is pretty easy, if all you're doing is sending and receiving data. I have also developed an application framework that can be wrapped around the WebSockets (called High Level Logic - HLL) with distributed applications in mind ... which could include multiplayer games.

With or without HLL, I can make this baby work any way that I want to, and provide any support that I want to. The interesting thing right now is that it looks like Construct 2 could use this support, and I am very interested in applying the technology to games.

I'm just starting to look at Construct 2, and wondering what the best way is to capture shared event data and apply it when it comes in.

But also, the initial question ... do you have any thoughts on what would make use of WebSockets easy for you and give the results that you want?

Do you for example, need to be able to program the server side with JavaScript? Or would you get fired up already if the WebSocket server did something as simple (not requiring app developers to program at all) as registering users for a game (can support more than one game group) and echoing incoming data back out to all active players accept the one who sent it?


B
6
S
1
Posts: 76
Reputation: 606

Post » Sat Sep 07, 2013 12:26 pm

Id say the biggest issue now is parsing the notification messages from servers.

Most strings are in json key pair format, and C2's data objects use that, except they must all have the first key formatted to something they recognize.
Image ImageImage
B
169
S
50
G
169
Posts: 8,286
Reputation: 108,216

Post » Sat Sep 07, 2013 12:39 pm

[QUOTE=newt] Id say the biggest issue now is parsing the notification messages from servers.

Most strings are in json key pair format, and C2's data objects use that, except they must all have the first key formatted to something they recognize.[/QUOTE]

Thanks. I can look at that when I've gotten a little farther along so I have some way to id the problem and test. As per your description, it could be more than one thing. Top of my head says it may need to be serialized or deserialized, depending on how you want to access the results. I don't use JSON myself, but as I understand it, the functions for that are window.JSON.parse("a json string"); and window.JSON.stringify(myObj);
B
6
S
1
Posts: 76
Reputation: 606

Post » Sat Sep 07, 2013 12:50 pm

Well if the return string was already formatted to "{"c2dictionary":true,"data":{}}" then when you received the message you could just load it into the dictionary object, and compare known keys, or do a for each key.
I would assume there shouldn't be many issues reloading the dictionary that way.
Image ImageImage
B
169
S
50
G
169
Posts: 8,286
Reputation: 108,216

Post » Sat Sep 07, 2013 1:07 pm

[QUOTE=newt] Well if the return string was already formatted to "{"c2dictionary":true,"data":{}}" then when you received the message you could just load it into the dictionary object, and compare known keys, or do a for each key.
I would assume there shouldn't be many issues reloading the dictionary that way.[/QUOTE]

OK. I'll try to figure out how to do that. Do you happen to have an opinion as to whether this will work with the "8 direction 1 (simple movement)" example?
rogerfgay2013-09-07 13:07:44
B
6
S
1
Posts: 76
Reputation: 606

Post » Sat Sep 07, 2013 1:33 pm

You could set up key values named for the different directions, and use a Boolean 0, or 1 to tell an object to stop or go.

Heres an example.
capx
Image ImageImage
B
169
S
50
G
169
Posts: 8,286
Reputation: 108,216

Post » Sat Sep 07, 2013 1:50 pm

[QUOTE=newt] You could set up key values named for the different directions, and use a Boolean 0, or 1 to tell an object to stop or go.

Heres an example.
https://dl.dropboxusercontent.com/u/666516/ws4dir.capx[/QUOTE]

OK, now I need to know how to update my free version. The project was saved in R143, and I have R139 ... so it wouldn't load.
B
6
S
1
Posts: 76
Reputation: 606

Post » Sat Sep 07, 2013 1:56 pm

Image ImageImage
B
169
S
50
G
169
Posts: 8,286
Reputation: 108,216

Next

Return to Work in Progress Addons

Who is online

Users browsing this forum: No registered users and 0 guests