RealmCrafter Wiki
Advertisement

Created by cysis145 on the RealmCrafter: Community Edition forums.

This edit is generally improve the 3D background on the main menu. This edits improves performance. For this tut i will be going through each section in order that they appear in the client.Exe Note that i haven't included a section for the start menu, since i removed it from my client.

Make a backup before starting this tut!!!

If you've already added a 3d background from v1.0 of this tut then you should undo all those changes. follow the v1.0 tut again but backwards and undo the changes.

Open MainMenu.bb and start by finding Function EULAScreen(). Add

 If FileType("Data\Meshes\Character Set\E_Set.eb3d") = 1
      Set = LoadMesh("Data\Meshes\Character Set\E_Set.eb3d")
      If Set = 0 Then RuntimeError("Could not load Data\Meshes\Character Set\E_Set.eb3d!")
   Else
      Set = LoadMesh("Data\Meshes\Character Set\Set.b3d")
      If Set = 0 Then RuntimeError("Could not load Data\Meshes\Character Set\Set.b3d!")
   EndIf
;Possition set
   PositionEntity Set, -210, -35, -145
   ScaleEntity Set, 30, 30, 30

under

 ; Do not display if .txt file is empty
   If FileType("Data\Game Data\EULA.txt") <> 1 Or FileSize("Data\Game Data\EULA.txt") = 0
      Return
   EndIf

This will load the 3d model. Next add

 Background = GY_CreateQuad(Cam)
   PositionEntity(Background, -7.5, 7.0, 10.0)
   ScaleEntity(Background, 15, 14.0, 1.0)
   EntityOrder(Background, -1)
   Tex = LoadTexture("Data\Textures\Menu\EULA.png")
   EntityTexture(Background, Tex)
   FreeTexture(Tex)

under

;Possition set
   PositionEntity Set, -210, -35, -145
   ScaleEntity Set, 30, 30, 30

it should now look something like...

Function EULAScreen()

   ; Do not display if .txt file is empty
   If FileType("Data\Game Data\EULA.txt") <> 1 Or FileSize("Data\Game Data\EULA.txt") = 0
      Return
   EndIf
; Background
   
   If FileType("Data\Meshes\Character Set\E_Set.eb3d") = 1
      Set = LoadMesh("Data\Meshes\Character Set\E_Set.eb3d")
      If Set = 0 Then RuntimeError("Could not load Data\Meshes\Character Set\E_Set.eb3d!")
   Else
      Set = LoadMesh("Data\Meshes\Character Set\Set.b3d")
      If Set = 0 Then RuntimeError("Could not load Data\Meshes\Character Set\Set.b3d!")
   EndIf
;Possition set
   PositionEntity Set, -210, -35, -145
   ScaleEntity Set, 30, 30, 30

   
   Background = GY_CreateQuad(Cam)
   PositionEntity(Background, -7.5, 7.0, 10.0)
   ScaleEntity(Background, 15, 14.0, 1.0)
   EntityOrder(Background, -1)
   Tex = LoadTexture("Data\Textures\Menu\EULA.png")
   EntityTexture(Background, Tex)
   FreeTexture(Tex)

IMPORTANT: you must create a texture and call it EULA (must be a .png) and put it in "\textures\menu\" folder, if you dont, it will cause a mav. This texture will appear behind the text for your EULA if you have one. It should be 700x690 res (default) but you can adjust the scale and location of the image yourself.

Next find Function LogIn() replace

Background = GY_CreateQuad(Cam)
   PositionEntity(Background, -10.0, 7.5, 10.0)
   ScaleEntity(Background, 20.0, 15.0, 1.0)
   EntityOrder(Background, 1)
   Tex = LoadTexture("Data\Textures\Menu\Login.png")
   If Tex = 0 Then RuntimeError("File not found: Data\Textures\Menu\Login.png!")
   EntityTexture(Background, Tex)
   FreeTexture(Tex)

with

;Background
   Background = GY_CreateQuad(Cam)
   PositionEntity(Background, 0, 0, 10.0)
   ScaleEntity(Background, 7.0, 2.9, 1.0)
   EntityOrder(Background, -1)
   Tex = LoadTexture("Data\Textures\Menu\LoginBox.png")
   EntityTexture(Background, Tex)
   FreeTexture(Tex)
   
   Background3 = GY_CreateQuad(Cam)
   PositionEntity(Background3, -0.64, 1.4, 2)
   ScaleEntity(Background3, 1.35, 0.7, 1.0)
   EntityOrder(Background3, -1)
   Tex3 = LoadTexture("Data\Textures\Menu\Menu Logo.png", 4)
   EntityTexture(Background3, Tex3)
   FreeTexture(Tex3)

IMPORTANT: just like before you'll need to create 2 new textures and put them in \textures\menu\ folder. Both MUST be .png. LoginBox.png is the texture you want to appear behind the login text fields etc. Menu Logo.png is your GAME LOGO.

For some reason if you try to remove the Sprite (old logo code) in Character Select it causes a MAV the easiest fix is to make your "Menu Logo.bmp" just black, it will come up as transparent and you wont be able to see it. It can be found in "Data\Textures\".

Next in Function RunMenu() add

  ; Setfogrange Distance and colour
   CameraRange Cam, 1, 30000
   CameraFogMode Cam,1
   CameraFogRange Cam, 300, 5200
   CameraFogColor Cam, 0, 51, 102

below

GY_Load(Cam)

You can adjust those settings to your hearts content.

Now for creating dynamic Lights in your set. Before moving onto this section you must know you cannot have more than 8 lights rendering at once or Blitz will crap itself and just die. Keep that in mind when designing your set. Now starting with Ambient lighting add

 ;Ambient Light
   Amb_Light = CreateLight(1) ;the 1 means ambient
   LightRange Amb_Light, 10000 ;range (want it high so it reaches everything)
   LightColor Amb_Light, 0, 51, 102 ;RBG colour
   PositionEntity Amb_Light, 0, 1000, 0 ;XYZ positioning

under

  ; Setfogrange Distance and colour
   CameraRange Cam, 1, 30000
   CameraFogMode Cam,1
   CameraFogRange Cam, 300, 5200
   CameraFogColor Cam, 0, 51, 102

To add an omni light add the following

;Omni Lights
   Om_Light1 = CreateLight(2) ; 2 means omni
   LightRange Om_Light1, 150
   LightColor Om_Light1, 204, 102, 0
   PositionEntity Om_Light1, -400, 300, 800

under your ambient light code. if you want to add another then just change the name of the light for example

 Om_Light2 = CreateLight(2)
   LightRange Om_Light2, 150
   LightColor Om_Light2, 204, 102, 0
   PositionEntity Om_Light2, -300, 250, 300

etc. It should end up looking something like...

Function RunMenu()

   F = ReadFile("Data\Options.dat")
   If F = 0 Then RuntimeError("Could not open Data\Options.dat!")
      Width = ReadShort(F)
      Height = ReadShort(F)
      Depth = ReadByte(F)
      AA = ReadByte(F)
      DefaultVolume# = ReadFloat#(F)
      GrassEnabled = ReadByte(F)
      AnisotropyLevel = ReadByte(F)
      FullScreen = ReadByte(F)
      VSync = ReadByte(F)
   CloseFile(F)

   ResolutionType = 0 ; !WideScreen Ratio 4:3 Ramoida 
   If GfxMode3DExists(Width, Height, 16) Or GfxMode3DExists(Width, Height, 32) 
      If (Width * 9) = (Height * 16) Then  ResolutionType = 1 ; WideScreen Ratio 16:9 Ramoida 
         
       Select FullScreen 
          Case 0 
             Graphics3D(Width, Height, Depth,2) 
            Initext
          Case 1 
             Graphics3D(Width, Height, Depth,1) 
            Initext
       End Select 
    Else 
       Select FullScreen 
          Case 0 
             Graphics3D(800, 600, 0,2) 
            Initext
          Case 1 
             Graphics3D(800, 600, 0,1) 
         
            Initext
       End Select 
    EndIf

   
   HidePointer()
   TextureFilter("m_", 1 + 4)
   TextureFilter("a_", 1 + 2)
   PlayIntroMovie()
   Cam = CreateCamera()
   
   ;WideScreen Adjust Camera 
   GYFovCam Cam, Width , Height


   GY_Load(Cam)
   
   
   ; Setfogrange Distance and colour
   CameraRange Cam, 1, 30000
   CameraFogMode Cam,1
   CameraFogRange Cam, 300, 5200
   CameraFogColor Cam, 0, 51, 102
   
   ;-------
   ;LIGHTS
   ;-------
   ;Ambient Light
   Amb_Light = CreateLight(1)
   LightRange Amb_Light, 10000
   LightColor Amb_Light, 0, 51, 102 
   PositionEntity Amb_Light, 0, 1000, 0
   ;Omni Lights
   Om_Light1 = CreateLight(2)
   LightRange Om_Light1, 150
   LightColor Om_Light1, 204, 102, 0
   PositionEntity Om_Light1, -400, 300, 800
   
   Om_Light2 = CreateLight(2)
   LightRange Om_Light2, 150
   LightColor Om_Light2, 204, 102, 0
   PositionEntity Om_Light2, -300, 250, 300
   
   Om_Light3 = CreateLight(2)
   LightRange Om_Light3, 120
   LightColor Om_Light3, 204, 102, 0
   PositionEntity Om_Light3, -100, 25, 100

You will have to change the Location of each light (ambient doesn't matter where it goes) to where you want it.

I think thats it, if your having any problems then leave a comment as i may have left something out. Adding Lights to bones on a model will be V3.0 and is not ready yet so i'll upload that at a later date once i get it working again.

Advertisement