PureMVC Architects Lounge

Announcements and General Discussion => General Discussion => Topic started by: Nilz on November 06, 2007, 02:28:10



Title: multiple MVC's in one project
Post by: Nilz on November 06, 2007, 02:28:10
Hi all,

We are creating a big game with several mini games (puzzles, quizez etc) in flash cs3 using pureMVC.
To accommodate every developer with it's own environment we have a mvc structure for each mini game and one main mvc for the overall game. One 'problem' we have is that all the core classes are singletons so each game will need it's own puremvc setup.

Any experiences in this field ?
What is your view on merging multiple mvc's in one?

Cheers,

Niels
flashclub.nl


Title: Re: multiple MVC's in one project
Post by: puremvc on November 06, 2007, 12:42:38
I'm doing a FlashLite game in AS2 with a soon to be released PureMVC port. The game loads multiple levels. The level can be seen as simply registering some new mediators, commands and proxies.

So the shell movieclip initializes the Facade, calling a facade method on its first frame like:

:
import com.me.mygame.GameFacade;
GameFacade.getInstance().startup(this)

A StartupCommand is invoked that does the standard PureMVC housekeeping.

Each level, when loaded, on its frame 1 gets the Facade instance, calls a facade method like:

:
import com.me.mygame.GameFacade;
GameFacade.getInstance().levelLoad(this)

The LevelLoadCommand, like the StartupCommand, gets a reference to the MovieClip that invoked it so it can wrap it in the right Mediator, and create any associated Proxies, register any new commands and send a kickoff notification if necessary.

The idea, then is that the Facade has already been initialized by the shell, and the newly loaded thing just adds what it needs.  And if done correctly, the game it will run on its own as well as within the shell.

-=Cliff>