Monkey MiniB3D Information and Download Page

👉 BlitzCoder will be building a new platform and other plans to preserve and continue the Blitz legacy.

To be able to achieve this goal, we need your support by becoming a Patreon Paid Member 👈


Tweet 3d cross-platform monkey-x frameworks toolbox

Cross Platform 3D Module based on MiniB3D for Monkey-X

Platform Targets: Desktop, HTML5, Flash, Android, iOS, XNA

Author: Adam Redwoods

Last Release for Monkey-X

MiniB3D for Monkey-X

MiniB3D for Monkey-X XNA OpenGLES

Particle Candy for MiniB3D MonkeyX


Download Update


Required Fixes (3 Step):

  1. monkeyutility.monkey

change import.os to import.gametarget

  1. tcoltree.monkey

Remove or comment the first Private keyword under Class TColTree

  1. opengl/opengles20.monkey

below the draw tris comment, replace the If TRender.render.wireframe clause to

            '' draw tris

            If TRender.render.wireframe     

                #If TARGET<>"html5" 
                    If Not vbo Then glDrawElements(GL_LINE_LOOP,surf.no_tris*3,GL_UNSIGNED_SHORT,surf.tris.buf)
                If vbo Then glDrawElements(GL_LINE_LOOP,surf.no_tris*3,GL_UNSIGNED_SHORT, 0)

                If vbo  

                    glDrawElements(GL_TRIANGLES,surf.no_tris*3,GL_UNSIGNED_SHORT, 0)


                    #If TARGET<>"html5" 

markcwm commented:

Can you sticky this Ron? Thanks.

Also maybe just a link to the Particle Candy post would be better.

BlitzCoder commented:

done, thanks!

hardcoal commented:

I dont understand thsi minb3d monkey addon.. it only have cxs files.. no monkey demo at all..

BlitzCoder commented:

Hey HC, I have updated the download link that works with the latest version of Monkey-X

hardcoal commented:

thanks . but i get this error when i try to run it "Native OS Module not implemented"

BlitzCoder commented:

Are you building the HTML5 target?

Update: I have posted a 3 Step fix above or just download the updated files to get the module up and running, just tested on a fresh clean install of MX and minib3d link above as well.

This should solve the problem and will create a forked github repo reflecting this and possibly future fixes/updates.

matty47 commented:

I am using this minib3d with CerberusX and it seems to work well. Only problem I have had is being able to load models. It seems that models need to be .b3d models encoded in Base64 format. I have tried various encoders and written some in CerberusX, BlitzMax and python however the engine either fails to recognise the data or it does not load the model correctly - model is dark. I have UpdateNormals in the code so this is not the cause of the darkness. I have had success on Mac with "Base64Anywhere" which was a free download from the AppStore.
Is anyone using this moculde with MonkeyX or CerberusX? How do you encode your models for use in the module? Are there applications that work OK on Windows and/or Linux? THanks for your input.

BlitzCoder commented:

Hey there matty47, As I can recall any base64 encode decode tool will work w/o issues.

You can just test your preferred encode/decode tool with the provided zombie encoded file and see if it matches.

matty47 commented:

Thanks Ron. I am having problems with some of the Encoding tools. I think that there are various versions of Base64 and I am not sure if some of the functions that I used when programming a converter recognize the non ascii/utf chars that are in the blitz3d file. As I said the mac one is working fine it's just that there don't seem to be any .b3d converters / modellers for that platform so I am modelling on windows and converting with UU3d then using my mac to convert to Base64.
I'll inspect the zombie file and see if I can determine the correct format. I am trying not to overthink things.

I found that my test model had been corrupted - I had opened it in an editor and somehow the normal map had been combined with the diffuse map as a composite material and this was causing the "darkness" when loaded into minib3d. I fixed the materials and have found two ways that encode correctly.
Windows command.
Change to your model directory and run
"certutil -encode data.b3d tmp.b64 && findstr /v /c:- tmp.b64 > data.b64" (without the quotes)
cerutil and findstr are part of windows commands and obviously change data.b3d to your model name and data.b64 to the output file you want
You can convert back by using
"certutil -decode data.b64 data.b3d"

Python script.
import base64
import sys
data = open(sys.argv[1], "rb").read()
encoded = base64.b64encode(data)
f = open(sys.argv[2], 'w+b')
byte_arr = encoded
binary_format = bytearray(byte_arr)
Save this as say and then use with
python model.b3d outputfile.txt

Of course this requires that python be installed and in your PATH variable

farhad2023 commented:

I ran the Blitz 3D driver in Cerberus and corrected it a bit, but translation and alighn doesn't work, what's the reason?


Import minib3d.opengl.opengles20

Class MyApp Extends MiniB3DApp

    Const GRAVITY#=-.07
    'Const GRAVITY#=0
    Const BODY%=1,WHEEL%=2,SCENE%=3

    Field Camera:TCamera
    Field Light:TLight
    Field Cube:TMesh

    Field terr:TMesh
    Field car:TMesh

    Field target:TPivot

    Field speed#=0
    Field x_vel#=0,  prev_x#
    Field y_vel#=0,  prev_y#
    Field z_vel#=0,  prev_z#
 Field dx#,dy#,dz#

    Field wheels:TMesh[4+1]

    Field cnt%=1

    Field x#

    Field tex:TTexture

    Field zx#,zy#,zz#

    Method Create:Int()
        SetUpdateRate 60
        Return 0
    Method Update:Int()

        If KeyHit(KEY_CLOSE) Or KeyHit(KEY_ESCAPE) Then Error ""

        If KeyDown(KEY_Q) TranslateEntity car, 0, -GRAVITY*1.5, 0   

        'calculate car velocities   
        Local cx#=EntityX( car )  x_vel=cx-prev_x  prev_x=cx
        Local cy#=EntityY( car )  y_vel=cy-prev_y  prev_y=cy
        Local cz#=EntityZ( car )  z_vel=cz-prev_z  prev_z=cz

        'resposition wheels
            For Local z#=1.5 To -1.5 Step -3
            For Local x#=-1 To 1 Step 2
                PositionEntity wheels[cnt],0,0,0
                ResetEntity wheels[cnt]
                PositionEntity wheels[cnt],x,-1,z
'move car
        If KeyDown(KEY_A) TurnEntity car,0,3,0
        If KeyDown(KEY_D) TurnEntity car,0,-3,0

        If EntityCollided( car,SCENE )
            If KeyDown(KEY_W)
                If speed>.7 speed=.7
            Else If KeyDown(KEY_S)
                If speed<-.5 speed=-.5
            MoveEntity car,0,0,speed
            TranslateEntity car,0,GRAVITY,0
            TranslateEntity car,x_vel,y_vel+GRAVITY,z_vel

        If speed>=0
            dx=EntityX( target,True )-EntityX( Camera )
            dy=EntityY( target,True )-EntityY( Camera )
            dz=EntityZ( target,True )-EntityZ( Camera )
            TranslateEntity Camera,dx*.1,dy*.1,dz*1
        End If
        PointEntity Camera,car

        Return 0

    Method Render:Int()     
        Return 0

    Method Init:Int()

        Collisions BODY,SCENE,2,3
        Collisions WHEEL,SCENE,2,3

        'Cube = CreateCube()
        'Cube.PositionEntity -0.5,-2.5,8

        Light.TurnEntity 50,15,0
        PositionEntity Light,0,500,0        
        'Create Terrain
        terr = LoadMesh("terrain.b3d")
        ScaleMesh terr,2.0,2,2.0
        'PositionEntity terr,150,400,-50
        tex = LoadTexture("terrain-1.jpg")
        ScaleTexture tex,.1,.1
        EntityTexture terr,tex
        'EntityColor terr,0,125,0       
        EntityType terr,SCENE
'Load Car
        car = LoadMesh("car.b3d")
        'car = LoadMeshAnimation("p1.b3d")
        ScaleMesh car,1,1,-1
        FlipMesh car
        FitMesh car,-1.5,-1,-3,3,2,6
        PositionEntity car,0,340,0
        EntityShininess car,300
        EntityType car,BODY     

        prev_x=EntityX( car )
        prev_y=EntityY( car )
        prev_z=EntityZ( car )

        target = CreatePivot( car )
        PositionEntity target,0,10,-10

        CameraClsColor Camera,0,128,255
        CameraRange Camera,0.1,20000        
        For Local z#=1.5 To -1.5 Step -3
            For Local x#=-1 To 1 Step 2
                wheels[cnt]=CreateSphere( 8,car )
                EntityAlpha wheels[cnt],.5
            ScaleEntity wheels[cnt],.2,.4,.2
                EntityRadius wheels[cnt],.2
                PositionEntity wheels[cnt],x,0,z
                EntityType wheels[cnt],WHEEL

        Return 0
Function Main:Int()
    New MyApp   
    Return True
BlitzCoder commented:

That's because they have a different coordinate system so you need to make some adjustments.

Reply To Topic (minimum 10 characters)

Please log in to reply