Socket.io Mod

Post your completed addons to share with the community

Post » Sat Mar 02, 2013 5:12 pm

@Rory

I wouldn't know sorry. I do know that Socket.io itself is closing in on version 1 release and there are already frameworks such as multiplayer.js for node that are incorporating these features. I've not used them as yet.

The challenge comes in designing configurable features that can suit lots of multiplayer game types.
B
5
Posts: 39
Reputation: 678

Post » Sat Mar 02, 2013 7:49 pm

Google is working on something for faster UDP usage. I think it was leaked information though so there's not too much about it just yet.

Also~ I'll be keeping watch on this thread. Keep it updated with your progress. :]
B
72
S
10
G
6
Posts: 104
Reputation: 7,550

Post » Fri Mar 29, 2013 12:44 pm

Nice progress with this plugin!

You've made some nice additions to the whole socket.io plugin.

I see that you're using the "unstable" version of the plugin that has the "On any event" condition.
Although it is crucial to have that kind of condition for making something useful without editing the runtime.js everytime you need a trigger for a custom event, it uses some pretty hackish solution to achieve this. Socket.io doesn't have the Socket.on("*"){} or some other wildcard event that will catch all received events as for now, altough there is some talk about it; see here.

I had some problems with current implementation with "On Any event" and sometimes it caused problems (non triggered events, although i sent them to client).

Another issue with this plugin is received data handling. Currently, data is stacked in the LastData array, then extracted from it with some dubious(?) methods. Official websocket plugin has a much more tidy way of handling this, but i'm not sure is that solution suitable for this kind of plugin.

Also, this plugin became really dispersed on a bunch of variants across the forum. Can we find something like github or sourceforge to track changes and sum our efforts to have one great plugin, instead of 5 different ones? Any suggestions?


Cheers!


Be nice until it's time to not be nice
B
36
S
9
G
9
Posts: 293
Reputation: 6,652

Post » Tue Apr 02, 2013 3:45 am

@JohnnySheffield

Yes, GitHub would be great.

I've amended this plugin to create a much better means of accessing events which I haven't released. GitHub will certainly help get our thoughts together. I'll set it up...
B
5
Posts: 39
Reputation: 678

Post » Thu Apr 04, 2013 7:12 pm

That's good. When you set it up, please notify me, so i can start contributing to the project!
Be nice until it's time to not be nice
B
36
S
9
G
9
Posts: 293
Reputation: 6,652

Post » Fri Apr 26, 2013 4:41 pm

question about this plugin: when i use the "on event recieved" event, which ever action I have used it for gets spammed. For example, if my servers sends event "newPlayer", and in my game code I tell it to create a new sprite, it creates a new sprite every tick even though the event is only fired on the server once. I'm using the latest beta C2.
B
8
Posts: 32
Reputation: 1,039

Post » Mon Apr 29, 2013 11:29 am

Hi!

I've uploaded this version of the plugin here as a kind of a dev version, but i will maintain the stable version here and add stuff as we make decisions!

Cheers!


edit:

@thatjoshguy

The "on any event" is a pretty hackish stuff, and i would recommend that you don't use it. The socket.io support on the wildcard event is something that is discussed, but there is no news on implementing it. Solution for "on any event" used in this version of the plugin is taken from stackoverflow, and it misbehaved!JohnnySheffield2013-04-29 11:47:52
Be nice until it's time to not be nice
B
36
S
9
G
9
Posts: 293
Reputation: 6,652

Post » Tue Apr 30, 2013 3:09 pm

I'm not using "on any event" - I'm using "on event recieved" with a named event, i.e. "playerUpdate". When the playerUpdate event is fired from the server, C2 reacts with its event over and over again vs. firing once per event.

I seem to be able to get around this if I set up my C2 events as:



  • -> Socket| on "playerUpdate" recieved || Socket|Split Data Received

    • -> Socket| Is Data Available? || (do my actions here)






...but this seems to be quite a few extra steps. Why can't I just call my events directly after "on "whatever" recieved?
B
8
Posts: 32
Reputation: 1,039

Post » Tue Apr 30, 2013 3:38 pm

Correction: the above does not fix the issue, it just causes the event to only fire once. If i can get an example together with a public server I'll toss it up here
B
8
Posts: 32
Reputation: 1,039

Post » Tue Apr 30, 2013 4:08 pm

Sorry, misread.

But, nevertheless, the "on event recieved" is possible thanks to the same function as on "any enevt".

It seems that you need custom event triggers; i.e. 'on myEvent'. My current solution is tho manually add triggers for everycustom event directly in runtime.js. I use this version of the plugin https://github.com/JohnnySheffield/C2_Plugins/tree/master/Socket_io-mod_stable

I add a newcondition to the edittime.js, somewherearound line 22:

addcondition('on my trigger', ,mytrigger','blahblah', 'onMyTrigger')


In theruntime.js i add a new eventlistener:

socket["on"]
          (
               'Mytrigerr',
               function(event)
               {
//trigger the ondatacondition here if needed               runtime.trigger(pluginProto.cnds.OnMyTrigger,instance);
               }
          );


And finally i add the condition
:

Cnds.onMyTrigger= function(){return true;}

It needs more planning ahead, and is time connsuming, but in my experience it provides muchmore stable code.

Sorry for the formatting, writing on mobile;

Cheers!
Be nice until it's time to not be nice
B
36
S
9
G
9
Posts: 293
Reputation: 6,652

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 1 guest