Code viewer for World: New World
AB.clockTick       = 100;    

	// Speed of run: Step every n milliseconds. Default 100.
	
AB.maxSteps        = 100000;    

	// Length of run: Maximum length of run in steps. Default 1000.

AB.screenshotStep  = 100;   
  
	// Take screenshot on this step. (All resources should have finished loading.) Default 50.

 const OBJ_MONSTER = "/uploads/octa1936/knight.obj";
 
 const OBJ_HUMAN = "/uploads/octa1936/Human.obj";
 
 const HUMAN_SCALE = 70;
 
 const MONSTER_SCALE = 70;
 
 const MONSTER_TEXTURE = "/uploads/octa1936/Red_Color.jpg";

 const FILE_ARRAY = [
		"/uploads/starter/earth.1.jpg",  // array 0 to 4 are the earths 
		"/uploads/starter/earth.2.jpg",
		"/uploads/starter/earth.3.jpg",
		"/uploads/starter/earth.4.jpg",
		"/uploads/starter/earth.5.jpg",
		"/uploads/starter/baby.1.png",  // array 5
		"/uploads/starter/ghost.3.png"  // array 6 
		];
	
	
const SKYCOLOR 	= 0xccffcc;				// a number, not a string 

const ARMYSIZE = 40;       // an "army" of objects 

const objectsize = 500 ;

const WALKSTEP = 200;       // bounds of the random move per timestep 
                            // try 50 (vibrating sheet) versus 1000 (cloud)
         
const MAXPOS                = 4000 ;            // start things within these bounds                    
const startRadiusConst	 	= MAXPOS * 1.5 ;	// distance from centre to start the camera at
const maxRadiusConst 		= MAXPOS * 5 ;		// maximum distance from camera we will render things  


ABHandler.MAXCAMERAPOS 		= MAXPOS * 10 ;			// allow camera go far away 

ABWorld.drawCameraControls 	= false; 

AB.drawRunControls 			= false;

function loadObjects()
{
    var mosterload = new THREE.OBJLoader (new THREE.LoadingManager() );
    monsterload.load (OBJ_MONSTER, function ( object )
    {
        monsters = object;
        if( objAsynchFinished() ) initScene();
    });
    
    var monsterload1 = new THREE.TextureLoader();
    
    monsterload1.load (MONSTER_TEXTURE, function ( montex )
    {
       montex.minFilter = new THREE.LinearFilter();
       monster_texture = montex;
       if( objAsynchFinished() ) initScene();
    });
}

function objAsynchFinished()
{
    if(monster_texture) return True;
    else return False;
}


function initScene()
{
    monsters.position.x = 0;
    monsters.position.z = 0;
    monsters.position.y = 0;
    
    monsters.scale.multiplyScalar(MONSTER_SCALE);
    ABWorld.scene.add(monsters);
    
    ABWorld.render();		
  
	AB.removeLoading();
	
  	AB.runReady = true; 
  	
  	AB.msg ( ` <hr> <p> Multi-user game. Pick a side. Click buttons to change boxes on all users' machines. Drag the camera. <p>
  	        <button onclick='baby();'  class=ab-largenormbutton > Humans </button>  
            <button onclick='skull();'  class=ab-largenormbutton > Monsters </button> <p> ` );	
}

AB.world.newRun = function() 
{
	AB.loadingScreen();

	AB.runReady = false;  

	ABWorld.init3d ( startRadiusConst, maxRadiusConst, SKYCOLOR  ); 

//	loadResources();
	
	loadObjects();
};