• 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.

nickwinters

Members
  • Content count

    555
  • Joined

  • Last visited

Community Reputation

183 Neutral

About nickwinters

  • Rank
    Advanced Member
  1. Hello,   I created this prototype after following a few Unity tutorials.  You are a giant yellow cylinder with a giant laser.  There are blue boxes running around, and you must cleanse this world of the vermin!  You have 60 seconds to kill as many of the blue boxes as you can. Please read through the bullet points below the game. It explains the controls and mechanics of the game.   Let me know what scores you get.  The highest score I've gotten is 24.   http://cleanse.nykular.com/?utm_source=gamedevnet_indie&utm_medium=post&utm_campaign=scoreboard   -Nick
  2. I just moved each chunk into it's own vertex buffer.  It's running at 60fps in debug mode.  I haven't even begun to remove blocks that cannot be seen.  This means I'll have to add textures earlier than I thought.   Thank you for your help.
  3. @Laztrezort:  Thanks for the page, that's an interesting find.  I hadn't considered giving each chunk its own vbo.  I'll go through the tutorials to see how it works.  I believe I can only set one texture per vbo.  That shouldn't be a problem, since I can merge the possible textures into one png.  However, a single vbo means each cube in a chunk would share its own material.  I'll have to think of the ramifications of that.     I planned to not render cubes that cannot be seen, but I thought I should ask since a couple million triangles shouldn't be a problem for today's graphics cards.   @dpadam450: is there a particular batching technique you recommend I look into?
  4. I've followed a couple, but haven't written one myself. I'll try a stripped down version of my project tonight and if it doesn't work, post it here. Thank you!
  5. I'm now attempting instancing, but am doing something wrong.  Nothing is being rendered.   I changed modelMatrix and color from uniform to regular inputs. #version 420 core uniform mat4 projectionMatrix; uniform mat4 viewMatrix; uniform vec4 pointLightPosition; in vec4 in_Position; in vec4 in_Normal; in vec2 in_uv; in mat4 modelMatrix; in vec4 color; out vec4 pass_Color; smooth out vec3 normal; smooth out vec3 lightVector; void main(void) { gl_Position = projectionMatrix * viewMatrix * modelMatrix * in_Position; vec4 normalWorld = transpose(modelMatrix) * in_Normal; normal = normalize(vec3(normalWorld)); lightVector = normalize(vec3(pointLightPosition) - vec3(modelMatrix * in_Position)); pass_Color = color; } Initialized my vbos.  The two new ones are at the bottom. glGenVertexArrays(1, &_vaoId); // Create our Vertex Array Object glBindVertexArray(_vaoId); // Bind our Vertex Array Object so we can use it glGenBuffers(1, &_vboId); // Generate our Vertex Buffer Object glBindBuffer(GL_ARRAY_BUFFER, _vboId); // Bind our Vertex Buffer Object int vertexSize = sizeof(Vertex); glBufferData(GL_ARRAY_BUFFER, 36 * vertexSize, vertices, GL_STATIC_DRAW); // Set the size and data of our VBO and set it to STATIC_DRAW int positionId = glGetAttribLocation(_shader->id(), "in_Position"); int normalId = glGetAttribLocation(_shader->id(), "in_Normal"); int texId = glGetAttribLocation(_shader->id(), "in_uv"); glVertexAttribPointer(positionId, 4, GL_FLOAT, GL_FALSE, vertexSize, 0); // Set up our vertex attributes pointer glVertexAttribPointer(normalId, 4, GL_FLOAT, GL_FALSE, vertexSize, (void*)16); // Set up our vertex attributes pointer glEnableVertexAttribArray(positionId); // Enable the first vertex attribute array glEnableVertexAttribArray(normalId); // Enable the first vertex attribute array glBindVertexArray(0); // Disable our Vertex Array Object delete[] vertices; int colorId = glGetAttribLocation(_shader->id(), "color"); glGenBuffers(1, &_colorVbo); glBindBuffer(GL_ARRAY_BUFFER, _colorVbo); glEnableVertexAttribArray(colorId); glVertexAttribPointer(colorId, 4, GL_FLOAT, GL_FALSE, sizeof(vec4), 0); glVertexAttribDivisor(colorId, 1); //is it instanced? int modelMatrixId = glGetAttribLocation(_shader->id(), "modelMatrix"); glGenBuffers(1, &_modelVbo); glBindBuffer(GL_ARRAY_BUFFER, _modelVbo); for (int c = 0; c < 4; ++c) { glEnableVertexAttribArray(modelMatrixId + c); glVertexAttribPointer(modelMatrixId + c, 4, GL_FLOAT, GL_FALSE, sizeof(mat4), (void*)(c * sizeof(vec4))); glVertexAttribDivisor(modelMatrixId + c, 1); //is it instanced? } In my draw call, I bind the two vectors to the vbo pointers, and then attempt to draw my triangles. glViewport(0, 0, _windowWidth, _windowHeight); // Set the viewport size to fill the window glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); // Clear required buffers _modelMatrix = glm::mat4(); // Create our model matrix which will halve the size of our model _lightPosition = glm::vec4(-10.0, 30.0, 16.0, 1.0); _shader->bind(); // Bind our shader int projectionMatrixLocation = glGetUniformLocation(_shader->id(), "projectionMatrix"); // Get the location of our projection matrix in the shader int viewMatrixLocation = glGetUniformLocation(_shader->id(), "viewMatrix"); // Get the location of our view matrix in the shader int modelMatrixLocation = glGetUniformLocation(_shader->id(), "modelMatrix"); // Get the location of our model matrix in the shader int pointLightPosition = glGetUniformLocation(_shader->id(), "pointLightPosition"); // Get the location of our model matrix in the shader int material = glGetUniformLocation(_shader->id(), "color"); // Get the location of our model matrix in the shader ChunkList chunks = _chunkManager.GetVisibleChunks(); _viewMatrix = _camera->GetViewMatrix(); glUniformMatrix4fv(projectionMatrixLocation, 1, GL_FALSE, &_projectionMatrix[0][0]); // Send our projection matrix to the shader glUniformMatrix4fv(viewMatrixLocation, 1, GL_FALSE, &_viewMatrix[0][0]); // Send our view matrix to the shader glUniform4fv(pointLightPosition, 1, &_lightPosition[0]); vector<mat4> modelMatrices; vector<vec4> colors; for (ChunkList::iterator it = chunks.begin(); it != chunks.end(); ++it) { Chunk *chunk = *it; glm::mat4 world = glm::mat4(); world = glm::translate(world, glm::vec3(chunk->GetX() * Chunk::CHUNK_SIZE, chunk->GetY() * Chunk::CHUNK_SIZE, chunk->GetZ() * Chunk::CHUNK_SIZE)); for (float i = 0; i < Chunk::CHUNK_SIZE; ++i) { for (float j = 0; j < Chunk::CHUNK_SIZE; ++j) { for (float k = 0; k < Chunk::CHUNK_SIZE; ++k) { Block &block = *(chunk->GetBlock(i, j, k)); if (!block.IsActive()) { continue; } glm::vec4 colorArray; switch (block.GetBlockType()) { case BlockType::Dirt: colorArray.r = 0.55; colorArray.g = 0.27; colorArray.b = 0.074; colorArray.a = 1.0; break; case BlockType::Grass: colorArray.r = 0.0; colorArray.g = 1.0; colorArray.b = 0.0; colorArray.a = 1.0; break; case BlockType::Bedrock: colorArray.r = 0.5; colorArray.g = 0.5; colorArray.b = 0.5; colorArray.a = 1.0; break; } _modelMatrix = glm::translate(world, glm::vec3(i, j, k)); modelMatrices.push_back(_modelMatrix); colors.push_back(colorArray); } } } } glBindVertexArray(_vaoId); // Bind our Vertex Array Object glBindBuffer(GL_ARRAY_BUFFER, _modelVbo); glBufferData(GL_ARRAY_BUFFER, sizeof(mat4)* modelMatrices.size(), &modelMatrices[0], GL_DYNAMIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, _colorVbo); glBufferData(GL_ARRAY_BUFFER, sizeof(vec4)* colors.size(), &colors[0], GL_DYNAMIC_DRAW); glDrawArraysInstanced(GL_TRIANGLES, 0, 36, colors.size()); glBindVertexArray(0); _shader->unbind(); // Unbind our shader SwapBuffers(_hdc); // Swap buffers so we can see our rendering Did I miss any steps?  Is the order of something incorrect?   Thank you.   Edit: Changed my initialization of the matrix vertex buffer to use 4 vectors.
  6. Moving the glGetUniformLocation and constant glUniforms out of the drawing loop gave me a boost from 10 fps to 13 15fps at 5MM triangles, so that's a start.  I'll look into Instancing.
  7. The data points I've been able to get are 786,432 triangles at 60 fps and 55fps at 983,040 triangles.  At 1,228,800 triangles it drops to 40 fps.    I'm rendering individual cubes, each with 12 triangles.  The 12 triangles are in a single vertex buffer.   I'm fairly certain I'm using OpenGL 3.2.   Here's my drawing method.  Chunk::CHUNK_SIZE is 16. glViewport(0, 0, _windowWidth, _windowHeight); // Set the viewport size to fill the window glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); // Clear required buffers _modelMatrix = glm::mat4(); // Create our model matrix which will halve the size of our model _lightPosition = glm::vec4(-10.0, 30.0, 16.0, 1.0); _shader->bind(); // Bind our shader int projectionMatrixLocation = glGetUniformLocation(_shader->id(), "projectionMatrix"); // Get the location of our projection matrix in the shader int viewMatrixLocation = glGetUniformLocation(_shader->id(), "viewMatrix"); // Get the location of our view matrix in the shader ChunkList chunks = _chunkManager.GetVisibleChunks(); _viewMatrix = _camera->GetViewMatrix(); glUniformMatrix4fv(projectionMatrixLocation, 1, GL_FALSE, &_projectionMatrix[0][0]); // Send our projection matrix to the shader glUniformMatrix4fv(viewMatrixLocation, 1, GL_FALSE, &_viewMatrix[0][0]); // Send our view matrix to the shader for (ChunkList::iterator it = chunks.begin(); it != chunks.end(); ++it) { Chunk *chunk = *it; glm::mat4 world = glm::mat4(); world = glm::translate(world, glm::vec3(chunk->GetX() * Chunk::CHUNK_SIZE, chunk->GetY() * Chunk::CHUNK_SIZE, chunk->GetZ() * Chunk::CHUNK_SIZE)); for (float i = 0; i < Chunk::CHUNK_SIZE; ++i) { for (float j = 0; j < Chunk::CHUNK_SIZE; ++j) { for (float k = 0; k < Chunk::CHUNK_SIZE; ++k) { Block &block = *(chunk->GetBlock(i, j, k)); if (!block.IsActive()) { continue; } //_modelMatrix = world; _modelMatrix = glm::translate(world, glm::vec3(i, j, k)); int modelMatrixLocation = glGetUniformLocation(_shader->id(), "modelMatrix"); // Get the location of our model matrix in the shader int pointLightPosition = glGetUniformLocation(_shader->id(), "pointLightPosition"); // Get the location of our model matrix in the shader int material = glGetUniformLocation(_shader->id(), "color"); // Get the location of our model matrix in the shader glUniformMatrix4fv(modelMatrixLocation, 1, GL_FALSE, &_modelMatrix[0][0]); // Send our model matrix to the shader glm::vec4 colorArray; switch (block.GetBlockType()) { case BlockType::Dirt: colorArray.r = 0.55; colorArray.g = 0.27; colorArray.b = 0.074; colorArray.a = 1.0; break; case BlockType::Grass: colorArray.r = 0.0; colorArray.g = 1.0; colorArray.b = 0.0; colorArray.a = 1.0; break; case BlockType::Bedrock: colorArray.r = 0.5; colorArray.g = 0.5; colorArray.b = 0.5; colorArray.a = 1.0; break; } glUniform4fv(pointLightPosition, 1, &_lightPosition[0]); glUniform4fv(material, 1, &colorArray[0]); glBindVertexArray(_vaoId[0]); // Bind our Vertex Array Object glDrawArrays(GL_TRIANGLES, 0, 36); // Draw our square } } } } glBindVertexArray(0); _shader->unbind(); // Unbind our shader Here's my initialization code: _hwnd = hwnd; // Set the HWND for our window _hdc = GetDC(hwnd); // Get the device context for our window PIXELFORMATDESCRIPTOR pfd; // Create a new PIXELFORMATDESCRIPTOR (PFD) memset(&pfd, 0, sizeof(PIXELFORMATDESCRIPTOR)); // Clear our PFD pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR); // Set the size of the PFD to the size of the class pfd.dwFlags = PFD_DOUBLEBUFFER | PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW; // Enable double buffering, opengl support and drawing to a window pfd.iPixelType = PFD_TYPE_RGBA; // Set our application to use RGBA pixels pfd.cColorBits = 32; // Give us 32 bits of color information (the higher, the more colors) pfd.cDepthBits = 32; // Give us 32 bits of depth information (the higher, the more depth levels) pfd.iLayerType = PFD_MAIN_PLANE; // Set the layer of the PFD int nPixelFormat = ChoosePixelFormat(_hdc, &pfd); // Check if our PFD is valid and get a pixel format back if (nPixelFormat == 0) // If it fails return false; bool bResult = SetPixelFormat(_hdc, nPixelFormat, &pfd); // Try and set the pixel format based on our PFD if (!bResult) // If it fails return false; HGLRC tempOpenGLContext = wglCreateContext(_hdc); // Create an OpenGL 2.1 context for our device context wglMakeCurrent(_hdc, tempOpenGLContext); // Make the OpenGL 2.1 context current and active GLenum error = glewInit(); // Enable GLEW if (error != GLEW_OK) // If GLEW fails return false; int attributes[] = { WGL_CONTEXT_MAJOR_VERSION_ARB, 3, // Set the MAJOR version of OpenGL to 3 WGL_CONTEXT_MINOR_VERSION_ARB, 2, // Set the MINOR version of OpenGL to 2 WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB, // Set our OpenGL context to be forward compatible 0 }; if (wglewIsSupported("WGL_ARB_create_context") == 1) { // If the OpenGL 3.x context creation extension is available _hrc = wglCreateContextAttribsARB(_hdc, NULL, attributes); // Create and OpenGL 3.x context based on the given attributes wglMakeCurrent(NULL, NULL); // Remove the temporary context from being active wglDeleteContext(tempOpenGLContext); // Delete the temporary OpenGL 2.1 context wglMakeCurrent(_hdc, _hrc); // Make our OpenGL 3.0 context current } else { _hrc = tempOpenGLContext; // If we didn't have support for OpenGL 3.x and up, use the OpenGL 2.1 context } The projection matrix is set to: glm::perspective(60.0f, (float)_windowWidth / (float)_windowHeight, 0.1f, 100.f);
  8. Hello,   I've hit a snag with rendering triangles.  At approximately 1,000,000 triangles, the frame rate drops to 30-40 fps.  By the time I hit 5,000,000 triangles, I'm down to 10 fps.  My CPU is an i5-3570K @ 3.4ghz and my video card is a ZOTAC GeForce GTX 660 w/ 2GB of RAM.  Should I experience an fps drop at one million triangles?  Or am I doing something wrong?   My lighting model is a simple phong shading with only diffuse lighting.  I haven't added ambient or specular lighting yet.  There is only one point light source.   I've also enabled the following settings: glEnable(GL_DEPTH_TEST); glFrontFace(GL_CW); glEnable(GL_CULL_FACE);     // Cull back facing polygons glCullFace(GL_BACK); Thank you for your help.   -Nick
  9. I'm using GLSL specifically and attempting to reproduce the diffuse side of phone shading.  I've noticed in all example code I've seen, positions are represented as a vector of size 4, but normals and light positions are stored in vec3.  Why do positions need the fourth value but normals and lights do not?   Thank you for your help.   -Nick
  10. I'm attempting to build a turn based game that can be played on both WP7 and from a website (Silverlight), and am having thinking of ways to architect the server. The game will be played over several weeks, and each player will have a day or two to do their turn, which could take as little as a few seconds, to several minutes depending on the player. Initially, I was considering creating a web service for the client to call. The difficulty with this is that there's no way to notify players when something has happened, so clients would have to poll regularly, possibly every few minutes. Because of this, I'm considering creating a server that communicates with the clients using TCP. My concern is for mobile devices. If I switched to sockets, how would it fare? I assume mobile device connections drop often due to inconsistent reception. Is there a better way to do this? Thanks. -Nick
  11. Yes, it's possible. Silverlight games are generally graphics bound. You'll probably have to go with a 2d game. You can try a 3d engine like Balder, but it is software rendering. The rest of the game should be fine. Chat, game stats, etc will all be fine. You can pull and send data from and to the internet without any trouble.
  12. So they have us paying to prove their product is useful. It's amazing what they can do. And yes, I am a member of the Creator's Club.
  13. It probably means copy that dll to the directory that it created your exe in.
  14. It depends on the application and the game. Some applications, like Office, or Maya, are extremely complex, and IMO, much more complex than the vast majority, if not all, of games out there.
  15. I have that book, and have been using it as a reference. I've come here because I've exhausted my library and code samples. What I've done to get it to work is reverse the order of operations (As my second post shows), but then taken the inverse of the translation and the orientation matrices. That seems to fix it. However, it's pretty much a hack and would like to know if there's something in the matrix algebra I'm missing.