Exchanging entity meshes

Blitz3D Forums/Blitz3D Programming/Exchanging entity meshes

ZombieWoof(Posted 2004) [#1]
I'm working up a game where there will be a fairly good size village where the player can enter buildings for various purposes. My problem is that with the number of buildings, and the level of interior detail, I'm afraid I'm gonna end up processing a huge number of polys that arent visible when the player is standing out in the street.

What I'm wondering is if its possible, when the player clicks on the door to enter a building, that I exchange the current mesh (building exterior only) for a full building mesh including interior detail ?? and when they leave, switch back to the exterior only mesh ??

Is this a reasonable approach, or is there a better way ??

(BSP isnt currently an option as my artists have never worked with BSP level editors before, and we are on something of a short timeline to get something together !!)


Zethrax(Posted 2004) [#2]
The best idea is probably to have your interior and exteriors as separate meshes and use 'EntityAlpha' or 'HideEntity' to hide whichever mesh doesn't need to be drawn.


A couple of things to be aware of are that 'EntityAlpha' doesn't work on any child meshes parented to the main mesh you're setting the Alpha level for. You'll need to sequence the child meshes and set their alpha levels individually, if you need to do this.

Also, 'HideEntity' will disable collisions and picking for the entity being hidden, which may cause problems if you have other game characters, etc, which may need to interact with the hidden mesh.


Shambler(Posted 2004) [#3]
I would have the interior as a separate mesh.

Then, have a working door and code which performs the following function...

Door open > draw exterior and interior
Door closed and player outside > hide interior
Door closed and player inside > hide exterior

make the door auto shut after a set time.


ZombieWoof(Posted 2004) [#4]
Perfect -- much easier/faster than exchanging meshes :)

In this particular instance, its a single player game, so coping with other characters isnt a problem. so HideEntity should handle it all

HideEntity gets the child meshes too ??


John Blackledge(Posted 2004) [#5]
The HideEntity/ShowEntity method (working thru your own lists for different areas) is the winner.
I currently have a system where when you click on a door, by the time the door creak has finished the next area's entities are showing, and the last area's entities are hidden, and the camera is moved forward a few paces.