Trying to load MOHAA .BSP

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
wombat
Posts: 10
Joined: Mon Jun 22, 2009 8:02 pm

Trying to load MOHAA .BSP

Post by wombat »

Hi

I played a bit with the Irrlicht engine to see if I could load a MOHAA map. It has a different .BSP format, the order of lumps is changed, and there's some more lumps for other stuff. Apart from that it should be compatible to Q3 .bsp format (see http://openmohaa.sf.net/)
So I changed the code to adapt to the changes. Now what I got looks like this:
Image

Nearly all of the map remains undrawn. You can compare it to what it should look like ( screenshot taken from approx. the same position)
Image

Notice how it says 342 polys.
something seems to be wrong. since it's getting late, i might have overlooked something.

any help appreciated.
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Trying to load MOHAA .BSP

Post by mongoose7 »

So, ahem, you wrote a bit of code that you hoped would work and it didn't? Well, that is really where the work begins.

So, you can try and debug the huge scene you are trying to load, or you can create a test scene. If you feel you cannot create a (small) test scene, then you really need (it's your code, right?) to identify the "lumps" as you load them. Take just one of these lumps and look at the data. For example, see if the position is correct - perhaps your scene is put behind the camera, perhaps the Y-value is 999999.999999. You can turn-off culling of back faces to see if you can see more of your scene. You can render as a wireframe. Some elements are displayed - try to identify these from the model you are loading. And so on.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Trying to load MOHAA .BSP

Post by hybrid »

Yes, there's definitely some more work to do before not only the basic lump layout is adapted, but also all q3 specific hacks are ported properly. The very good q3 bsp support is only possible with additional code as shown in example 16 and 21. But I also think that it would be nice to have more support for such bsp files. And maybe even the q3 loader author will jump on here. So can you please upload the code or host it somewhere so others can check and extend the code? Meanwhile I'll move this topic to advanced section, as it's definitely not a typical beginner thing.
wombat
Posts: 10
Joined: Mon Jun 22, 2009 8:02 pm

Re: Trying to load MOHAA .BSP

Post by wombat »

mongoose7 wrote:So, ahem, you wrote a bit of code that you hoped would work and it didn't? Well, that is really where the work begins.
Of course you're right. No need to get sarcastic there.
I was tired and felt like an outsider's opinion would be of help. Especially since there might be some traps in the Q3 BSP loader I wouldn't know about (as hybrid suggested)

Thanks for your input. I'll tell you when I found out more...
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Trying to load MOHAA .BSP

Post by mongoose7 »

Sorry. My remarks were inappropriate.
wombat
Posts: 10
Joined: Mon Jun 22, 2009 8:02 pm

Re: Trying to load MOHAA .BSP

Post by wombat »

OK I finally got around to investigating more. It seems Irrlicht does not draw vertices when it can't load any texture for them (not even in Wireframe mode).
A simple hack in loadTextures() in CQ3LevelMesh.cpp to load textures directly by their file name instead of looking them up in the .shader files reveals more of the map:
Image

which means the problem is in the shader loading :)
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Re: Trying to load MOHAA .BSP

Post by sudi »

are you going to release your mohaa loader?
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
wombat
Posts: 10
Joined: Mon Jun 22, 2009 8:02 pm

Re: Trying to load MOHAA .BSP

Post by wombat »

Sudi wrote:are you going to release your mohaa loader?
sure, but right now I broke Q3 bsp support. I think I better redo it with clean latest SVN revision, and do it with BSP version distinction. do you want me to just post a diff or set up a seperate SVN?
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Re: Trying to load MOHAA .BSP

Post by sudi »

wombat wrote:
Sudi wrote:are you going to release your mohaa loader?
sure, but right now I broke Q3 bsp support. I think I better redo it with clean latest SVN revision, and do it with BSP version distinction. do you want me to just post a diff or set up a seperate SVN?
can't you release as a seperate loader? then people who want to use it can simply attach the new loader without recompiling.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
tinhtoitrangtay
Posts: 70
Joined: Tue Oct 28, 2008 12:59 pm

Re: Trying to load MOHAA .BSP

Post by tinhtoitrangtay »

You can upload your source for everybody test. Thankx
wombat
Posts: 10
Joined: Mon Jun 22, 2009 8:02 pm

Re: Trying to load MOHAA .BSP

Post by wombat »

yes, i redone it minimally invasive :) seperate files and class for CMOHAAMeshLoader based on CQ3MeshLoader. + a small change in CBSPMeshFileLoader.cpp to automatically choose the right MeshLoader. I'll test and upload it later this day.
wombat
Posts: 10
Joined: Mon Jun 22, 2009 8:02 pm

Re: Trying to load MOHAA .BSP

Post by wombat »

OK I uploaded what I got so far (not much). It needs proper shader loading, and LOD terrain drawing (the blank spots on the ground), which I'll take care of soon.

http://home.arcor.de/wombat23/irrlicht-mohaabsp.7z

CMOHAALevelMesh.cpp and .h must be added to source/Irrlicht/ they are a modification based on the pre-existing CQ3LevelMesh files. they should be added to the project / makefile.

The archive also contains a slightly modified CBSPMeshFileLoader.cpp, that will load the first 4 bytes of the .bsp to automatically choose between Q3 and MOHAA mesh loader.

A test example can be found here: http://pastebin.com/ecb7Fe1i
netpipe
Posts: 670
Joined: Fri Jun 06, 2008 12:50 pm
Location: Edmonton, Alberta, Canada
Contact:

Re: Trying to load MOHAA .BSP

Post by netpipe »

can you repost complete demo please ?
Live long and phosphor!
-- https://github.com/netpipe/Luna Game Engine Status 95%
netpipe
Posts: 670
Joined: Fri Jun 06, 2008 12:50 pm
Location: Edmonton, Alberta, Canada
Contact:

Re: Trying to load MOHAA .BSP

Post by netpipe »

https://github.com/netpipe/IrrMOHAA no response from wombat so i will be trying to freelance this to a usable state.
Live long and phosphor!
-- https://github.com/netpipe/Luna Game Engine Status 95%
netpipe
Posts: 670
Joined: Fri Jun 06, 2008 12:50 pm
Location: Edmonton, Alberta, Canada
Contact:

Re: Trying to load MOHAA .BSP

Post by netpipe »

seems to be loading now but crashing still.
Live long and phosphor!
-- https://github.com/netpipe/Luna Game Engine Status 95%
Post Reply