BSP Loader doesn't work

brtnrdr
Unregistered
 
Post: #1
hey,

i saw there was another post like this already, but my problem's a little bit different. I am also basing my loader off of the gametutorials stuff, however when i run the program, i get "malloc vm_allocate errors" saying that the memory couldn't be allocated. it wants to allocat like 2200 megs for face data. someone brought up the question is my hard drive full, no it is not. i haven't tried endian swapping, but i did go through the trouble of downloading radiant, a quake level editor and just making a simple room and compiled it as a bsp file, and the program still doesn't work. i still get the same allocation error. mind you, this is a c++ program and i'm using new in it, so that's probably why the program is terminating when the memory can't be allocated (a point someone else brought up about malloc returning a null pointer). If anyone has gotten a bsp loader working on the mac, and can enlighten me as to what files will work and whatnot, what i'd have to do to compile them so they'll work on the mac, anything. i'm really stuck.

thank you.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
The GameTutorials.com BSP loader doesn't handle endianness correctly, amongst other major flaws. I'd suggest not using it at all, but swapping the bytes appropriately as they're loaded from the file might be enough to get it working.
Quote this message in a reply
brtnrdr
Unregistered
 
Post: #3
hey,

could you explain how it doesn't handle it correctly. because when i compile a .bsp with gtkradiant on a mac, it still thinks there are like 180,000 vertices, when in actuality, there are 8. obviously an endian error of some sort, but why does it still happen, the map is compiled on a mac. wierdness. why does the tutorial handle it wrong, just wondering.

thank you.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #4
BSP files are always little-endian, regardless of where they were made. q3map2 does the right thing -- the tutorial doesn't.

The tutorial doens't handle it correctly because it was written by ignorant Windows programmers, and ported to Linux by lazy Linux programmers Rasp
Quote this message in a reply
BobbyWatson
Unregistered
 
Post: #5
I actually downloaded the bsploader (SDL version) tutorial a while ago and I eventually got it working. If you want, I can send you my code. it was actually only a matter of converting little endian values to big endian, which took me about an hour to figure out.
Quote this message in a reply
Member
Posts: 144
Joined: 2004.07
Post: #6
bobby, I would absolutely love that! I converted the SDL code using a lib keith created here to solve the endian issue, but for some odd reason my code doesn't work (and the only difference I can think of between my efforts and yours is keith's code....hrm...).

If you could contact me via AIM and send me the files I'm be very appreciative.

btw, all of a sudden I develope interest in .bsp files and it seems the iDG commumity follows my interest.

Does this make me God?
Quote this message in a reply
⌘-R in Chief
Posts: 1,265
Joined: 2002.05
Post: #7
Seth wouldn't mind looking at that either if Bobby would let him. Grin

That would at least lessen the burden to figuring out HOW THE CRAP(?!) Radiant works...
Quote this message in a reply
Vertizor
Unregistered
 
Post: #8
OneSadCookie Wrote:The tutorial doens't handle it correctly because it was written by ignorant Windows programmers, and ported to Linux by lazy Linux programmers Rasp
I resemble that remark! Rasp Rasp Rasp Because I'm a Windows/Linux/Mac programmer. Oi my head hurts.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #9
If people are still looking at this, it should be said that the tutorial is very broken with respect to rendering the level geometry. It'll work with maps generated with old versions of the q3map tool, but not with maps generated by q3map2.

http://onesadcookie.is-a-geek.net/svn/repos/Q3A_BSP/ is a partially-implemented loader that works on both Mac OS X and x86 Linux, at least. It isn't as complete as the GameTutorials one, but it does render the geometry correctly Smile
Quote this message in a reply
Post Reply