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

povilaslt2

Members
  • Content count

    42
  • Joined

  • Last visited

Community Reputation

495 Neutral

About povilaslt2

  • Rank
    Member

Personal Information

  • Location
    Lithuania
  1. Ye but what if all enemies and player have use Base class which has bullets vector? Then I need to check player to enemies and enemies to player because of bullets?
  2. Hello. I'm trying to make dynamic collision detection system. In example: automatically adjust collision detection when new vector of objects added and etc. Now I have few vectors and I'm trying to do collision by just passing vector/object as parameter in "CheckCollision" function. player->Update(application, dt); if (player->CheckCollision(&enemies)) { InitScene(); application->SetState(GameState::NOTSTARTEDYET); UI["Pause Menu"]->HideAllElements(); UI["Options"]->HideAllElements(); UI["Main Menu"]->ShowAllElements(); } for (auto enemy : enemies) { enemy->Update(dt, t); if (enemy->CheckCollision(player)) { InitScene(); application->SetState(GameState::NOTSTARTEDYET); UI["Pause Menu"]->HideAllElements(); UI["Options"]->HideAllElements(); UI["Main Menu"]->ShowAllElements(); } } Can I somehow change this code to make code more dynamic when I add more vectors with enemies.
  3. BulletManager is used to create/update/render bullets. Bullets can be added from player or other class. So I have to create new instance in every class that uses? or just pass reference when updating? FontLoader is used to load/use fonts in a lot of classes. Should I make just make reference of it in main.cpp? Renderer is used to render objects. Should I also make instance of it in main.cpp? What should you offer? To add constants to Player and etc classes?
  4. Hello, I'm developing space shooter game and need yours advice on code. What is good/bad and etc. All elements, enemies, UI are placeholders at this moment. https://github.com/Povilas-Jablonskis/Space-Shooter
  5. Thank you so much for your feedback. I read all and will apply in my code!
  6. Thanks for advice. I did that because when I minimise window and such then back to the game my always character falls off screen because delta time was + 1 :X. What do you advice to do with deltatime?
  7. Hello, so today I just finished my first harder game and I want to experienced programmers try to review my code and say what's wrong and try to advice me what to do better.   Here's the source and game. https://github.com/Povilas-Jablonskis/SideScroller/   Controls: w for jump, climb up. s for crouch, climb down. a for walk left, climb. d for walk right, climb. mouse1 to jump( mouse must be higher than player's sprite ) ESACAPE to PAUSE   Objective is to reach the end sign.   Thanks for advance.
  8. Hello, so today I just finished my first harder game and I want to experienced programmers try to review my code and say what's wrong and try to advice me what to do better.   Here's the source and game. https://github.com/Povilas-Jablonskis/SideScroller/   Controls: w for jump, climb up. s for crouch, climb down. a for walk left, climb. d for walk right, climb. mouse1 to jump( mouse must be higher than player's sprite ) ESACAPE to PAUSE   Objective is to reach the end sign.   Thanks for advance.
  9. Modelview matrix: glGetFloatv(GL_MODELVIEW_MATRIX, modelView); Yep, I see right color that was set with glClearColor. I don't see anything but blue screen. When I change glClearColor nothing changes but background color. I use glClearColor on main.cpp, main function just before glutMainLoop.
  10. The reason for checking the values is just to make sure you are getting what is expected. I'm sticking with the matrix data is wrong for whatever reason. I also agree with Irlan, you could be ordering your calls incorrectly or leaving something out. I see that, assuming this is full code for that method, you are missing a call to glLoadIdentity for your model matrix. static void resize(int width, int height) { //const float ar = (float) width / (float) height; glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0.0, width, 0.0, height, -1, 1); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); //Was missing in above code } If worst comes to worst, which this might actually be better in the long run. You could just ditch the glOthro, glMatrixMode, and etc calls and just compute the ortho matrix yourself using a custom function. Storing the results in a float array, from there its just passing that along to the shader using the uniform calls you have       OpenGL it's a state machine basically. You need to check if  you're binding something where shouldn't be bound.   Try to change the orthographic matrix to the following: glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0.0f, width, height, 0.0f, 0.0f, 1.0f); glMatrixMode(GL_MODELVIEW); (...) and see if you get different results. Check if you're correctly computing your Model-View matrix.   Thank you both for answers but it didn't help. float triangle[18] = { // Left bottom triangle -1.0, 1.0, 0.0, -1.0, -1.0, 0.0, 1.0, -1.0, 0.0, // Right top triangle 1.0, -1.0, 0.0, 1.0, 1.0, 0.0, -1.0, 1.0, 0.0 }; float texture[12] = { // Right top triangle 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, // Left bottom triangle, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0 }; glGenVertexArrays(1, &uiVAO); glBindVertexArray(uiVAO); glGenBuffers(1, &uiVBO); glBindBuffer(GL_ARRAY_BUFFER, uiVBO); glBufferData(GL_ARRAY_BUFFER, 18*sizeof(float), triangle, GL_STATIC_DRAW); glVertexAttribPointer( 0, // The attribute we want to configure 3, // size GL_FLOAT, // type GL_FALSE, // normalized? 0, // stride 0 // array buffer offset ); glGenBuffers(1, &uiVBO2); glBindBuffer(GL_ARRAY_BUFFER, uiVBO2); glBufferData(GL_ARRAY_BUFFER, 12*sizeof(float), texture, GL_STATIC_DRAW); glVertexAttribPointer( 1, // The attribute we want to configure 2, // size GL_FLOAT, // type GL_FALSE, // normalized? 0, // stride 0 // array buffer offset ); glBindVertexArray(0); glBindBuffer(GL_ARRAY_BUFFER, 0); Maybe it will helps somehow..
  11.   You don't need to get the uniform location each time you need change its data. Just get once the shader it's linked and store the location somewhere (unless you want ti re-compile it at run-time, but doesn't apply to your case).   That's what you need: //It's time to load the shader: GLuint offsetLocation10 = glGetUniformLocation(program, "modelview"); GLuint offsetLocation11 = glGetUniformLocation(program, "projection"); //It's time to resize the window. static void resize(int width, int height) { glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(X, X, X, X, X, X); (...) } //It's time to prepare for rendering: glGetFloatv(GL_MODELVIEW_MATRIX, modelView); glGetFloatv(GL_PROJECTION_MATRIX, projection); glUniformMatrix4fv(offsetLocation10, 1, GL_FALSE, modelview); glUniformMatrix4fv(offsetLocation11, 1, GL_FALSE, projection); Thank you. I changed like you said, but it didn't change anything as I tought..
  12.     Changed glOrtho like you said, nothing changed. Second, how it could be wrong values if I get modelview and projection from system?   In example when I use this all is good. gl_Position = v;"
  13. Hello, i'm having problem. I setup shaders and etc. like it have to be but when I render them nothing shows. // transformation, rotation and scale shader std::string vertSource = "#version 330 core\n" "in vec3 in_vertex;" "uniform mat4 modelview;" "uniform mat4 projection;" "void main()" "{" " vec4 v = vec4( in_vertex, 1.0 );" " gl_Position = projection * modelview * v;" "}"; // basic fragment shader source std::string fragSource = "#version 330 core\n" "uniform vec4 color;" "void main()" "{" " gl_FragColor = color;" "}"; Passing projection and modelview matrix to shader: GLfloat modelview[16]; GLfloat projection[16]; glGetFloatv(GL_MODELVIEW_MATRIX, modelview); glGetFloatv(GL_PROJECTION_MATRIX, projection); int offsetLocation10 = glGetUniformLocation(program, "modelview"); int offsetLocation11 = glGetUniformLocation(program, "projection"); glUniformMatrix4fv(offsetLocation10, 1, GL_FALSE, modelview); glUniformMatrix4fv(offsetLocation11, 1, GL_FALSE, projection); Setting up view: static void resize(int width, int height) { //const float ar = (float) width / (float) height; glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0.0, width, 0.0, height, -1, 1); glMatrixMode(GL_MODELVIEW); } One interesting thing is when I replace projection matrix with position it works but don't know if it's right.. ( I think not )
  14. Hi all. How do I move and scale object. Can someone give an matrix example. I have this peace of code: // transformation, rotation and scale shader std::string vertSource = "#version 330 core\n" "in vec4 position;" "uniform vec2 animsc;" "uniform vec2 position2;" "uniform vec2 objsize;" "uniform vec2 winsize;" "uniform float timer = 0;" "attribute vec4 texCoord;" "varying vec2 texCoordV;" "uniform vec2 curranim;" "uniform mat4 modelview;" "uniform mat4 projection;" "void main()" "{" " texCoordV = vec2(texCoord);" " texCoordV.x /= animsc.x;" " texCoordV.x += (curranim.x/animsc.x);" " texCoordV.y /= animsc.y;" " texCoordV.y += (curranim.y/animsc.y);" " gl_Position = position * projection * modelview;" "}"; Everything I do all wrong, can't solve this problem. To find matrix to scale and move object. When I try to scale object with this matrix: " mat4 scale = mat4(" " vec4( 16/9, 0.0, 0.0, 0.0)," " vec4( 0.0, 1.0, 0.0, 0.0)," " vec4( 0.0, 0.0, 1.0, 0.0)," " vec4( 0.0, 0.0, 0.0, 1.0)" " );" It rotates when It needs to scale.