// CFG: TASK-HOUSEHOLD-GROWTH-MAX-RUNS
$cfg->setConfigEntry('task_household_growth_max_runs', 0);
+// CFG: CITY-DAEMON-BUILDING-GROWTH-TASK-CLASS
+$cfg->setConfigEntry('city_daemon_building_growth_task_class', 'CityDaemonBuildingGrowthTask');
+
+// CFG: TASK-BUILDING-GROWTH-STARTUP-DELAY
+$cfg->setConfigEntry('task_building_growth_startup_delay', 1000);
+
+// CFG: TASK-BUILDING-GROWTH-INTERVAL-DELAY
+$cfg->setConfigEntry('task_building_growth_interval_delay', 200);
+
+// CFG: TASK-BUILDING-GROWTH-MAX-RUNS
+$cfg->setConfigEntry('task_building_growth_max_runs', 0);
+
// [EOF]
?>
// Register it
$handlerInstance->registerTask('household_growth', $taskInstance);
+ // Prepare a building growth task
+ $taskInstance = ObjectFactory::createObjectByConfiguredName('city_daemon_building_growth_task_class');
+
+ // Register it
+ $handlerInstance->registerTask('building_growth', $taskInstance);
+
/*
* Add extra tasks depending on daemon modus.
*/
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A BuildingGrowth city daemon-task
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class CityDaemonBuildingGrowthTask extends BaseTask implements Taskable, Visitable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @return $taskInstance An instance of a Visitable class
+ */
+ public final static function createCityDaemonBuildingGrowthTask () {
+ // Get new instance
+ $taskInstance = new CityDaemonBuildingGrowthTask();
+
+ // Return the prepared instance
+ return $taskInstance;
+ }
+
+ /**
+ * Accepts the visitor to process the visitor
+ *
+ * @param $visitorInstance An instance of a Visitor class
+ * @return void
+ * @todo Maybe visit some sub-objects
+ */
+ public function accept (Visitor $visitorInstance) {
+ // Visit this task
+ $visitorInstance->visitTask($this);
+ }
+
+ /**
+ * Executes the task
+ *
+ * @return void
+ * @todo 0% done
+ */
+ public function executeTask () {
+ $this->partialStub('Unimplemented task.');
+ }
+
+ /**
+ * Shuts down the task
+ *
+ * @return void
+ * @todo 0% done
+ */
+ public function doShutdown () {
+ self::createDebugInstance(__CLASS__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...');
+ }
+}
+
+// [EOF]
+?>
------------------+------+--------------------------------
map_expander | 0% | Expands the city map if needed
household_growth | 0% | Growths a single household
+ building_growth | 0% | Growths building
------------------+------+--------------------------------
- - - - -
4) The land value is not to high for the citizen (cannot effort to buy the
zone).
-5) There is no initial "building" (e.g. hut) on the zone or the existing
+5) There is an empty initial "building" (e.g. hut) on the zone or the existing
building is a multi-household building and has at least one appartment for
sale. Please note that rich people prefer low-density and high land-value
zones over high-density zones except it is an expansive multi-household
building.
+6) The demand for resitential is not below or zero. Below zero means that
+ people may give up their home (e.g. high taxes). Vacant appartments or
+ buildings are put on sale for the player (for a reduced price).
+
The task also checks if an existing household has 2 adults of different gender
(1 male, 1 female). Only under this condition reproduction is possible and a
3rd person may be added to it (after about 260-280 days). Adoption is not yet
simulated and may not be added. Please note that this is a city growth
simulation and not a social simulation.
+Simulating reproduction conditions is very complex as it depends on many
+factors. Both poor and rich people (including "middle rich") are repducing
+under same conditions for now.
+
+The task is also responsible for splitting large households (after the child
+has become adult) into smaller as adult "children" move out. It may happen that
+from the same "parents" adult "children" are moving into one household as
+relationships are *NOT* simulated. So even incest is possible and not prevent
+by the simulation as this is (again) a city growth simulation.
+
+- - - - -
+
+Task 'building_growth':
+-----------------------
+
+The task is responsible for growing buildings up to maximum size which the
+current "tech level" and density allows. For constructing a new building some
+conditions must be met:
+
+1) A road/path way must be nearby (will be always given but checked anyway).
+
+2) A zone must have minimum size (2x1, as 1 square is needed for distance to
+ road). This should be pre-checked by the user's client.
+
+3) No other building is already constructed on the zone, only one building per
+ zone is possible.
+
+4) The building type depends on "tech level" and density setting of the zone.
+
+Expansion of an existing building depends on other conditions:
+
+1) The bulding has not reached maximum size, depending on "tech level" and land
+ value. E.g. rich people will likely build a villa on the zone while poor
+ people may only build a small simple house on it.
+
+2) Zone density must be high enough to allow more stores being added, this has
+ a maximum depending on "tech level" and land value, see above.
+
+3) Demand for resitential is high enough, if nothing is demanded, no new
+ buildings are constructed and households are funded or expanded.
+
+4) A household has 3 or more adult members and they wish to move out.
+
[EOF]