+ Reply to Thread
Results 1 to 7 of 7

Thread: Java vs AS1?

  1. #1
    Junior Member
    Join Date
    May 2010
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Java vs AS1?

    Hello,

    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?
    Thanks!

  2. #2
    Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,211
    Thanks
    80
    Thanked 1,086 Times in 1,075 Posts
    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.
    Teresa Carrigan
    Senior Engineer
    Electrotank, Inc.

  3. #3
    Junior Member
    Join Date
    May 2010
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi again tcarr

    Is there any consistent doc / help / classes overview for AS1 Server API coding?
    I just found this for the Java part:

    http://www.electrotank.com/docs/es5/server/java/

    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.

    Thanks

  4. #4
    Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,211
    Thanks
    80
    Thanked 1,086 Times in 1,075 Posts
    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 that shows how to create an AS1 plugin. We have 17 code examples of AS1 plugins; see the Examples page of the manual and look down the server code column for the ones that mention ActionScript 1.
    Teresa Carrigan
    Senior Engineer
    Electrotank, Inc.

  5. #5
    Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,211
    Thanks
    80
    Thanked 1,086 Times in 1,075 Posts
    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.
    Teresa Carrigan
    Senior Engineer
    Electrotank, Inc.

  6. #6
    Junior Member
    Join Date
    May 2010
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Last edited by badoumba; 12-07-2011 at 08:30 PM.

  7. #7
    Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,211
    Thanks
    80
    Thanked 1,086 Times in 1,075 Posts
    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.
    Teresa Carrigan
    Senior Engineer
    Electrotank, Inc.

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts