• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

lehthanis

Members
  • Content count

    14
  • Joined

  • Last visited

Community Reputation

114 Neutral

About lehthanis

  • Rank
    Member
  1. I have code that draws a parabola given two end points and a value for droop/sag to simulate a wire.  I'm currently using a GL_LINE_STRIP to draw it, but it's limited to pixel thicknesses, and I need world coordinate thickness.  So what I need to do is pass in a radius for thickness and draw a cylinder with it's segments at each point on this parabola. In this coordinate system +Y is up.  Here's my code: const double pPrecision = 50; double wx1, wy1, wz1, wx2, wy2, wz2, wx3, wy3, wz3; double wa = gWires[i].Sag; WorldToLocal(gWires[i].Lat1, gWires[i].Lon1, (gWires[i].El1 * FtToMtrs), &wx1, &wy1, &wz1); WorldToLocal(gWires[i].Lat2, gWires[i].Lon2, (gWires[i].El2 * FtToMtrs), &wx3, &wy3, &wz3); double mXZ = (wz3-wz1)/(wx3-wx1); double mXY = (wy3-wy1)/(wx3-wx1); wx2 = wx1 + ((wx3 - wx1) / 2.0); wy2 = (mXY * (wx2 - wx1) + wy1) - wa; wz2 = (mXZ * (wx2 - wx1) + wz1); double denom = (wx1 - wx2) * (wx1 - wx3) * (wx2 - wx3); double A = (wx3 * (wy2 - wy1) + wx2 * (wy1 - wy3) + wx1 * (wy3 - wy2)) / denom; double B = (wx3*wx3 * (wy1 - wy2) + wx2*wx2 * (wy3 - wy1) + wx1*wx1 * (wy2 - wy3)) / denom; double C = (wx2 * wx3 * (wx2 - wx3) * wy1 + wx3 * wx1 * (wx3 - wx1) * wy2 + wx1 * wx2 * (wx1 - wx2) * wy3) / denom; double px = wx1; glLineWidth(gWires[i].Thickness); glColor4f(gWires[i].R, gWires[i].G, gWires[i].B, 1.0f); glBegin( GL_LINE_STRIP ); for ( int p = 0; p <= pPrecision; ++p) { double thisZ = (mXZ * (px - wx1) + wz1); double thisY = (A * (px*px)) + (B * px) + C; glVertex3f(px, thisY, thisZ); px = px + ((wx3 - wx1) / pPrecision); } glEnd(); gWires[i].Thickness on line 21 will be used as a radius once this is converted.  This code is in a loop of gWires with i being the current wire being drawn...each wire is a parabola with two fixed end points.   As you can see, I have a WorldToLocal that converts Lat/Long/El to local opengl coordinates...wx1, wy1, wz1 is one end point while wx3, wy3, wz3 is the other end point. Assume a cylinder precision of say 6 vertices per segment...I'm thinking due to the GL_TRIANGLE_STRIP plot method, I'll need to add these parabola points to an array and use them in some form of lofted draw method like a parallel transport frame.  I've seen a bunch of code that calculated parallel transport frames, but nothing that draws them.  I'm limited to immediate mode, so I can't create a VAO or anything, it has to be done in a loop of sorts.   Where do I begin?  I know I need to start by adding the points created on the glVertex3f on line 28 to an array and then calling a whole new set of routines to draw the cylinder but as for the math/drawing, I've no clue.
  2. Hi all, sorry for the super noob post...I'm just getting started but I have a very short turnaround time needed for this for my boss. I'm modifying something in X-Plane, and drawing a really large set of quads that cover the sky...it works....here's the code:     glColor4f(1.0f, 1.0f, 1.0f, 1.0f);     glBegin( GL_QUADS );         glVertex3f( xt+150000.0f, yt, zt-150000.0f );         glVertex3f( xt+150000.0f, yt, zt+150000.0f );         glVertex3f( xt-150000.0f, yt, zt+150000.0f );         glVertex3f( xt-150000.0f, yt, zt-150000.0f );     glEnd();     glColor4f(0.8f, 0.8f, 0.8f, 0.5f);     glBegin( GL_QUADS );         glVertex3f( xt+150000.0f, yt+1, zt-150000.0f );         glVertex3f( xt+150000.0f, yt+1, zt+150000.0f );         glVertex3f( xt-150000.0f, yt+1, zt+150000.0f );         glVertex3f( xt-150000.0f, yt+1, zt-150000.0f );     glEnd();     glColor4f(0.5f, 0.5f, 0.5f, 0.2f);     glBegin( GL_QUADS );         glVertex3f( xt+150000.0f, yt+2, zt-150000.0f );         glVertex3f( xt+150000.0f, yt+2, zt+150000.0f );         glVertex3f( xt-150000.0f, yt+2, zt+150000.0f );         glVertex3f( xt-150000.0f, yt+2, zt-150000.0f );     glEnd(); I know, it's the old glBegin method, but that's how the code I have is written for X-Plane... Anyways...I need to apply a texture to those 3 quads. And I need it to be a png texture. I've downloaded and compiled libpng, and linked it to my project, but I need a quick and dirty way to load a png file and apply it to the quads. Is there an easy way to do this without using any additional libraries? Or perhaps a simple header file I could drop in that someone has layign around? Sorry again for the frantic-ness...once I get a quick and dirty png loader, I'll definitely be able to spend some time learning more about libpng, but for now, I need a quick fix. Thanks so much to anyone that can help.
  3. Hi all, I've been going through IonWare's Tetris tutorial over at [url="http://openglgui.sourceforge.net/tutorials.html"]http://openglgui.sou.../tutorials.html[/url] and I'm having some oddities. First of all, the screen is VERY flickery when the game is running with the provided source code. It seems to respond to my move commands quite well, but the animations seem to be goign super slow, and eliminating full lines seems to be slow also. I'm also having trouble with loading blocks. It only seems to want to give me the square block...so I can't tell if block rotation is working or anything. I ended up commenting out all the includes for glaux.h and the sample code compiled with minimal changes (I had to add the int declaration in front of several i=0 statements in the parentheses portions of for loops). Does anyone know how to contact the author of those tutorials and whether or not he intends to finish the series?
  4. That seemed to work. Is this what you meant: [code] // This is the call for the users pathing in the maze solveMaze(glMaze) // This is the call for the computers pathing in the maze solveMaze(glMazeSolution) // ... // Here's the function and just the line that I'm getting the error bool solveMaze(vector<vector<int> > & maze) { if (((maze[CurrRow -1][CurrCol] & ALL_PATHS) == 0) && ((maze[CurrRow -1][CurrCol] & ALL_BACKS) == 0)) { // Do Stuff } } [/code]
  5. I've got a maze generator program I've been working on as a learning tool. I wanted to create a scoring mechanism for user solving, and to do that I need to know in advance what the solution is. I have code that automatically solves the maze. And I am using bitwise logic to store the state of each maze cell in my vector array. As the user solves the maze, they are storing in the primary array their progress. I wanted to keep that, but make a duplicate vector array that has the computer's solve path's stored in it. So I figured I could pass to the function that solves the maze (and handles pathing) which array to work on via pointer. like this: [code] // This is the call for the users pathing in the maze solveMaze(&glMaze) // This is the call for the computers pathing in the maze solveMaze(&glMazeSolution) // ... // Here's the function and just the line that I'm getting the error bool solveMaze(vector<vector<int> > * maze) { if (((maze[CurrRow -1][CurrCol] & ALL_PATHS) == 0) && ((maze[CurrRow -1][CurrCol] & ALL_BACKS) == 0)) { // Do Stuff } } [/code] The error I'm getting is: binary '&' : 'std::vector<_Ty>' does not define this operator or a conversion to a type acceptable to the predefined operator So is there a different/better/correct way to pass a multidimensional vector to a function as a pointer that won't cause this problem? Thanks!!!
  6. Well, I looked at the Visual Studio dialog box editor...it creates a .rc file. I dunno if that's like I said, and relying too much on the microsoft overhead. I guess what I meant earlier is that when I created my project I did it as an empty project, none of the precompiled headers and all the other things that come in a win32 project. I'm handling all of my opengl window code through a glwindow.cpp and a glxwindow.cpp for linux (from the Beginning OpenGL book samples). I'd like to keep it pretty simple and just call a dialog box without having to dive too deeply into the visual studio wizards. The less I have to do with a wizard the better.
  7. I am using Visual Studio 2010, and working with OpenGL and want to make an option dialog box where I can set a few options for the render scene. I'm not interested in digging too much into to the "visual" side of visual studio because I've heard there's a lot of overhead in there and it makes cross-platform programming very difficult because the microsoft tools lock you into a microsoft only program. I could be wrong though, feel free to sway me otherwise. What I'd like is to be able to press, say, F2 to bring up an options dialog box with a few simple controls that set state. Is there a tutorial or sample code for doing something like this available on the net? I don't want to add too many dependencies to my program, so the simplest method available is what I'm looking for. Thanks so much for any help you can give me.
  8. I'm using the GLWindow sample code from the book 'Beginning OpenGL Programming Second Edition' and it's working out great for getting started with OpenGL. I've taken what I've learned so far and already applied it to some game code I had written back in my visual basic days. What I'm having a problem with now is having a configuration or options dialog box. I'm kinda crippled here because all the C++ I learned was within an SDK for a flight simulator...so I jumped from C++ for plugins to OpenGL for windows...so I don't know a lot about creating windows in Windows. I was wondering what I would need to do to create a dialog box that I could allow the user to set some options for the program using windows controls. Perhaps when they press a function key, the options menu will pop up. Are there any good tutorials I can read to get me started on adding a dialog box with controls on it to my OpenGL project? Thanks!
  9. That was exactly what I was looking for, thank you!
  10. I have a formula to calculate aspect ratio of a grid in regards to a screen size. The formula works great, but sometimes it returns a negative number, and I'm subtracting it from 0 to pad the left side...which in the case of a negative number ends up adding it to 0 instead. I need to drop the sign of the value of the formula without changing the value. Is there a quick and easy way to do that or will I have to do an if statement? I'm working in C++. I'm fairly new to it, but am learning it super fast, which means I'm probably working on things that may be beyond my means in some cases...such as math. I can't math, lol.
  11. Thats my problem! X-Plane DOES support indexed triangles, but I have no idea how to organize/optimize the indices in MaxScript. I'm fairly new to MaxScript, and unfortunately my first need for MaxScript is a big one...so if anyone has any ideas, I'm all for it. As you can see from the above code, I just dump all my vertex records (faces*3, very inefficient) into an array. I then loop through the array and make my index records based on how many vt records I have. very bloated, very inefficient, and probably the source of my problem. I'd love for someone to take a look and maybe make an adjustment for me if anyone has any better ideas.
  12. Heres some sample output from the above code: VT -5.688458 -0.184925 4.516189 0.394689 -1.995943 -0.241369 0.258005 0.660901 VT -4.491374 -0.011067 5.177628 0.162206 -0.986106 -0.035846 0.428328 0.554014 VT -4.492776 0.002333 4.922896 0.534238 -3.091060 -0.171475 0.395913 0.535761 VT -4.492776 0.002333 4.922896 0.534238 -3.091060 -0.171475 0.395913 0.535761 VT -5.688458 -0.170515 4.403035 0.230695 -1.153887 -0.146945 0.243681 0.652480 VT -5.688458 -0.184925 4.516189 0.394689 -1.995943 -0.241369 0.258005 0.660901 VT -4.491374 -0.011067 5.177628 0.162206 -0.986106 -0.035846 0.428328 0.554014 VT -3.898806 0.074594 5.507529 0.177333 -1.057912 -0.043833 0.512955 0.501291 VT -3.898806 0.088117 5.181144 0.325549 -1.941949 -0.085238 0.471524 0.477767 VT -3.898806 0.088117 5.181144 0.325549 -1.941949 -0.085238 0.471524 0.477767 VT -4.492776 0.002333 4.922896 0.534238 -3.091060 -0.171475 0.395913 0.535761 VT -4.491374 -0.011067 5.177628 0.162206 -0.986106 -0.035846 0.428328 0.554014 I think its required to be rounded to 6, yes...but it looks like they're way off...i think my biggest problem is understanding the way max handles normals and smoothing versus the way x-plane handles it....
  13. Hi all, I've tried this at multiple different forums and haven't gotten much help at all. I'm still VERY new to MaxScript and if I can get past this hurdle I'll be able to work through more of this. I have written an exporter to export from Max to X-Plane. I'm using max 2010 x64. The format that I'm exporting to requires a list of vertex records, and so I export them using the following: for f = 1 to num_faces do ( channel = 1 Face = getFace tmesh f TFace = meshop.getMapFace tmesh channel f TVx = meshop.getMapVert tmesh channel (TFace.x as integer) TVy = meshop.getMapVert tmesh channel (TFace.y as integer) TVz = meshop.getMapVert tmesh channel (TFace.z as integer) for v = 1 to 3 do ( if FaceCCW.state == true then ( case v of ( 3: (curVert = Face.x; curTVert = TVx) 2: (curVert = Face.y; curTVert = TVy) 1: (curVert = Face.z; curTVert = TVz) ) ) else ( case v of ( 1: (curVert = Face.x; curTVert = TVx) 2: (curVert = Face.y; curTVert = TVy) 3: (curVert = Face.z; curTVert = TVz) ) ) Vert = getvert tmesh curVert VertNorm = getNormal tmesh curVert VertX = formattedPrint Vert.x format:".6f" VertY = formattedPrint Vert.y format:".6f" VertZ = formattedPrint Vert.z format:".6f" VertNormX = formattedPrint VertNorm.x format:".6f" VertNormY = formattedPrint VertNorm.y format:".6f" VertNormZ = formattedPrint VertNorm.z format:".6f" VertU = formattedPrint curTVert[1] format:".6f" VertV = formattedPrint curTVert[2] format:".6f" append AryVerts ("VT " + VertX + " " + VertY + " " + VertZ + " " + VertNormX + " " + VertNormY + " " + VertNormZ + " " + VertU + " " + VertV + "\n") ) ) tmesh is a snapshot of my mesh. I loop through each face in my mesh (CCW or CW) and create a record for each vertex. The vertex requires a triplet for X,Y,Z position, and then an X,Y,Z normal (normalized to 1) and then a U, V coordinate. Everything is exporting and displaying properly, except my smooth groups are not showing in the engine, and I get an error for each object that says it has normals of the wrong length. Is there anything I can do in the above code to make sure the normal x,y,z values are normalized to 1 and reflect the smooth groups? The normals also tell X-Plane how to smooth the surfaces, so the normal values should take into account the smooth group choices. My vertex records are NOT optimized...so they currently reflect num_faces * 3. If anyone has any insight into optimizing my vertex records, that would be awesome! Here's the specifics from: http://scenery.x-plane.com/library.php?doc=obj8spec.php Quote:VT <x> <y> <z> <nx> <ny> <nz> <s> <t> This defines a single entry in the triangle vertex table. These are indexed starting from zero based on the record order. The eight numbers represent a triplet coordinate location, a triplet normal, and a pair forming a texture coordinate. This table is only used for triangles. ... Flat/Smooth shading (default is smooth). In flat shading, the entire triangle is drawn with the same brightness. In smooth shading, the corners of the triangle have the shading levels appropriate for their normals, and the interior is interpolated. Note that since flat shading can be simulating via per-vertex normals, it is usually better to only use smooth shading. ... Normals are specified as a triplet of fractions forming a 3-space vector whose length is 1. The vector is interpretted in the same coordinate space as the geometry. Help me get this portion of the exporter working and I'll be set! I think I need some better way to organize the VT records...a more organized array that I can sort through and compare to as I come across vertices. This way when I loop through my faces I can compare to the array and determine whether to add a new record or not...As long as the vertices are set to make faces in a counter clockwise orientation to determine the facing of a face, and all the vertices are represented based on their texture and vertex information I should be good...but I have NO idea how to go about doing that. Thanks in advance for the help!
  14. Hi all, I've tried this at multiple different forums and haven't gotten much help at all. I'm still VERY new to MaxScript and if I can get past this hurdle I'll be able to work through more of this. I have written an exporter to export from Max to X-Plane. I'm using max 2010 x64. The format that I'm exporting to requires a list of vertex records, and so I export them using the following: for f = 1 to num_faces do ( channel = 1 Face = getFace tmesh f TFace = meshop.getMapFace tmesh channel f TVx = meshop.getMapVert tmesh channel (TFace.x as integer) TVy = meshop.getMapVert tmesh channel (TFace.y as integer) TVz = meshop.getMapVert tmesh channel (TFace.z as integer) for v = 1 to 3 do ( if FaceCCW.state == true then ( case v of ( 3: (curVert = Face.x; curTVert = TVx) 2: (curVert = Face.y; curTVert = TVy) 1: (curVert = Face.z; curTVert = TVz) ) ) else ( case v of ( 1: (curVert = Face.x; curTVert = TVx) 2: (curVert = Face.y; curTVert = TVy) 3: (curVert = Face.z; curTVert = TVz) ) ) Vert = getvert tmesh curVert VertNorm = getNormal tmesh curVert VertX = formattedPrint Vert.x format:".6f" VertY = formattedPrint Vert.y format:".6f" VertZ = formattedPrint Vert.z format:".6f" VertNormX = formattedPrint VertNorm.x format:".6f" VertNormY = formattedPrint VertNorm.y format:".6f" VertNormZ = formattedPrint VertNorm.z format:".6f" VertU = formattedPrint curTVert[1] format:".6f" VertV = formattedPrint curTVert[2] format:".6f" append AryVerts ("VT " + VertX + " " + VertY + " " + VertZ + " " + VertNormX + " " + VertNormY + " " + VertNormZ + " " + VertU + " " + VertV + "\n") ) ) tmesh is a snapshot of my mesh. I loop through each face in my mesh (CCW or CW) and create a record for each vertex. The vertex requires a triplet for X,Y,Z position, and then an X,Y,Z normal (normalized to 1) and then a U, V coordinate. Everything is exporting and displaying properly, except my smooth groups are not showing in the engine, and I get an error for each object that says it has normals of the wrong length. Is there anything I can do in the above code to make sure the normal x,y,z values are normalized to 1 and reflect the smooth groups? The normals also tell X-Plane how to smooth the surfaces, so the normal values should take into account the smooth group choices. My vertex records are NOT optimized...so they currently reflect num_faces * 3. If anyone has any insight into optimizing my vertex records, that would be awesome! Here's the specifics from: http://scenery.x-plane.com/library.php?doc=obj8spec.php Quote:VT <x> <y> <z> <nx> <ny> <nz> <s> <t> This defines a single entry in the triangle vertex table. These are indexed starting from zero based on the record order. The eight numbers represent a triplet coordinate location, a triplet normal, and a pair forming a texture coordinate. This table is only used for triangles. ... Flat/Smooth shading (default is smooth). In flat shading, the entire triangle is drawn with the same brightness. In smooth shading, the corners of the triangle have the shading levels appropriate for their normals, and the interior is interpolated. Note that since flat shading can be simulating via per-vertex normals, it is usually better to only use smooth shading. ... Normals are specified as a triplet of fractions forming a 3-space vector whose length is 1. The vector is interpretted in the same coordinate space as the geometry. Help me get this portion of the exporter working and I'll be set! I think I need some better way to organize the VT records...a more organized array that I can sort through and compare to as I come across vertices. This way when I loop through my faces I can compare to the array and determine whether to add a new record or not...As long as the vertices are set to make faces in a counter clockwise orientation to determine the facing of a face, and all the vertices are represented based on their texture and vertex information I should be good...but I have NO idea how to go about doing that. Thanks in advance for the help!