TUTORIAL FOUR Loading The World The first order of business is to create a world in which our game will be set. Once upon a time this was a very difficult proposal and would often become the first major stumbling block for many would be game writers. With the built in BSP commands however, such a task is mind bogglingly simple.

With a single command we can load an entire BSP world. The BSP file contains information about polygons, collision, textures and even special effects also known as shaders. With a second command we can create a skysphere to provide an enclosed environment for our world:
    rem TUT4A
    rem Load BSP world and sky model
    load bsp "world\ikzdm1.pk3","ikzdm1.bsp"
    SkyObj=1 : load object "models\sky\am.x",SkyObj
When the BSP world and sky are loaded, we must setup the camera and ensure the autocam does not start moving around without our direct control. We must also scale down the size of the sky to bring it closer so we bring it within the maximum distance of our 3D universe and switch off sky culling so polygons that would normally show from the outside of the sky sphere will now show on the inside as well:
    rem TUT4B
    rem Setup camera
    set camera range 1,10000
    autocam off

    rem Setup sky model
    set object SkyObj,1,0,0,0,0,0,0
    scale object SkyObj,20,20,20
In order that the user stay informed, we will provide a text prompt when the BSP is loading. Sometimes BSP worlds can be very large and can take minutes to fully load, so an onscreen prompt is very important. In order to make our game as presentable as possible, we will choose a nice large font:
    rem TUT4C
    rem Select font
    set text font "arial" : set text size 16
    set text to bold : set text transparent

    rem Loading prompt
    sync : center text screen width()/2,screen height()/2,"LOADING" : sync
The reason for the pre and post additions of the SYNC command is that we have initialised our program with the SYNC ON command. This tells the computer that we would like to update the screen ourselves; manually. In order to see the loading prompt, a sync must be made after we have drawn the text. CLICK HERE TO GO TO THE MAIN MENU