Posted: 21st Jun 2007 14:09
Currently me and group mates are developing a game and based it in a novel....

but we experience a big problem when we tried o load the second map...

The texture didn't load and the game lags big time( i mean its slow)
we are using 3d world studio in creating a map and objects in .DBO format.

i don't know whats the problem on why the game is too slow..
is there a problem in the code or in the object?

here's the code:

+ Code Snippet
set display mode 800,600,16

sync on : sync rate 60
sync off

disable escapekey

rem SET UP =================================================================================

setup:

Set Camera Range .1, 5000

 Global ColliderObjNum As Integer
 ColliderObjNum = 2

 Global MovePerSec As Float
    MovePerSec = 240

 Global UseReticle As Boolean
   UseReticle = 1

 Global EyeHeight As Integer
   EyeHeight = 70

 Global MouseSens As integer
   MouseSens = 3

 Global Airborn as Boolean

 Global Gravity as Float
   Gravity = 512

rem END of SET UP =========================================================================

rem LOADING =================================================================

sandiego:

hide mouse
sync on
sync
part1_map()
sync

part1:

sync

  load image "\media\picture\manus.jpg",10,1

  paste image 10,100,0,0

ink RGB(74,72,72,),1
set text size 30
set text font "magneto"
center text screen width()/2,140, "PART I"

wait key

goto mainloop

mainloop:

do

   if Airborn=0 then CheckCollision()
   if Airborn=1 then Fall()
    Sync

loop



function part1_map()


Load Object "C:\THESIS_MAN\media\maps\part1map\sandiego.dbo", 1
Set Object Collision To Polygons 1

load object "C:\THESIS_MAN\media\sky\sky.x", 3
set object collision off 3
set object 3,1,1,0,0,0,0,0
scale object 3,5000000,500000,5000000

 Make Object Sphere ColliderObjNum, EyeHeight/2

 Set Object Collision On ColliderObjNum
 Hide Object ColliderObjNum

 Position Camera 0, 0, 0, 0
 Position Object ColliderObjNum, 10, 100, 100
 set camera range 0,1,3000000

 Set Ambient Light 100
 Fog Color RGB(128,128,128)
 Fog Distance 5000
 Fog On

 sync

 goto part1

endfunction

Function CheckCollision()

   Moving = 0


   ox#=Object Position x(ColliderObjNum)
   oy#=Object Position y(ColliderObjNum)
   oz#=Object Position z(ColliderObjNum)

   Delta#=MovePerSec/Screen FPS()

   If Delta#>EyeHeight
      Delta#=EyeHeight
   EndIf

   Rotate Object ColliderObjNum, Object Angle x(ColliderObjNum)+(MouseMovey()/MouseSens),Object Angle y(ColliderObjNum)+(MouseMovex()/MouseSens),0

   If Object Angle x(ColliderObjNum)>90 then XRotate Object ColliderObjNum,90
   If Object Angle x(ColliderObjNum)<-90 then XRotate Object ColliderObjNum,-90
   cx#=Object Angle x(ColliderObjNum)
   cy#=Object Angle y(ColliderObjNum)
   cz#=Object Angle z(ColliderObjNum)
   Rotate Camera cx#, cy#, cz#
   Rotate Object ColliderObjNum, cx#, cy#, cz#

   If UseReticle = 1
      circle screen width()/2,screen height()/2,8
   EndIf

   k$=upper$(Inkey$())


   `This code constitutes the movement functionality
   If keystate(17)=1
      `move the player forward
      XRotate Object ColliderObjNum,0
      Move Object ColliderObjNum,Delta#
      XRotate Object ColliderObjNum,cx#
   EndIf

   If keystate(31)=1
      `move the player backwards
      XRotate Object ColliderObjNum,0
      Move Object ColliderObjNum,0-Delta#
      XRotate Object ColliderObjNum,cx#
   EndIf

   If keystate(30)=1
      `strafe left
      XRotate Object ColliderObjNum,0
      YRotate Object ColliderObjNum,cy#-90
      Move Object ColliderObjNum,Delta#
      YRotate Object ColliderObjNum,cy#
      XRotate Object ColliderObjNum,cx#
   EndIf

   If keystate(32)=1
      `strafe right
      XRotate Object ColliderObjNum,0
      YRotate Object ColliderObjNum,cy#-90
      Move Object ColliderObjNum,0-Delta#
      YRotate Object ColliderObjNum,cy#
      XRotate Object ColliderObjNum,cx#
   EndIf

   nx#=Object Position x(ColliderObjNum)
   nz#=Object Position z(ColliderObjNum)

   ny#=EyeHeight + (oy#-Intersect Object(1, nx#, oy#, nz#, nx#, -1000, nz#))

   if nx# > ox#
      newxwest# = intersect object(1,nx#,ny#,nz#,nx#+(EyeHeight/2),ny#,nz#)
   endif

   if newxwest# > 0
      if newxwest# < object size x(2)/2
         nx# = ox#
      endif
   endif

   if object collision(ColliderObjNum,0) <> 0

      position object ColliderObjNum, ox#, ny#, nz#

      if object collision(ColliderObjNum, 0)<>0

         Position object ColliderObjNum, nx#, ny#, oz#

         If Object Collision(ColliderObjNum, 0)<>0

            If Object Collision(ColliderObjNum, 0)<>0

               ny#=oy#
               nx#=ox#
               nz#=oz#

            Else

               ny#=oy#

            EndIf

         Else

            nz#=oz#

         EndIf

     else

        nx# = ox#

     endif

   EndIf

   if (oy#-ny#) > EyeHeight

      AirBorn = 1
      ny#=oy#

      CheckFall()

   EndIF

   Position Camera 0, nx#, ny#, nz#
   Position Object ColliderObjNum, nx#, ny#, nz#

EndFunction

Function CheckFall()

   ox#=Object Position x(ColliderObjNum)
   oy#=Object Position y(ColliderObjNum)
   oz#=Object Position z(ColliderObjNum)

   ny#=EyeHeight + (oy#-Intersect Object(1, ox#, oy#, oz#, ox#, -1000, oz#))

   position object ColliderObjNum, ox#, ny#, oz#

   if object collision(ColliderObjNum,0) <> 0

      Airborn=0

   EndIf

EndFunction

Function Fall()

   ox#=Object Position x(ColliderObjNum)
   oy#=Object Position y(ColliderObjNum)
   oz#=Object Position z(ColliderObjNum)

   Delta#=Gravity/Screen FPS()

   ny#=EyeHeight + (oy#-Intersect Object(1, ox#, oy#, oz#, ox#, -1000, oz#))

   If (oy#-ny#)<=Delta#

      Position Object ColliderObjNum, ox#, ny#, oz#
      Position Camera 0, ox#, ny#, oz#

      Airborn = 0

   Else

      Position Object ColliderObjNum, ox#, oy#-delta#, oz#
      Position Camera 0, ox#, oy#-delta#, oz#

   EndIf

   If UseReticle = 1
      circle screen width()/2,screen height()/2,8
   EndIf

EndFunction



This is the code for the second part of the game...

Nid help plss...
Posted: 22nd Jun 2007 12:04
NID HELP hir...

any1 plsss....
Posted: 22nd Jun 2007 22:22
I think that you will need to delete the images containing the textures before you load any new ones. Try that, and see if the slow down improves.
Posted: 22nd Jun 2007 22:33
Are the map textures with the map?

Also, I noticed you scaled the sky box to a gigantic size. Try making it a alot smaller and seeing if that helps any. Other than that, it could just be your graphics card not being able to process that many polygons.

and this: set camera range 0,1,3000000

That's a huge range for the camera. I suggest scaling everything waaaay down. There doesn't appear to be anything wrong with your code, it just seems as if you've made everything too huge and your graphics card can't process it quickly enough.
Posted: 22nd Jun 2007 22:35
Stuff will go grey if you run out texture memory on your graphics card. make sure you kill any other programs accessing graphics such as your 3D editor.

set camera range 0,1,3000000

the recommended camera range is 3000 try scaling world down so it works and shrink the size of your players instead.

Also numbers over 16bit (65,000) are slow, try never to use them

When going to a new level delete everying in the old level first, it's taking up valuable memory.

Posted: 22nd Jun 2007 22:58
Oh. I forgot to mention, Try using: Flush Video Memory inbetween levels. Could help out alot!
Posted: 10th Jul 2007 8:21
yah the textures are in the map bush baby...

is it good or bad?

anyway thanks for the help guys!!!!!

i really appreciate it!!!!!!

i'll try it...