FPS in OGRE3D - (SOLVED) by Dark Dragon

Advanced game related topics
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Re: FPS in OGRE3D - cannot be done!

Post by Rook Zimbabwe »

I did see that a while ago. AND while it has bullet detection there is no real collision detection. I put a cube into the game and ran right through it.

STILL

I will bang at it some more. If I can solve this at least partially it would make OGRE more functional for all of us. :mrgreen:
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Re: FPS in OGRE3D - cannot be done!

Post by Rook Zimbabwe »

here is how HE managed the collision:

Code: Select all

If Red(p)>230 And Green(p)<10 And Blue(p)<10
; checks for specific color under aimpoint... nice FAKE!!!
              EntityMaterial(#robot,MaterialID(1))
              hitStr.s="H"
              PlaySound(0)
              Break 
EndIf 
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
Nituvious
Addict
Addict
Posts: 1030
Joined: Sat Jul 11, 2009 4:57 am
Location: United States

Re: FPS in OGRE3D - cannot be done!

Post by Nituvious »

This is probably a dumb question, but are you using CheckEntityCollision() to test for collisions between two objects(player box and object)? I've never really played with OGRE in PB, but is CheckEntityCollision() not working?
▓▓▓▓▓▒▒▒▒▒░░░░░
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Re: FPS in OGRE3D - cannot be done!

Post by Rook Zimbabwe »

I get multiple errors in some weird C++ library notices if it is turned on...

The physics engine is supposed to bounce stuff... and it does in one section of the code the player entity bounces of walls and floor and everything quite well.

I think my initial problem is with the NODE idea... the camera and the object don't seem to link together.. then again I could be INSIDE the object looking out.

:shock:
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
DarkDragon
Addict
Addict
Posts: 2348
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Re: FPS in OGRE3D - cannot be done!

Post by DarkDragon »

bye,
Daniel
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Re: FPS in OGRE3D - cannot be done!

Post by Rook Zimbabwe »

Daniel... you keep making it happen! I posted a version of your code with 1000 cubes to bump in to and it works like a charm. I also love the HUGE plain idea... I saw that was possible in OGRE but could not make it happen!

Recalculate physics position after rendering instead before

This was the code that set it all up! I am reposting the code here only to show where I am going to get my examples. I have decided to write a bit of a document for the PB folks (them coming from Blitz3D especially) to explain OGRE.

I did not write this code but for 1 loop which if you reviewed previous code you would see and recognize. I also modified the camera position somewhat to make it slightly easier to see...

Code: Select all

#CameraSpeed = 1000

Procedure ScreenWidth()
  !extrn _PB_Screen_RealWidth
  !mov eax, dword [_PB_Screen_RealWidth]
  ProcedureReturn
EndProcedure

Procedure ScreenHeight()
  !extrn _PB_Screen_RealHeight
  !mov eax, dword [_PB_Screen_RealHeight]
  ProcedureReturn
EndProcedure

IncludePath #PB_Compiler_Home + "Examples\Sources\"
IncludeFile "Screen3DRequester.pb"

SetCurrentDirectory(#PB_Compiler_Home + "Examples\Sources")

Define.f KeyX, KeyY, MouseX, MouseY

If InitEngine3D()
  
  Add3DArchive(#PB_Compiler_Home + "Examples\Sources\Data", #PB_3DArchive_FileSystem)
  
  InitSprite()
  InitKeyboard()
  InitMouse()
  
  If Screen3DRequester()
    
    CreateMesh(0, 100)
    
    EnableWorldCollisions(1)
    EnableWorldPhysics(1)
    
    SetMeshData(0, #PB_Mesh_Vertex | #PB_Mesh_Normal | #PB_Mesh_UVCoordinate, ?CubeData, 8)
    SetMeshData(0, #PB_Mesh_Face, ?CubeDataIndex, 12)
    
    CreateMaterial(0, LoadTexture(0, "clouds.jpg"))
    MaterialAmbientColor(0, RGB(128, 255, 128))
    
    CreateMaterial(1, LoadTexture(1, "terrain_texture.jpg"))
    
    CreateEntity(0, MeshID(0), MaterialID(0))
    ScaleEntity(0, 0.3, 0.3, 0.3)
    
    CreateEntity(1, MeshID(0), MaterialID(1))
    EntityLocate(1, 0, -200, 0)
    ScaleEntity(1, 1000, 1, 1000)
    
    CreateCamera(0, 0, 0, 100, 100)
    CameraLocate(0, 0, 10, 100) ; was 1000
    
    EntityPhysicBody(1, #PB_Entity_StaticBody)
    EntityPhysicBody(0, #PB_Entity_BoxBody, #PB_Entity_AbsoluteBodyMove)
    
    ; RANDOM cubes
    
    For cx = 1 To 100
      For cy = 1 To 100
        doit = Random(10)
        If doit = 1
          Result = CopyEntity(0, #PB_Any)
          EntityLocate(Result, ey, 4.5, ez)
          EntityPhysicBody(Result, #PB_Entity_StaticBody)
          SetEntityMass(Result, 10.0)
        EndIf
        ez = ez + 450
      Next
      ey = ey + 450
      ez = 0
    Next
    
    CreateLight(0, RGB(255,255,255), 0, 100, 0)
    
    Repeat
      ;Screen3DEvents()
      
      ClearScreen(RGB(0, 0, 0))
      
      If ExamineKeyboard()
        If KeyboardPushed(#PB_Key_A)
          KeyX = -#CameraSpeed
        ElseIf KeyboardPushed(#PB_Key_D)
          KeyX = #CameraSpeed
        Else
          KeyX = 0
        EndIf
        
        If KeyboardPushed(#PB_Key_W)
          KeyY = -#CameraSpeed
        ElseIf KeyboardPushed(#PB_Key_X)
          KeyY = #CameraSpeed
        Else
          KeyY = 0
        EndIf
      EndIf
      
      If ExamineMouse()
        MouseX - MouseDeltaX() / 2
        MouseY - MouseDeltaY() / 2
      EndIf
      
      PointPick(0, ScreenWidth() / 2, ScreenHeight() / 2)
      
      RotateCamera(0, MouseY, MouseX, 0, #PB_Absolute)
      RotateEntity(0, 0, MouseX, 0, #PB_Absolute)
      MoveEntity(0, -KeyY * PickX() - KeyX * PickZ(), 0, -KeyY * PickZ() + KeyX * PickX())
      CameraLocate(0, EntityX(0), EntityY(0), EntityZ(0))
      
      ; with this delay it shows the fault:
     ; Delay(60)
      
      RenderWorld()
      ;Screen3DStats()
      FlipBuffers()
    Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
  EndIf
  
Else
  MessageRequester("Error", "The 3D Engine can't be initialized",0)
EndIf

End

#SQRT13 = 0.57735026

DataSection
  
  CubeData:
  
  Data.f -100.0,100.0,-100.0
  Data.f -#SQRT13,#SQRT13,-#SQRT13
  Data.f 1.0, 0.0
  
  Data.f 100.0,100.0,-100.0
  Data.f #SQRT13,#SQRT13,-#SQRT13
  Data.f 0.0, 0.0
  
  Data.f 100.0,-100.0,-100.0
  Data.f #SQRT13,-#SQRT13,-#SQRT13
  Data.f 0.0, 1.0
  
  Data.f -100.0,-100.0,-100.0
  Data.f -#SQRT13,-#SQRT13,-#SQRT13
  Data.f 1.0, 1.0
  
  Data.f -100.0,100.0,100.0
  Data.f -#SQRT13,#SQRT13,#SQRT13
  Data.f 0.0, 1.0
  
  Data.f 100.0,100.0,100.0
  Data.f #SQRT13,#SQRT13,#SQRT13
  Data.f 1.0, 1.0
  
  Data.f 100.0,-100.0,100.0
  Data.f #SQRT13,-#SQRT13,#SQRT13
  Data.f 1.0, 0.0
  
  Data.f -100.0,-100.0,100.0
  Data.f -#SQRT13,-#SQRT13,#SQRT13
  Data.f 0.0, 0.0
  
  
  CubeDataIndex:
  Data.w 0,2,3
  Data.w 0,1,2
  Data.w 1,6,2
  Data.w 1,5,6
  Data.w 4,6,5
  Data.w 4,7,6
  Data.w 0,7,4
  Data.w 0,3,7
  Data.w 0,5,1
  Data.w 0,4,5
  Data.w 2,7,3
  Data.w 2,6,7
  
EndDataSection
Do you know of a better way to make a ISOmetric viewpoint for the character cude?
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
Post Reply