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

Slushy

Members
  • Content count

    17
  • Joined

  • Last visited

Community Reputation

168 Neutral

About Slushy

  • Rank
    Member
  1. I solved it, it's kinda embarassing. I had the offset wrong in my interleaved vbo. It gathered the wrong normals and that messed it up.
  2. Hello, im back again with another question. So I've been working on diffuse lighting for a couple of days now and I can't seem to get it working properly. I get the feeling that there is something messed up with my direction/position Vector of the light. But I can't seem to figure out what. Either way, here are my shaders: VertexShader.glsl #version 330 uniform mat4 perspectiveMatrix; uniform mat4 viewMatrix; uniform mat4 modelMatrix; layout(location = 0) in vec3 in_Position; layout(location = 1) in vec2 in_TextureCoord; layout(location = 2) in vec3 in_Normal; out vec2 frag_TextureCoord; out vec3 normal; void main(void){ gl_Position = perspectiveMatrix * viewMatrix * modelMatrix * vec4(in_Position, 1.0); normal = mat3(modelMatrix) * in_Normal; normal = normalize(normal); frag_TextureCoord = in_TextureCoord; } FragmentShader.glsl #version 330 uniform sampler2D texture_diffuse; uniform vec3 lightPosition; uniform vec3 lightColor; uniform float lightPower; in vec2 frag_TextureCoord; in vec3 normal; out vec3 out_Color; void main(void){ float lightIntensity; vec3 lightDir; lightDir = -lightPosition; lightIntensity = clamp(dot(normal, lightDir), 0.0f, 1.0f); out_Color = clamp((lightColor * lightIntensity), 0.0f, 1.0f); out_Color = out_Color * texture(texture_diffuse, frag_TextureCoord).rgb; } My position/direction vector that I send to my fragment shader in the uniform is: 0, -1, 0 and what I get is this:
  3. This helped me alot! I bet there is a more correct way, or even more efficient. But I simpy solved it with #define _XM_NO_INNTRINSICS_ Seemed to be alot easier for me, anything that would make this way of doing things more complicated or even wrong? Seemed to have solved my problem for now though.
  4. Hello! So I've been struggling with getting XMVECTOR and XMMATRIX working when defined in my header file. If I do: XMMATRIX World; XMVECTOR camPosition; in the header file for example, and then do: camPosition = XMVectorSet( 0.0f, 0.0f, -0.5f, 0.0f ); in my .cpp file, for example. It gives me an "access violation" error. I read that this is because of some kind of alignment thingy? Is there no way to get the XMVECTOR or XMMATRIX defined in the header file and then use it in the .cpp file?   If not, what should I do instead? Because defining them in the .cpp file works, but that looks so bad? Any other solutions, what do you guys do?
  5. I'll use  this as a bump post and hope that somebody answers me again. My problem didn't get solved.. I posted my earlier post to fast. My problem still exists unfortunately..   Here is my Camera class. http://pastebin.com/UmRvTrQN (NOTE: This is modified to be moving "correct", pressing D makes me go right and pressing A goes left etc. Though it shouldn't.. really..?)   Hope somebody can solve this for me.. Feels like I've tried everything. Ofcourse I could just move the camera in the opposite direction that it's supposed to be moved. But I want it to be correct.
  6. Well, stupid me. I had just set the View Matrix to Identity and thought that'd take care of it. Obviously that was not correct, I used this to setup a View Matrix and now it works like a charm!   Thanks!
  7. Hello! So I recently went from OpenGL 2.X (using now deprecated functions like, glTranslate etc.) to using OpenGL 3.2. This also meant implementing matrices manually for all of my transformation. While this is extremely fun and very enjoyable, it's hard.   My problem is that when I move my Camera (Viewmatrix) in the +Y direction, my OBJ that I loaded into my game is moving upwards (hence im moving the camera "downwards" relative to the object). This also affects moving in +/- X. + Goes left, - Goes right.   Why is it that I have this problem? I've checked my Projectionmatrix and it seems to be correct, according to http://ogldev.atspace.co.uk/www/tutorial12/12_11.png   Projectionmatrix perspectiveMatrix.setIdentity(); float aspectRatio = WIDTH / HEIGHT; float zRange = zNear - zFar; perspectiveMatrix.m00 = (float) (1.0f / (aspectRatio * Math.tan(degreesToRadians(fieldOfView / 2.0f)))); perspectiveMatrix.m11 = (float) (1.0f / (Math.tan(degreesToRadians(fieldOfView / 2.0f)))); perspectiveMatrix.m22 = (-zNear - zFar) / zRange; perspectiveMatrix.m23 = 1; perspectiveMatrix.m32 = (2 * zFar * zNear) / zRange;     Modelmatrix is Identity.   Viewmatrix is changed when I move: if(moveUp) Matrices.viewMatrix.translate(new Vector3f(0, 1.0f * moveSpeed, 0)); if(moveLeft) Matrices.viewMatrix.translate(new Vector3f(-1.0f * moveSpeed, 0, 0)); if(moveDown) Matrices.viewMatrix.translate(new Vector3f(0, -1.0f * moveSpeed, 0)); if(moveRight) Matrices.viewMatrix.translate(new Vector3f(1.0f * moveSpeed, 0, 0));     Vertex Shader: #version 330 uniform mat4 perspectiveMatrix; uniform mat4 viewMatrix; uniform mat4 modelMatrix; layout(location = 0) in vec3 position; out vec4 color; void main(){ gl_Position = perspectiveMatrix * viewMatrix * modelMatrix * vec4(position, 1.0); color = vec4(position, 1.0); }     All sources: http://pastebin.com/yZExLWpp - Window.java http://pastebin.com/yBRcdnRK - Matrices.java http://pastebin.com/mJa1j5ri - Camera.java http://pastebin.com/UM7BQdrR - Cube.java   Tell me if you need more. I don't believe you should though.   Thanks!, Slushy.  
  8. [quote name='Khatharr' timestamp='1352577261' post='4999709'] The three transforms: .... [/quote] Wow, yet again. That is extremely helpful! I can't believe the help im getting out of this forum, greatly appreciated. Thanks again! [img]http://public.gamedev.net//public/style_emoticons/default/biggrin.png[/img]
  9. That is really helpful, thanks alot! I'll have to read up on some further stuff regarding world/local/image coordinates but thanks again!
  10. So, I've been looking alot into matrices lately. I understand all the "math-parts" regarding multiplying, adding them together and all that stuff. What I can't seem to get a grasp of is when do I use them correctly? I know that they are very effective when it comes to camera's. But do I also use them for models? So that I have a position vector and a rotation vector, load them into a Float buffer and do glLoadMatrix('floafbuffer'); for every model/object that I want to render aswell? Or do I not need to use matrices for theese stuff? If so, what do I use them for? Only cameras? Im using Java with OpenGL btw. (LWJGL) EDIT: I accidentaly posted this in Math and Physics, I meant to post it in "For Beginners". So if any moderator sees this, could you please move it? Thanks!
  11. [quote name='burnt_casadilla' timestamp='1351629847' post='4995567'] oh crap. im completely hopeless when it comes to creating classes. I know how they work and how to call methods from in them but the bulk of the code confuses me [/quote] Then I'd recommend doing alot of testing and trying different approaches. Simply messing around with classes, [b]before[/b] you go and start making games. Classes are an essential part of games/programming overall. No point in rushing making games when you have to learn the basics first, I know it sucks. But sometimes life does.[img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]
  12. [quote name='burnt_casadilla' timestamp='1351617301' post='4995487'] the only thing i could think of is creating an array for storing bullets, lets say there can be 10 on the screen at a time. and whenever spacebar is pressed, create a bullet at shipPos.X and shipPos.Y, and send the bullet straight up by subracting its y value. i guess my problem is that i really only know one side to doing things. I have a hard time thinking of different ways to program if my first option doesnt work because I get stuck in a loop trying to fix something that might not even work at all [/quote] That'll work just fine. Just keep checking it for collisions and when it goes outside of the playing area (screen) remove it from the array (This could be done using null). Making it possible to shoot another bullet.
  13. [quote name='Faelenor' timestamp='1351617215' post='4995486'] Yes, you have to reset the matrix to identity before applying a new transformation, otherwise, you're applying the same operation over and over. [/quote] But I get the feeling that this isnt the most effective way of doing it? Since glLoadIdentity(); moves it back to the origin again. I have to move it back to the position I want it in every single frame. Shouldn't there be a way to only move the camera when I tell it to do so, with my WASD keys?
  14. Hello! Im trying to create a first person camera, and I've been successful in understanding how to do so thus far. I've read up on alot of vector math and matrix stuff and I know the basics. Although I got a few problems when I try to implement it into my code. I have 3 main vectors, which are position, direction and up. I am trying to use [CODE] glTranslatef(x, y, z); [/CODE] to update my camera-position, but Im not a 100% sure on what values I want to update it with. If I keep updating with my position vector, like so: [CODE] glTranslatef(position.x, position.y, position.z); [/CODE] I will keep moving in one direction, even if im not pressing any buttons. (Moving in the direction that the results of all three values in the position vector will be.) I've been able to work around this by using [CODE] glLoadIdentity(); [/CODE] In the main loop, before I do all the translating. Is this the correct way of doing it? Or do I add another vector and translate with that one? Im a bit of a perfectionst, and I want to do it correctly the first time. So I don't have to relearn! Thanks! I hope im clear enough on what my problem is, I'll be happy to post my sourcecode if you really need it, I felt like it was a bit unnecessary though.
  15. Hello! First of all im writing this from my phone, so im sorry for any big grammar mistakes. My name is Simon and im 17 years old (18 in august). Im from Sweden aswell, but since we're on the forums I prefer typing english. To not upset anyone anyhow, I just started game programming in C++, but ive been programming in java for a while. Now im looking into creating a voxel rendering engine. For learnig purposes. Using raytracing probably or i might try converting them to polygons and render them that way aswell. My point is, that I could use someone to ask if Im not a 100% sure what to read up on. Btw talking/chatting in skype is not a problem at all. Happy holidays!