1 (edited by Amon 2007-12-05 12:30:02)

Topic: arrays.ini - i3ImpactRunBegin()

Hi! I have (as the 3impact docs suggest) created an arrays.ini file and placed it in my app folder. The reason I have created the arrays.ini file is so that I can override the default setting for 3impacts Maximum bodiesbodies count. By default it was set to 1000 but I needed to be able to create more collision couples.

When I run my app with the new settings (set to 5000 bodiesbodies) I get an unhandled exception in BlitzMax and it points to i3ImpactRunBegin().

See next post.

Re: arrays.ini - i3ImpactRunBegin()

Hi again. It seems that if I add a delay after myengine.start it loads up all the blocks but still gives me an error on

SuperStrict
Framework _3Impact.Lib
Import brl.linkedlist

If Not i3ImpactOpen() RuntimeError "Unable to initialize the 3Impact game engine"
If Not i3ImpactSettings(_ISETTINGS(640,480,32,False,True)) RuntimeError "3Impact settings failed"

Local myEngine:bmx_3IEngine=New bmx_3IEngine

Global CubeArray:Int[8, 8] 

Local Ddata:Int
For Local yiter:Int = 0 Until 8
    For Local xiter:Int = 0 Until 8
        
        ReadData Ddata
        CubeArray[xiter, yiter] = Ddata
    Next
Next

Type THolderBlock
    Field x:Int
    Field y:Int
    Field rot:Float
    Field FMesh:MESH
    Field FBody:BODY
    Field FVector:D3DXVECTOR3
    
    Global Created:Int = 0
    Global List:TList
    
    Function Create() 
        If Not THolderBlock.List
            THolderBlock.List = CreateList() 
        End If
        For Local y1:Int = 0 Until 8
            For Local x1:Int = 0 Until 8
                If CubeArray[x1, y1] = 1
                    Local th:THolderBlock = New THolderBlock
                    th.FVector = _D3DXVECTOR3() 
                    th.FVector.x = x1 * 2.0
                    th.FVector.y = y1 * 2.0
                    th.FVector.z = 0.0
                    th.FBody = iBodyCreate("res\\models\\holder1_5.00.ply") 
                    th.FMesh = iBodyMeshCreate("res\\models\\holder1.x", th.FBody) 
                    THolderBlock.List.AddLast(th) 
                End If
            Next
        Next
        
        
    End Function
End Type

Type TRedBlock
    Field x:Float = 0.0
    Field y:Float = 0.0
    Field Vec:D3DXVECTOR3
    Field RMesh:MESH
    Field RBody:BODY
    Field Duo:BODYBODY
    Field Duo2:BODYBODY
    
    Global List:TList
    
    Function Create() 
        If not TRedBlock.List
            TRedBlock.List = CreateList() 
        End If
        For Local y:Int = 0 Until 8
            For Local x:Int = 0 Until 8
                If CubeArray[x, y] = 2
                    Local r:TRedBlock = New TRedBlock
                    r.Vec = _D3DXVECTOR3() 
                    r.Vec.x = x * 2.00
                    r.Vec.y = y * 2.00
                    r.Vec.z = 0.0
                    r.RBody = iBodySGCreate("res\\models\\redcube_.spg", 2.0) 
                    r.RMesh = iBodyMeshCreate("res\\models\\redcube.x", r.RBody) 
                    For Local th:THolderBlock = EachIn THolderBlock.List
                        r.duo = iBodyBodyCreate(r.RBody, th.FBody) 
                        iBodyBodyEnable(r.Duo, True) 
                        iBodyBodyFrictionModelSet(r.Duo, 0) 
                        iBodyBodyRestitutionSet(r.Duo, 0.0) 
                        iBodyBodyFrictionSet(r.Duo, 30.0) 
                    Next
                    For Local r2:TRedBlock = EachIn TRedBlock.List
                        If r.RBody = r2.RBody Continue
                            r.Duo2 = iBodyBodyCreate(r.RBody, r2.RBody) 
                            iBodyBodyEnable(r.Duo2, True) 
                            iBodyBodyFrictionModelSet(r.Duo2, 0) 
                            iBodyBodyRestitutionSet(r.Duo2, 0.0) 
                            iBodyBodyFrictionSet(r.Duo2, 30.0) 
                        
                    Next
                    TRedBlock.List.AddLast(r) 
                    
                End If
            Next
        Next
    End Function
    
End Type

Global Cam:CAMERA
' begin 3Impact processing
myEngine.Start() 
Local TTicks:Int = 0
Local Time:Int = MilliSecs() 
Repeat
    If MilliSecs() > Time + 20
        tticks:+1
        Time = MilliSecs() 
    End If

Until tticks >= 100

Type bmx_3IEngine Extends _3IEngine 
' called to initialize game variables, load resources, etc
Method _Init() 

    iFrqSet(1.0 / 85.0) 
    Cam = iCameraCreate(0.0, 0.0, 1.0, 1.0) 
    iCameraLocationSet(Cam, _D3DXVECTOR3(6.0, 5.0, - 16.0)) 
'    iCameraFovSet(Cam, 80.0) 
    iLightDirectionalSet(_D3DXVECTOR3(1.0, - 1.0, 1.0), _D3DXVECTOR4(1.0, 1.0, 1.0, 0.35)) 
    
    THolderBlock.Create() 
    TRedBlock.Create() 
    
    For Local th:THolderBlock = EachIn THolderBlock.List
        iBodyEnable(th.FBody) 
        iMeshShow(th.FMesh) 
    Next

    For Local r:TRedBlock = EachIn TRedBlock.List
        iMeshShow(r.RMesh) 
        iBodyEnable(r.RBody) 
    Next
        
    For Local th:THolderBlock = EachIn THolderBlock.List
        iMeshLocationSet(th.FMesh, _D3DXVECTOR3(th.FVector.x, th.fvector.y, th.fvector.z)) 
        iBodyLocationSet(th.FBody, _D3DXVECTOR3(th.FVector.x, th.fvector.y, th.fvector.z), True) 
    
    Next

    For Local r:TRedBlock = EachIn TRedBlock.List
        iMeshLocationSet(r.RMesh, _D3DXVECTOR3(r.Vec.x, r.Vec.y, r.Vec.z)) 
        iBodyLocationSet(r.RBody, _D3DXVECTOR3(r.Vec.x, r.Vec.y, r.Vec.z), True) 
     
        iBodyDampingSet(r.RBody, 8.0, 1.0, 0.0, 0.0) 
        
    Next
        
EndMethod


' the main game loop
Method _Run()
EndMethod


' called when the application exits in order to clean up
Method _Exit()
EndMethod 
EndType 

DefData 1, 1, 1, 1, 1, 1, 1, 1
DefData 2, 2, 2, 2, 2, 2, 2, 2
DefData 2, 2, 2, 2, 2, 2, 2, 2
DefData 2, 2, 2, 2, 2, 2, 2, 2
DefData 2, 2, 2, 2, 2, 2, 2, 2
DefData 2, 2, 2, 2, 2, 2, 2, 2
DefData 2, 2, 2, 2, 2, 2, 2, 2
DefData 2, 2, 2, 2, 2, 2, 2, 2
DefData 2, 2, 2, 2, 2, 2, 2, 2
DefData 2, 2, 2, 2, 2, 2, 2, 2

Re: arrays.ini - i3ImpactRunBegin()

Has anyone been able to get my example working with BlitzMax and the modified arrays.ini?

Re: arrays.ini - i3ImpactRunBegin()

i can replicate your problem but not get it working.  a big issue is that the error is on a call to 3Impact.  one thought i had was to try to replicate as much of it as possible in DevCPP to see if it has the same issue.  if so, then it would be good to submit the issue to 3Impact.

Re: arrays.ini - i3ImpactRunBegin()

Hi GMan! I asked someone on the 3impact forums to test it for me in DEVC++ and all is working fine for them. The issue appears to be with the BMax version where having more than the allocated amount of bodybody collisions seems to crash the engine.

If I were to take out the loop that delays the 3impact starting it seems to load the models and blocks but crashes out. I'll do some more tests and see if I can pin down what's causing it.

Thank You for your help! smile