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
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.
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)
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
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)
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
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);