Extensions.

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

Post Reply
diamond123
Posts: 46
Joined: 28 Nov 2009, 04:30

Extensions.

Post by diamond123 »

Extensions are cool.

They can be written in Actionscript (native flash programmers),
Python (native game programmers)
Java (native programmers) :)

Also they are interoperatable. I.e. Write one extension in Java another in python and a third one in Actionscript.
WOW.

But, [a long pause]

What are the consequences of the various methods.

I write my extensions in Actionscript, but i am planning to recode them in Java (though i consider myself a native game programmer).

Is there any advantage of writing them in One language than the other.

I remember having read somewhere that using Java gives better performance than using the other two.
I think this is because the other two are converted to byte-code at runtime.

But is it like everytime i load an extension this byte-code conversion will happen (for example every time i load my game room extension it is compiled from source or does it happen only for one first time)

Also is it worth converting from AS to Java? Will it give significant speed boost.

The ref-docs, Lapo and many others have often said many times to have zonelevel extensions rather than room-level.
But i dont understand this. I believe this is because each extension gets its own thread. But if i use a zone based extension wont all requests pass through one single thread and cause a lot of delay and/or incorrect behaviour.

I.e. Wont one game be delayed because some other game is being processed.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

I write my extensions in Actionscript, but i am planning to recode them in Java (though i consider myself a native game programmer).
A good idea if you use the scripting code for prototyping, in other words building quickly a rough version to check if it works and then recode it in Java to obtain higher performance.
Is there any advantage of writing them in One language than the other.
Yes. You can search more topics on this, there are many.
In a nutshell... scripting languages can speed up your development significantly. In terms of performance they are almost the same.
Java gives you better control on what you do and lots more speed. Also it allows to integrate many thousands of other useful libraries.
Also is it worth converting from AS to Java? Will it give significant speed boost.

Yes, especially if you have complex server side code.
The ref-docs, Lapo and many others have often said many times to have zonelevel extensions rather than room-level.
This was more of a concern with SFS versions prior to 1.6.
In 1.6 we added many optimizations which reduce the resource consumption and provide better performance even with thousands of Rooms.
But i dont understand this. I believe this is because each extension gets its own thread.
No, this is incorrect.
If each Extension had his thread the server wouldn't be able to scale. All extensions by default are run by a thread-pool that can be configured. (see ExtHandlerThreads in ch 2 of the docs)
But if i use a zone based extension wont all requests pass through one single thread and cause a lot of delay and/or incorrect behaviour.
No.
Please take a look at this document which explains the architecture in all the details --> http://www.smartfoxserver.com/docs/docP ... Safety.htm
Lapo
--
gotoAndPlay()
...addicted to flash games
diamond123
Posts: 46
Joined: 28 Nov 2009, 04:30

Post by diamond123 »

Thanks,
That was very useful.

BUT,

1. Haven't done java since 2008.
2. Scared of threads.
3. AS3 has made me lazy (no mem alloc/ dealloc, etc).

But i will try it soon.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

BUT,

1. Haven't done java since 2008.
2. Scared of threads.
3. AS3 has made me lazy (no mem alloc/ dealloc, etc).
LOL :lol:

ps.
Btw, the good news is... since Java 5 threads are less scary and no malloc/dealloc in Java too, fortunately :)
Lapo
--
gotoAndPlay()
...addicted to flash games
Post Reply