메소드 | 설명 | |
---|---|---|
AddNewOrganism ( String assemblyPath, Point preferredLocation, System.Boolean reintroduction ) : |
Add a new organism to the terrarium using the given assembly to generate a species from, a preferred insertion point, and whether this is a reintroduction or not.
|
|
AddNewOrganism ( |
Add a new organism given the species of the creature, and the preferred location of insertion.
|
|
LoadEcosystemGame ( string dataPath, string fileName, TerrariumLed leds ) : void |
Creates a new game engine that can be used to load a pre-existing EcoSystem game.
|
|
LoadTerrariumGame ( string dataPath, string fileName, TerrariumLed leds ) : void |
Creates a game engine that loads an existing Terrarium game save state.
|
|
NewEcosystemGame ( string dataPath, string fileName, TerrariumLed leds ) : void |
Creates a new game engine that can be used to play an EcoSystem game.
|
|
NewTerrariumGame ( string dataPath, string fileName, TerrariumLed leds ) : void |
Creates a new game engine that can be used for a Terrarium game. Terrarium games aren't networked and can load any creatures.
|
|
OnEngineStateChanged ( EngineStateChangedEventArgs e ) : void |
Helper function for the EngineStateChanged event to fire the event given a new EngineStateChangedEventArgs
|
|
OnWorldVectorChanged ( WorldVectorChangedEventArgs e ) : void |
Helper function for the WorldVectorChanged event to fire the event given a new WorldVectorChangedEventArgs.
|
|
ProcessTurn ( ) : Boolean |
Processes turns in a phase manner. After 10 calls to ProcessTurn all 10 phases will be complete and the method will have completed one game tick.
|
|
ReceiveTeleportation ( Object teleportedObject, bool teleportedToSelf ) : void |
Receieves a teleported state either from a remote peer or the local peer.
|
|
RemoveOrganismQueued ( KilledOrganism killedOrganism ) : void |
Method used to add an organism to the organism removal queue.
|
|
StopGame ( Boolean serializeState ) : void |
Stops the game and determines if the final tick of data should be serialized.
|
|
Teleport ( OrganismState state ) : void |
Can be called with an OrganismState that needs to be teleported. Cannot be called during MoveAnimals since it passes true to the clearOld argument in RemoveOrganism.
|
메소드 | 설명 | |
---|---|---|
CalculateWorldSize ( ) : void |
This routine attempts to figure out how fast the machine is by running some standardized tests to test code execution speed. It then uses this information to determine how big the Terrarium world should be on this machine to maintain a decent frame rate. It also determines how big of a time slice we should give each animal.
|
|
GameEngine ( string dataPath, bool useNetwork, bool deserializeState, string fileName, bool reportData, TerrariumLed leds, bool trackLastRun ) : System |
Constructs a new game engine.
|
|
burnBaseEnergy ( ) : void | ||
changeMovementVectors ( ) : void |
Helper function to change movement vectors for all creatures after they have processed their turn and determined new points of destination.
|
|
computeWorldHeight ( ) : void |
Now lets compute worldheight Each animal needs a certain amount of territory so we can compute a density. 10,000 pixels per plant/animal is the key at this point.
|
|
countOrganism ( OrganismState state, PopulationChangeReason reason ) : void |
Adds another organism to the count of organisms. Depending on the organism type either plants or animals will be incremented.
|
|
deserializeState ( string path ) : void |
Deserializes the game state from the given path.
|
|
doAntennas ( ) : void |
Helper function to update all state objects with the latest antenna information after the creature's have processed their ticks.
|
|
doAttacks ( ) : void | ||
doBites ( ) : void |
Assumes the animal was dead (if an animal) at the time of the bite and that it is the proper food source for this animal (herbivore or carnivore) Also assumes that it is within biting range.
|
|
doDefends ( ) : void |
We only send these events so that animals can easily continue defending if they want to. There is no information in them
|
|
estimateNumberOfAnimalsToSupport ( ) : void |
This is where we attempt to estimate how many animals we can support on this machine. We assume we want 20 frames a second and we do two engine ticks per second which means we have 500 msec per engine tick. We budget our paint time 200 mSec, and that leaves 300 mSec for all engine processing. We assume we'll allocate 4/5 of our available engine processing time to running animals, and 1/5 to plants. organismQuanta is how many microseconds each animal will get, so we have to divide by 1000 to get milliseconds. We assume that we can use all engine processing time for running animals although this isn't strictly true since we need to run the engine code too. It's OK, because animals can't use all their allocated time every tick -- they'll eventually get killed. Thus, we use the time they don't use for the engine processing. It's all basically an estimate, that we've tuned and works pretty well.
|
|
findEmptyPosition ( int cellRadius, Point preferredGridPoint ) : Point |
Finds a location within the current game world where no organisms exist.
|
|
giveEnergyToPlants ( ) : void | ||
growAllOrganisms ( ) : void | ||
heal ( ) : void | ||
incubate ( ) : void | ||
insertOrganismsFromQueue ( ) : void |
Inserts all new organisms from the queue when it is safe to insert them. This happens so that all new organism are inserted at the same time in a serial manner rather than in multiple phases.
|
|
killDiseasedOrganisms2 ( ) : void | ||
killOrganisms ( IDictionary organismsToKill, int organismKillCount, int totalPopulation, bool killingAnimals ) : void | ||
moveAnimals ( ) : void | ||
removeOrganism ( KilledOrganism killedOrganism ) : void |
Method used to remove an organism given a KilledOrganism object. This method instantly removes the organism and so should not be called by normal code, rather call RemoveOrganismQueued.
|
|
removeOrganismsFromQueue ( ) : void |
Method used to remove organisms that have been queued for removal.
|
|
serializeState ( string path ) : void |
Serializes the game state to the given path.
|
|
sortOrganismsForDisease ( IDictionary plantsToKill, IDictionary animalsToKill, IList deadAnimals ) : void |
Fills in the hashtables with sorted lists keyed on SpeciesName
|
|
startReproduction ( ) : void | ||
teleportOrganisms ( ) : void | ||
uncountOrganism ( OrganismState state, PopulationChangeReason reason ) : void |
Subtracts an organism from the count of organisms. Depending on the organism type either plants or animals will be decremented.
|
public AddNewOrganism ( String assemblyPath, Point preferredLocation, System.Boolean reintroduction ) : |
||
assemblyPath | String | The path to the assembly used for this creature. |
preferredLocation | Point | The preferred point of insertion. |
reintroduction | System.Boolean | Controls if this is a reintroduction. |
리턴 |
public AddNewOrganism ( |
||
species | The species for the new organism. | |
preferredLocation | Point | The preferred insertion point. |
리턴 | void |
public static LoadEcosystemGame ( string dataPath, string fileName, TerrariumLed leds ) : void | ||
dataPath | string | The path where the Terrarium game will be stored. |
fileName | string | The path to the serialized Terrarium. |
leds | TerrariumLed | A series of leds to be used for state reporting. |
리턴 | void |
public static LoadTerrariumGame ( string dataPath, string fileName, TerrariumLed leds ) : void | ||
dataPath | string | The path where the Terrarium game will be stored. |
fileName | string | The path to the serialized Terrarium. |
leds | TerrariumLed | A series of leds to be used for state reporting. |
리턴 | void |
public static NewEcosystemGame ( string dataPath, string fileName, TerrariumLed leds ) : void | ||
dataPath | string | The path where the Terrarium game will be stored. |
fileName | string | The path to the serialized Terrarium. |
leds | TerrariumLed | A series of leds to be used for state reporting. |
리턴 | void |
public static NewTerrariumGame ( string dataPath, string fileName, TerrariumLed leds ) : void | ||
dataPath | string | The path where the Terrarium game will be stored. |
fileName | string | The path to the serialized Terrarium. |
leds | TerrariumLed | A series of leds to be used for state reporting. |
리턴 | void |
public OnEngineStateChanged ( EngineStateChangedEventArgs e ) : void | ||
e | EngineStateChangedEventArgs | Properties identifying the change to the engine. |
리턴 | void |
public OnWorldVectorChanged ( WorldVectorChangedEventArgs e ) : void | ||
e | WorldVectorChangedEventArgs | References to the new and old vectors. |
리턴 | void |
public ReceiveTeleportation ( Object teleportedObject, bool teleportedToSelf ) : void | ||
teleportedObject | Object | The teleported object. |
teleportedToSelf | bool | Whether the teleportation is local or from a remote peer. |
리턴 | void |
public RemoveOrganismQueued ( KilledOrganism killedOrganism ) : void | ||
killedOrganism | KilledOrganism | The organism to remove. |
리턴 | void |
public StopGame ( Boolean serializeState ) : void | ||
serializeState | Boolean | Controls if the state is serialized. |
리턴 | void |
public Teleport ( OrganismState state ) : void | ||
state | OrganismState | The state of the creature to be teleported. |
리턴 | void |