Enhancements
The 2D BSP tree that you created in this chapter is pretty cool and gives you the ability to create some cool scenes, but there's always room for improvement. Here are a few ideas for enhancement:
- When building the tree, create a better partition-selection algorithm that creates a more balanced tree and minimizes polygon splits.
- Save the built BSP tree to a file so you don't have to calculate it at startup every time.
- Use a 3D BSP tree instead of a 2D one so you can have polygons that aren't horizontal or vertical, such as ramps and sloping ceilings.
- Use the z-buffer to draw particles for effects such as explosions.