creating rooms with more than 1 extension

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

Moderators: Lapo, Bax

jamieyg3
Posts: 84
Joined: 25 Sep 2008, 16:01

creating rooms with more than 1 extension

Postby jamieyg3 » 29 Jun 2009, 03:11

With java can I create a room and give it more than 1 extension? If so how? I'm using helper.createRoom() but i think it only lets me put in 1 extension.

Thanks.
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 29 Jun 2009, 06:39

I wouldn't recommend to attach multiple extensions to a Room. Especially if of you plan to create many of these rooms.

It's going to be a waste of resources and makes your code trickier. One extension is a full and complete application that you can "attach" to a Zone or Room. Why would you split it in two parts?
Lapo
--
gotoAndPlay()
...addicted to flash games
Godai
Posts: 29
Joined: 23 Jan 2009, 12:14

Postby Godai » 29 Jun 2009, 10:46

Actually it would be nice.
We have different room extensions for certain games and on top of that we have a general zone extension that keeps track of slots in rooms since room object vars is too annoying to use due to the fact you have to rebuild the entire list instead of just adding a new one :)

Since the slot/seat code is very simple, it would be easier to have it as a second extension on the room.

I have a problem with the zone extension, but that will be a different post :)
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 29 Jun 2009, 11:17

I am not sure if I understand because I didn't get the "room object vars" passage.
However the common use case for multiple extensions is to reuse code.
What we recommend is to use OOP instead of multiple extensions. The effect is the same and the are multiple benefits.
(e.g. two extension don't share the same data, and they are more expensive to create than one especially at room level)

In Java it is trivial to reuse the code as well as in python. In Actionscript it's probably less done because the nature of the language doesn't promote OOP too much. Anyways you can import other blocks of code using #import and you can create classes as well.

Take a look here:
http://mckoss.com/jscript/object.htm
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 36 guests