This project is read-only.

loading BSPs during run time

Oct 31, 2008 at 1:31 AM
Can you load a bsp file during run time instead of having to add it to the project? I just want to be able to keep all my BSPs in a map folder and load them as needed.
Oct 31, 2008 at 5:17 AM
BSP files aren't yet loaded via the content pipeline, so there would be no problem doing this. You'll have to add your texture and shader files to the project though.
Oct 31, 2008 at 2:46 PM
are there plans to make it so you don't have to add the textures and shaders to the project?

Good work btw.
Oct 31, 2008 at 3:27 PM
Not at the moment. It would be fairly easy to mod the project so that it would load at runtime, though. In Q3BSPShaderManager, change all the Content.Load<Texture2D>() methods to Texture2D.FromFile(), and make sure you're looking in the right place.

 The shader files would be a bit harder, as there's a bit of preprocessing done to them. I suppose you could take the ShaderContentImporter class from the Content Pipeline project and add it to the main library, then call that to turn a .shader file into a Dictionary<string, Q3BSPMaterial>. If you need any help with that don't hessitate to ask.
Oct 31, 2008 at 3:32 PM
I should be able to do that. One last question. How feasible is a Q3 BSP for large terrain? I'm thinking like a GTA city type level structure. Would it be simpler/efficient to just load one giant BSP or iteratively load different BSPs?

Also thanks for getting back to me. All the other projects on codeplex i've tried to contact have been... unfriendly.
Nov 6, 2008 at 8:17 AM
Sorry for the lateness, it's been a hell of a week.

BSPs are at their worst in large, open areas. Grand Theft Auto style games use a different method, where high resolution models are used for near objects and progressively lower level-of-detail models are used for far away things, and the game constantly streams these in and out as the player moves around. I'm not really familiar with how it's done, but there's probably a grid centered on the player that sets what areas get what LOD.

That's not to say that you couldn't use a BSP. I'd make sure to mark as many brushes as possible as detail as with large areas you're going to have a whole lot of leaves generated. Using more than one BSP would be a good idea, but you could not render them BSP style, for if the player is outside the bounds of any leaf there is nothing really to draw. The static rendering method would get past that but you'll have more of the mesh to draw each frame.

I'd look into ways to load the vertex and index buffers from statically rendered BSP files into a more generalized model class, which could then utilize mesh optimization algorithms and automatically create lower level of detail meshes. Then you could the use a grid based method to render these meshes. I know the C++ Direct libraries have classes for this but I don't think they're put into XNA. XNA's built in Model class doesn't have any of the progressive mesh algorithms built in. You'd probably have to implement it yourself, and the methods should be pretty easy to find on the internet.
Nov 6, 2008 at 2:47 PM
Hmm.. I'll have to look into that. I don't quite understand what leafs are yet. I don't get why it wouldn't draw anything. I figure if I cut down the BSPs into small enough bite sizes, loading a max of 4 (assuming someone is at a corner) wouldn't be that bad. Sure you have max level of detail the whole time but its simple and will work for now.