Archived

This topic is now archived and is closed to further replies.

New Quake3 Level loader tutorial?

This topic is 5513 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

quote:
Original post by daher
how about a full game tutorial? that will be half of the engine man

-----------------------------

DaHeR.RailgunMaster


Yeah, would be cool :-)
I coded 6 pages of algorithms and functions for collision detection yesterday, but, as you can imagine, it didnt work
Collision detection sux



[edited by - Offcrash on November 7, 2002 6:01:07 AM]

Share this post


Link to post
Share on other sites
Yes I definitely would be interested in a Q3BSP tutorial, but it should be split into different aspects : file format, space partitioning, rendering shaders (on oldest and newset GFX boards), collision detection...

Writing such a tutorial probably requires a team.
Who wanna take the lead ? ;*)

Share this post


Link to post
Share on other sites
The q3bsp loader on gametutorials.com just supports polygons and space partitioning (that''s quite good since I don''t know of any other q3bsp tutorial). It give a good overview of the file format, though.

I guess a tutorial that supports everything (meshes, billboards, bezier patches, animated shaders, effects, collision detections, handling correctly the ZIP file.........) would be a real killer.
I would really be happy to see that on NeHe''s site and maybe I can contribute (for easy things ;*).
Anybody else interested ?

The aftershock renderer supports quite a lot of things (see http://www.planetquake.com/aftershock/) and could be a good starting point. But it is definitely not a tutorial.

RodZilla

Share this post


Link to post
Share on other sites
I know Aftershock, but the source is rarely commented and isn´t very useful for me.
I found a q3 map loader with collision detection, but its based on directx and coded under pascal *grrr* That sux!

[edited by - Offcrash on November 7, 2002 10:16:34 AM]

Share this post


Link to post
Share on other sites
i hope there won t be such a tutorial out in the near future or everyone starts copy and pasting


a good tutorials explains how it basically works with pseudo code
if you present a working source code nobody will bother working it out on his own


you don t have to support lazyness of copy&paste

either you are willing to work out the code on your own or you should learn a bit more about the subject

tutorials should only discuss the theory if it shows you the code you won t learn anything no even the basics that why i have never had a look at gametutorials.com

Share this post


Link to post
Share on other sites
quote:
Original post by Basiror
i hope there won t be such a tutorial out in the near future or everyone starts copy and pasting


a good tutorials explains how it basically works with pseudo code
if you present a working source code nobody will bother working it out on his own


you don t have to support lazyness of copy&paste

either you are willing to work out the code on your own or you should learn a bit more about the subject

tutorials should only discuss the theory if it shows you the code you won t learn anything no even the basics that why i have never had a look at gametutorials.com


*lol*

Share this post


Link to post
Share on other sites
quote:
Original post by Offcrash
*lol*

i actually agree with the idea that a complete "tutorial" would not really be of that much benefit. a very significant part of the challenge of writing a complete game engine is putting together all the code you''ve learned from different places.

now, i heard game institute has an excellent course on bsps.

Share this post


Link to post
Share on other sites
I agree 100% with Offcrash that a tut should force the reader to write the code themselves. (well, to an extent of course). Everyone should endevour to understand 100% exactly how their code works. copying and pasting throws this out the window.


I''m assuming you want a tutorial that shows how you can use the bsp to find all triangles within a certain area/volume... well.. I just happen to be writing a Q3 importer for my project, but I still havn''t made up my mind if I will use the bsp structure and the file strucute as it is or simply convert them to more suitable formats... A bit part of this decision is going to be how efficient I can get the bsp to select polygons for me, not only in volumes, but also on lines, cylinders, etc (which i currently do with a AABB/Octtree type system).

So, well, I can''t really help right now... but I may be able to layer.. (when I find the time to reasearch how a bsp does this)



<-- smile :-)

Project-X

Share this post


Link to post
Share on other sites
before i wrote my engine i had the problem
either i use a compiler from someone else or my own one

i knew the basics of the compilation process and i thought that shouldn t be that hard

so i decided to write one on my own and god it took me 2 months including breaks until i finished it writing this little 10000 lines big tool was much more complex as i thought at first and thats one of the reasons why i hate c&p tutorials because:

1.your learn nothing
2.and you can nothing

after you have used them

knowing the basics is good but using you theory knowledge will be a hell trip if you have never done it before

Share this post


Link to post
Share on other sites
quote:
Original post by RipTorn
I agree 100% with Offcrash that a tut should force the reader to write the code themselves. (well, to an extent of course). Everyone should endevour to understand 100% exactly how their code works. copying and pasting throws this out the window.


I''m assuming you want a tutorial that shows how you can use the bsp to find all triangles within a certain area/volume... well.. I just happen to be writing a Q3 importer for my project, but I still havn''t made up my mind if I will use the bsp structure and the file strucute as it is or simply convert them to more suitable formats... A bit part of this decision is going to be how efficient I can get the bsp to select polygons for me, not only in volumes, but also on lines, cylinders, etc (which i currently do with a AABB/Octtree type system).

So, well, I can''t really help right now... but I may be able to layer.. (when I find the time to reasearch how a bsp does this)



<-- smile :-)

Project-X


In my opinion, a good tutorial should show pseudo AND full source code. If some newbie looks at a tutorial wich is pure source code, it won´t help him, because he doesn´t understand the structures and algorithms which were used there. Pseudo code isn´t even better, cause essential things like basic code is missing. Would you like to rewrite all that crappy init stuff every time you try a new bunch of code? I think one shouldnt exist with annother. Good tutorials are had to find. The main problem with q3 collision detection is, that you cant adapt coll. det. code from earlier application examples, because q3 needs a fast and efficient collision detection based on brush testing. This has almost nothing to do with an simple brute-force sphere-to-polygon coll. det. showed in most of the collision detection tutorials.
thanks for listening
oc

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You actually can use brute-force sphere-polygon collision, but brush-based collision is the way the Quake engine intended, and building triangles from the triangle-strip vertice information for each face is brutally slow.

Example code:
This is ...close... to a working sphere-face based collision system, but has some bugs, and at any rate is not the proper way to do collision dection for a BSP tree:

// Go through all the leafs and check their visibility
while(i--)
{
tBSPLeaf *pLeaf = &(m_pLeafs);
// If the current leaf can''t be seen from our cluster, go to the next leaf
if(!IsClusterVisible(cluster, pLeaf->cluster))
continue;
if(!g_Frustum.BoxInFrustum(pLeaf->min.x, pLeaf->min.y, pLeaf->min.z,
pLeaf->max.x, pLeaf->max.y, pLeaf->max.z))
continue;


int nFace = pLeaf->leafface;
int iFace = pLeaf->numOfLeafFaces;
if (pLeaf->numOfLeafFaces<1)
continue;
while(iFace--)
{
int fi = m_pLeafFaces[nFace + iFace];
if(m_pFaces[fi].type != FACE_POLYGON)
continue;
int nVert = m_pFaces[fi].startVertIndex;
int iVert = m_pFaces[fi].numOfVerts;
// Have to count up...
for(int j=1; j<=iVert; j++)
{
if (crashFlag==true)
continue;
vVertice[0] = m_pVerts[nVert].vPosition;
vVertice[1] = m_pVerts[nVert+j].vPosition;
vVertice[2] = m_pVerts[nVert+j+1].vPosition;
CVector3 vTriangle[3] = { vVertice[0],
vVertice[1],
vVertice[2]
};
CVector3 vVector1 = vTriangle[2] - vTriangle[0];
CVector3 vVector2 = vTriangle[1] - vTriangle[0];
vNormal = camPos.Cross(vVector1, vVector2);

mag = camPos.Magnitude(vNormal);
vNormal.x /= mag;
vNormal.y /= mag;
vNormal.z /= mag;
int classification = ClassifySphere(vCamera,
vNormal, vTriangle[0], distance);

Share this post


Link to post
Share on other sites