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

Detheroc

Members
  • Content count

    1
  • Joined

  • Last visited

Community Reputation

100 Neutral

About Detheroc

  • Rank
    Newbie
  1. Hello. I'm making a 2D game in C++ and OpenGL, and although it runs quite fine on my PC, it performs terribly on my Asus EEE netbook. I know it isn't very powerful, but it has no problems running some older 3D games and my project only consists of a hundred or so textured quads, most of which have the same 64x64 texture, and as i said, it is 2D. I know it's the graphics that's slow because the FPS changes according to window size. I'm also using SDL for multiplatform compatibility, but with an OpenGL context that i draw into. Could this have an impact on performance? Also, on my PC, although it mostly runs smoothly, sometimes, when i maximize the window to a full HD resolution, it starts using 100% of one CPU core for some reason, during which some frames are delayed, but this usually randomly stops after around a minute. Does anyone know why this could be happening? I admit i don't have much experience with OpenGL, but eventually, i'd like to make this into something serious, so i really want to do everything correctly. Could you please look at this code and point out anything that can cause the performance issues or anything else i've done wrong, even if only slightly? Any other tips are welcome as well. Thanks. Initialization - This is only called once at the beginning: [code]if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO) < 0) return -1; SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, colorDepth); // 24 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, true); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, multisample > 0); // true SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, multisample); // 4 if (!(window = SDL_CreateWindow(windowCaption.c_str(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, windowWidth, windowHeight, windowFlags))) return -1; if (!(glContext = SDL_GL_CreateContext(window))) return -1; if (glewInit() != GLEW_OK) return -1; glClearColor(0, 0, 0, 1); glEnable(GL_BLEND); glEnable(GL_ALPHA_TEST); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // This part is also called when the window is resized. glViewport(0, 0, windowWidth, windowHeight); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, windowWidth, windowHeight, 0, 1, 0); // This also flips the Y axis. glMatrixMode(GL_MODELVIEW); glLoadIdentity(); SDL_GL_SetSwapInterval(vsync);[/code] Drawing - This is called in a loop: [code]SDL_GL_SwapWindow(window); glClear(GL_COLOR_BUFFER_BIT); glPushMatrix(); // Transform the view so that x, y is in the center and s is the scale. glScaled(s, s, 1); double width = viewWidth/s/2; double height = viewHeight/s/2; glTranslated(width-x, height-y, 0); // DRAWING OBJECTS glPopMatrix();[/code] Loading a texture: [code]GLuint texture; glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); gluBuild2DMipmaps(GL_TEXTURE_2D, 3+alpha, width, height, alpha ? GL_RGBA : GL_RGB, GL_UNSIGNED_BYTE, data);[/code] Drawing an object with a texture: [code]// textureAnchors = { 0, 1, 1, 0, 0 } glPushAttrib(GL_ENABLE_BIT); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, texture); glBegin(GL_QUADS); glTexCoord2sv(textureAnchors+3); glVertex2d(x+xOffset, y+yOffset); glTexCoord2sv(textureAnchors+2); glVertex2d(x+xOffset+width, y+yOffset); glTexCoord2sv(textureAnchors+1); glVertex2d(x+xOffset+width, y+yOffset+height); glTexCoord2sv(textureAnchors); glVertex2d(x+xOffset, y+yOffset+height); glEnd(); glPopAttrib();[/code] Thanks for any help.