Hi BenderB,
Which AS class version are you using? AS 1 for Flash MX or AS 2.0 for Flash MX 2004?
Thanks
Printable View
Hi BenderB,
Which AS class version are you using? AS 1 for Flash MX or AS 2.0 for Flash MX 2004?
Thanks
I'm using AS1 for Flash MX.
Thanks
BenderB.
Hi BenderB,
Thanks for finding that. I have just verified that it is indeed an ElectroServer 3 bug. It appears that it will only removed the most recently created room variable by that user.
FYI: Tomorrow I am going off for a 5 day locking-ourselves-in-a-room real-time multiplayer game design session. During that time we will be hammering the crap out of ElectroServer 3 and producing the latest build (which already has tons of minor fixes/enhancements).
I'll post something here when we release it.
No problem Jobe ;)!
Thanks for your help,
BenderB.
Hi Jobe!
Just a quick question:
When I began to work with ES3 I tried around with sending arrays attached to objects like this:
code:
var ob = new Object();
ob.test = new Array();
//fill Array
es.pluginRequest("PlugIn", "test", ob);
But it doesn't seem to work this way so I worked around the parts where I could have used an array to send stuff.
I just wanted to know if it is really imposible to send arrays and if not how can you send them??
Thanks,
BenderB
P.S.:
Hope you have fun at your "5 day locking-yourselves-in-a-room real-time multiplayer game design session" :D
Hi BenderB,
The sending of objects back and forth is 100% supported between clients. So if you and I are in a game I could send you arrays and objects and stuff.
The way that works is that the object is serialized in to XML, the XML is sent, and then on the other side the client deserializes it back into objects.
With ActionScript plug-ins we are restricted pretty much to what JavaScript can do. JavaScript has no native XML support, therefore we cannot use the same object serializatin.
So the short answer is that "no", we dont support sending arrays to plugins at this time. However, you can send variables. For instance, this function is contained in the 'simple plugin' example file installed with ElectroServer 3:
We are sending all variables found on the object. They can only be variables.Code:function askThePluginAQuestion() {
var ob = new Object();
ob.iterations = iterations;
es.pluginRequest("SimpleActionScriptPlugin", "Calculate", ob);
}
In the future we may add a differet type of serialization for this purpose. But in the mean time, you'll have to probably just send your arrays as a string with some delimiter and reconstruct on the other side. I'm sorry :(
Ah right, between clients the transmittion of arrays works.
Must be messing around with the plugins for to long...:)
It's not really a problem anyway but I just thought if there was a way to transmit arrays to the plugins I could clean up the code a bit.
thanks,
BenderB.
yeah, I agree that it would be nice to have that ability. But the thing is that we are trying to use the same API for both ActionScript plugins and Java plugins. I do have an idea of how to make it work, but wont have the time any time soon to impliment it.
Good luck!
okidoki :)
...and another quick question:
I thought that if I have a plugin at room level it is instantiated when the room is created and deleted when the room is destroyed.
But I have some trace() commands which are called with a setInterval and they keep displaying after all players have left the room??
thanks,
BenderB
BenderB,
That is a very good question. Yes, plug-ins *are* removed when the room is destroyed. However, to get setInterval to work we had to create server threads which callback to the plug-in. When the plug-in is removed the setInterval's are not.
So if a plugin is removed without removing the setIntervals, then that is a memory leak. There is like an onPluginDestroy event in the plugin (check docs). When that event is fired you must manually clear all setIntervals.
Thanks, but I'm dealing with another problem now:
I looked through the examples which came with my electroserver installation and didn't find an example which uses the pluginDestroy() event.
Then I downloaded electroserver again from your website to see if there was a newer version and indeed the version I downloaded differs from my current installation.
There is also a java plugin example in the newer package and I found the pluginDestroy() event there.
So I tried to use it in my old installation but I doesn't seem to fire.
I then configured the newer version and now the event gets fired...but now the client can't extract the variables I send to them via:code:
server.sendMessage("public", action, ob);
Until now I extracted the variables via:code:
function pluginMessageReceived(plugin, action, variables) {
var test = variables.test;
}
when I had a function like this on the server:
code:
function blablabla{
var ob = new Object();
ob.test = 10;
var action = "test";
server.sendMessage("public", action, ob);
}
But it doesn't work this way with the newer version as I get an empty variables object on the client side.
I looked through the examples but the only example which deals with this is the SimpleActionScriptPlugin.as which doesn't work eigther.
I configured the plugin and it loads and the moves are calculated and returned but I can't extract the variables sent the way I used to on the client side...:confused:
Any idea?
Thanks,
BenderB
Crap. Thanks for finding that. You are using features that not many people other than ourselves are using yet :)
Anyway, my latest class files have that issue fixed. Please give me your email address and I'll send you the latest class where it works. We had to change how the vars are passed around little bit. It should't change what you are doing.
[email protected]
I sent you an email...
Did you send it to [email protected]? I dont see it.
...and here I am again.
Could it be that the files you sent me are for flash MX 2004?
Because I get an unexpected file format error when I try to open the fla...:confused:
Its Flash 6 but saved as an mx 2004 FLA.
Just use your old FLA, but use the new class files I sent. And changed the pluginMessageReceived function to this:
Code:function pluginMessageReceived(plugin, action, variables) {
trace("+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=");
trace("Received message from "+plugin);
trace("Action = "+action)
trace("---vars in variables object---")
for (var i in variables) {
trace(i+"="+variables[i]);
trace(variables[i])
}
results2 = action+" ms";
}
It works!
Thanks for your efforts Jobe!
...one more time.
Jobe:
Alright, we finished our game (more or less as we had to finish it for our presentation)!
The only major drawback we encountered was that it runs too slow for the internet (but very nice in a LAN).
Maybe if I had had more time (we finished the game 5 hours before the presentation...) I could have rewrote a few parts to speed up some things...
Anyway all in all I'm proud that we made it as before this project I had no idea how much work a realtime multiplayer game could be...
So why do I post here?
I wanted to thank you one last time for the great help you offered without I wouldn't have come very far!
It's amazing how much I learned in that little time from your suggestions.
And to all the unsure people out there I can only suggest to use Electro Server!
Many, many thanks,
BenderB
Hi BenderB,
I'm glad things worked out for you :)
I am happy to discuss any concepts further if you want to.
Hi BenderB,
I have been talking about the next dot release of ElectroServer for a while, but we finally got it packaged up and online! You can now download ElectroServer 3.2. Every instability issue that we know about has been fixed. There are tons of ActionScript class fixes as well. All of the user variable stuff is working now.
http://www.electrotank.com/ElectroServer/downloads.aspx