Terrarium.Game.GameEngine.computeWorldHeight C# (CSharp) Method

computeWorldHeight() private static method

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.
private static computeWorldHeight ( ) : void
return void
        private static void computeWorldHeight()
        {
            _worldHeight = (int) (Math.Sqrt(10000*(_maxAnimals + _maxPlants)) + 1);
            if (_worldHeight < 1024)
            {
                _worldHeight = 1024; // ensures at least an 800x800 area for viewing purposes
            }

            double a = _worldHeight/1024.0;

            a = Math.Round(a + 0.5);

            _worldHeight = 1024*(int) a;

            _worldWidth = _worldHeight;
        }