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

too_many_stars

Members
  • Content count

    130
  • Joined

  • Last visited

Community Reputation

336 Neutral

About too_many_stars

  • Rank
    Member
  1. Hello Everyone, I am having an issue getting my shaders to work. Here is what I have. This is the rendering function. glUseProgram( program_id ); GLfloat v[6] = { 0.0f , 0.0f , 1.0f , 1.0f , 1.0f, 0.0f }; GLuint vbo_id = 0; glGenBuffers( 1 , &vbo_id); glBindBuffer( GL_ARRAY_BUFFER , vbo_id); glBufferData( GL_ARRAY_BUFFER , sizeof(v) , v , GL_STATIC_DRAW); glEnableVertexAttribArray( 0 ); glBindBuffer( GL_ARRAY_BUFFER , vbo_id ); glVertexAttribPointer( 0 , 2 , GL_FLOAT, GL_FALSE , 0 , 0 ); glDrawArrays( GL_TRIANGLES , 0 , 3 ); glBindBuffer( GL_ARRAY_BUFFER , 0 ); glDisableVertexAttribArray(0); And the vertex shader #version 330 in vec2 vertex_position; //layout( location = 0 ) in vec2 vertex_position; void main(){ gl_Position.xy = vertex_position * 1.2; gl_Position.z = 0; gl_Position.w = 1; } The fragment shader #version 330 void main(){ gl_FragColor = vec4(1.0,0.0,0.0,1.0); } I did not post the compiling , linking and attribute adding code because it appears to work. For example, if I make a syntax error in one the shaders, it get a warning. Or if there's a linker problem for example. My issue is that I do get a triangle to show up on the screen, but no matter what I do to the vertex or fragment shaders (for example changing the color or size ) it has no effect with what I see on the screen. In essence, there appears to be no communication between the shaders and glew. My frustration is further compounded by the fact that I was able to get this working before on the same laptop. If anyone has any ideas on what could be wrong with my incredibly simple program, please let me know. Thanks, Mike
  2. @ Alberth and Alvaro I have implemented a hierarchical space partitioning system used for broad phase collision detection. What I require, is a std::vector (since insertion @ end is quick) to be returned with all the neighbors. Every update step, this vector will (in all likelihood )be of a different size, and hold different game objects. Therefore, if I understand my problem correctly, I only have a few options. 1. The Naive way I am doing it, simply by pushing back a std::vector that's not part of the class every update 2. Some sophisticated iterator way, which allocates enough memory to a member variable std::vector in the class construct, and every update step, uses these iterators to keep track of the elements in the vector. (My original question) 3. Make the std::vector a member variable like Alberth suggests. However, I still have to clear the vector every update step so I can fill it with unique objects and so that I know the size. This seems much like #1. above. Unless I am missing something (which would not be the first time) I think that's how vectors work. @ApochPIQ I will have a look at stable_partitions tonight, it's always good to learn something new, even if takes a while to sink in. Thanks for all the input, Mike
  3. I must be going crazy or blind, but I can't find the code tags. I disabled my ad blocker as well. I got the idea by looking at Mat Buckland's source code from Programming AI by example. He uses a spatial partition grid to update entities within a tag radius. But he uses some iterator optimization trick, which I don't understand. I wish I could post the code but it would be a jumbled mess without the tags.
  4. Hello everyone, A quick question to speed up my code a little bit. Right now, I have a function like this which is part of a class. std::vector MyClass::getObjects(){ std::vector objects; for(some condition...){ if(condition met){ objects.push_back(object); } } return objects; } The problem is I am constantly pushing back objects every frame. In the class constructor, I would like to create a member variable std::vector(1000,null) and instead of pushing back, I would like to range over the container with iterators. For example, one iterator for the first position and another for the current position. So I would like to end up with something like this std::vector MyClass::getObjects(){ std::vector objects; //now a member variable iterator end; //also a member variable for(some condition...){ if(condition met){ assign a place in vector for object and increase iterator //now sure show to get this accommplished } } return objects; } Later in the code.. i would like to be able to go through the container from begin to some arbitrary position end. Please keep in mind that the number of objects in the container will change each frame. Question 1. Is this an optimization worth doing? Question 2. If above is true, please show me how. Thanks, Mike P.S What happened to the code tags?
  5. Thanks Irlan,   That's what I suspected, that most of the work is done in world space. Porting over to 3D from 2D, I just want to make sure I understand the foundations before I get too far along and then have to change the entire collision system.   Mike
  6. Hello everyone,   Right now I am reading 3D math primer by Fletcher Dunn and Ian Parberry and looking at their AABB3 class (around page 304).   The way they choose to represent their AABB3 class is with:   Vec3 min, Vec3 max   Note there's no position   To move the verts of the  AABB around, they use a 4x3 matrix which means that the AABB resides exclusively in local space.   However, the collision tests for the AABB class such as   bool AABB3::intersectSphere(const Vec3& center, float radius)const    and bool AABB3::intersectAABB(args...)   in the implemention detail all appear to be in local space.   Having come from the 2D realm, where I handled all collisions, including contact points, normals, penetration etc in world space, is it better in 3D to do all this in local space?   Perhaps I am missing something as well (it would not be the first time)     Thanks,   Mike
  7.   Hi Alvaro,   Yes, I am looking for F=ma => a=F/m. I know the mass, but I don't know how to calculate the Force vector which of course needs a normalized direction and a magnitude for a spiral.   Thanks,   Mike
  8. Hello Everyone,   Wondering if anyone has some ideas for me. This is also for 2D. Given a circle C(pos,r) I would like to drop a particle of arbitrary mass in, and watch it spiral towards the center.   I suspect I can use the Logarithmic Spiral to solve this problem, for example from here http://mathworld.wolfram.com/LogarithmicSpiral.html   However, it's position based. What I need is a directional force proportional to the distance from the center. So as the particle gets closer and closer to the center, the force increases.   Any sources or ideas would be much appraciated.   Thanks in advance,   Mike    
  9. Hello Everyone,   Not sure if I am going crazy but I just downloaded the latest glm version, and I need to call: glm::perspective which I belive is in glm/gtc/the matrix_projection.hpp file in the glm library.   However, I can't find this file anywhere. Is this something new where we need to create the perspective matrix ourselves, or am I missing something embarassingly obvious.   Thanks,   Mike    
  10. Thanks for all the great reply guys.   I just want to make it clear that I don't use the above code snippet, as I rarely see anything of the sort when looking at other people's source code. But once in a while I do come upon it and I was just curious that's all. The initilizer list is my preference.   I also know that many people here work/worked for professional software companies, so I wanted to know some common practices.   Thanks again,   Mike
  11. Hello everyone,   Not an altogether important question but one I have been wandering about for some time. Say we have the following example. Point(int x, int y){ this->x=x; this->y=y; } I don't see this very often, and I have heard, and read some snarky remarks with respect to the above code. Just wandering if there are any problems which I don't understand.   Bad form/style by 2016 standards? Performance hit? Too verbose?   Thanks,   Mike
  12. Thanks for the response, looks like I have to template.
  13. Hi Guys,   Quick question.   Is it possible to pass a std::container say std::vector, or std::list in a function paramater such as   void foo(some std::container p){  for(auto it=p.begin();it!=p.end();it++){  //do something with container }   }   without having to use templates, ie   template <class container> void foo(container &c){  for(auto it=c.begin();it!=c.end();it++){  //do something with container  } }   Thanks,   Mike
  14. Thank you for the help guys. It appears to understand the derivation I have to brush up on my calculus.   Thanks for the great links AntiTwister, especially the first one.   Mike
  15. Hi Alvaro,   Thanks for your response, but I still don't understand. Let's say for simplicity, I make the mass of a circle equal to the area times a density value ie mass=(PI*r*r*)*density. Now, I am not sure how to get a proportionate moment of inertia value. The circle is always in world space.   Also, an OBB which is in local space, but gets transformed into world space every update step could have a mass of widht*height*density. How do I get a moment of inertia value?   Thanks,   Mike