From: Erik V. <eri...@hc...> - 2005-04-26 22:38:55
|
> Though, now that I think about it, perhaps Bank should be a > totally static > class? It could be, sure. It's now a singleton, though not very well managed. > >About the Player[] allPlayers (I tend to use ArrayLists > >because these do not need to be pre-dimensioned): sure, > >but my point is: where do we store such an array? > >I have put it as a static array inside Player (the class, > not the instance) > >itself. > > > We would store such an array in the initialization code for > starting up a new game. > > I've already been working a bit on this sort of > initialization: see ui/GameLoader.java I see. > Ok... I've gotten further along in coding the startup UI for > a new game. Included with that, I'll pull out the > self-managing portions of Player so that it can be used for > storing a single player's data. I'll be committing this > sometime later today. It already *was* used for storing a single player's data! I suppose you meant: "so that it ONLY can be used for....". That restriction now forced me to create and store the player list in my servlet too. In hindsight, I think the player list belongs in Game (not in Player or in GameLoader), so that all possible UIs can get it from there. What about that? We should be careful to keep game data and UI stuff separate, so that in the future our classes can also be used for a 18xx game server (just to name one possibility). So the player list should not be saved in the UI code. On Game: I was thinking that we could rework Game into a singleton class just like CompanyManager and StockMarket, and also created by ComponentManager, in which certain game-wide properties could be initialised from XML that would not fit easily elsewhere. E.g. the definitions regarding "rounds", the size of the Bank etc. But the players will have to come from the UI - any UI! And maybe Game and GameLoader should swap names. > Things are starting to look a lot like an actual game. It's > quite encouraging. If you can fix that missing-method compiler error in Options, it might for me too..... Erik. |