View Full Version : Java vs AS1?
12-07-2011, 02:11 PM
As far as I understood, we can either use Actionscript1 or Java to program our server plugins. Do both these languages expose the same functions (I guess plugins are based on ES5 library) ? I am an advanced Actionscript programmer but still won't probably choose AS1 as this version is very different from the last one and over all not object oriented. I guess that Java is probably a better choice - this language is not so far from AS indeed!
Does this deduction makes sense for any of you?
12-07-2011, 02:19 PM
Java is a much better choice, unless your Java skills are weak. The AS1 plugins do use exactly the same server api because they are interpreted as Java by the ES5 core. Since they are interpreted instead of compiled, performance is slower.
12-07-2011, 03:05 PM
Hi again tcarr :)
Is there any consistent doc / help / classes overview for AS1 Server API coding?
I just found this for the Java part:
I would like to compare and check if migrating to Java coding for the server would be worth. As I said, both languages derived from C and are much alike.
12-07-2011, 03:11 PM
The AS1 server api is exactly the same as the Java server api. Exactly. You implement your AS1 plugin, and the ES5 core interprets that as Java code using a Rhino engine. AS1 server api has all the getApi() methods, etc, and we add the most common imports.
We have one tutorial (http://www.electrotank.com/docs/es5/manual/hello_world_as1_plugin.htm)that shows how to create an AS1 plugin. We have 17 code examples of AS1 plugins; see the Examples (http://www.electrotank.com/docs/es5/manual/examples.htm)page of the manual and look down the server code column for the ones that mention ActionScript 1.
12-07-2011, 03:16 PM
I found one bug ticket for AS1 plugins that may or may not be relevant: currently they can't use UDP. If you aren't planning to use UDP then this is not a problem.
Also, it is perfectly legitimate to use AS1 plugins for prototyping, and then after you are confident that you have the logic working correctly, port them to Java plugins to get the increased performance.
12-07-2011, 08:27 PM
Does this performance issue you mentioned comes from the Rhino engine interpretation? Is this a real time process or does the AS1 script is compiled first?
PS: I read in some forums that the support of ElectroServer was a bit sluggish compare to other providers. I can notice that this is not the case so far! So thanks for your quick feedback Teresa.
12-07-2011, 08:46 PM
Time needed for a support answer depends on whether it's something I can answer myself, and whether I have to implement code before I can answer it. When it isn't and I have to pull in somebody else or implement code to reproduce an issue, it can take a while - sometimes quite a while, if the issue isn't escalated.
The performance issue is due to the Rhino engine interpretation. An AS1 plugin does not get compiled at all, it's interpreted, so if there's a loop in it that is executed 1000 times, the body of the loop has to be interpreted 1000 times. Java plugins are compiled. I prefer Java plugins for other reasons of course: I can use an IDE that has code completion, for example.
Powered by vBulletin® Version 4.1.6 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.