From: Erik V. <eri...@hc...> - 2005-03-20 16:24:04
|
I have just sent a new load of code to Brett. The main things that have changed are: 1. Company now has two subclasses PrivateCompany and PublicCompany. I expect that this will be sufficient, but the CompanyManager now allows configuring additional classes pretty easily (see the XML below). 2. Properties common to a company type (Private, Major, Minor etc.) are now defined in separate <CompanyType> tags. These also define the various company types as are used in a game. An example for 1830: <CompanyManager> <CompanyType name="Private" class="game.PrivateCompany"> <Auction type="1830"/> <AllClose phase="5"/> </CompanyType> <CompanyType name="Public" class="game.PublicCompany"> <CanBuyPrivates lowerPriceFactor="0.5" upperPriceFactor="2.0"/> <PoolPaysOut/> </CompanyType> <Company name="SVNRR" type="Private" basePrice="20" revenue="5"/> .... <Company name="B&O" type="Public" fgColour="white" bgColour="blue"/> <Company name="PRR" type="Public" fgColour="white" bgColour="darkgreen"/> .... </CompanyManager> This shows that the implementation class can be defined dynamically. The inner elements are used to initialise the company instances of each type (I am not at all sure that the properties shown should indeed be defined in the companies XML; consider this as just an example). 3. Properties common to a (coloured) stock market area are now defined in separate <StockSpaceType> tags. Again, for 1830: <StockMarket type="rectangular"> <StockSpaceType name="yellow" colour="yellow"> <NoCertLimit/> </StockSpaceType> <StockSpaceType name="orange" colour="orange"> <NoCertLimit/> <NoHoldLimit/> </StockSpaceType> <StockSpaceType name="brown" colour="brown"> <NoCertLimit/> <NoHoldLimit/> <NoBuyLimit/> </StockSpaceType> <StockSpace name="A1" price="60" type="yellow"/> ... <StockSpace name="A4" price="39" type="orange"/> ... <StockSpace name="A8" price="10" type="brown"/> ... <StockSpace name="G1" price="100" > <StartSpace/> </StockSpace> ... <StockSpace name="H1" price="112" /> ... </StockMarket> The StockSpaceType "name" is arbitrary and does not need to describe the colour or whatever. It is only used as a key by the stock spaces to find the common properties. The "colour" is optional, but is there for potential use by the UI (as are the fgColour and bgColour attributes of the public companies). It could also contain an RGB value in some format (for some companies I use hex. #RRGGBB which shows neatly in the HTML output of my test servlet, I'm not sure if that is useful for a Java UI). StockSpaceType has been added to make the XML look a bit less unwieldy, and to allow the name/colour separation (1870 has name="orange", colour="green"!). As a short-term goal I would propose to create a program that acts like Lemmi's moderator, i.e. it can manage all game actions except those that relate to the map (because that is the hard part!). This would mean that renevues and building costs would need to be entered manually. The first game to do this for would be 1830. From there we could decide how to get on: adding more games, or adding the map, revenue calculation etc. Erik. |