tricks of the professionals

Blitz3D Forums/Blitz3D Programming/tricks of the professionals

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Blitz culls all entities not in view.


Not from my stand-point. In my FusionBall game none of my 16 players were being culled, and they were all separate entities. That is, I loaded one player mesh and used CopyEntity to make the 16 different players.

The difference between this and creating 100 cubes with the CreateCube() command, is that my players are all treated as one surface even if they are separate entities, able to be moved, rotated and resized as they like. Therefore I wrote my own culling routine which got my game running much faster. If I had 16 separate entities with separate surfaces, now that would be REALLY slow, and not worth Blitz's native culling.

The conclusion: Write your own culling routine, and use CopyEntity when you have more than 1 monster of the same type! The way that I did my culling was:

While KeyHit(1)=0
    For k=1 to frames
        ; GAME UPDATE SECTION
        For p.player = each player
            ShowEntity p\ent
        Next
    Next

    ; GAME DRAWING SECTION
    For p.player = each player
        If Not EntityInView(p\ent,cam) Then HideEntity p\ent
    Next
    RenderWorld
Wend


I'd show all entities for the game update for the sake of collisions etc. Then for rendering I'd hide the ones that weren't necessary. For a FPS with lots and lots of monsters you'd probably want to do it a bit differently.