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

Concentrate

Members
  • Content count

    971
  • Joined

  • Last visited

Community Reputation

181 Neutral

About Concentrate

  • Rank
    Advanced Member

Personal Information

  1. const char *foo1(){   const char* a = "foo1";   return a; } const char* foo2() {  std::string myString = "foo2!";  return myString.c_str(); } int main(){     foo1();     foo2(); }
  2. If you are running on chrome, you can simply use the bind function,  this.tickIntervalId = setInterval(this.Tick.bind(this), 1000/60); //Update at 60 fps   or if you are using the popular underscore utility   this.tickIntervalId = setInterval(_.bind(this.Tick,this), 1000/60); //Update at 60 fps     The problem is that your Tick function gets called in a global context. Which means that, the 'this' pointer is the global 'this' which is not what you need. Hence you need to bind the 'this' context so that when the Tick function gets called from a global context, the original 'this' pointer is still saved.
  3. Try instantiating BitText in main, then pass it around where needed. That class seems to be lightweight right? So I assume creating that object is light.
  4. Interesting, this seems like a bug? Same result in chrome/firefox as well. Btw, on chrome increasing linewidth by 2, seems to fix the issue as you've mentioned.
  5. Check this http://qiao.github.io/PathFinding.js/visual/ out. Check out the jump point search, with preprocessing and future information that algorithm is very fast. So it all depends on the context. But A* is a good starting point in most scenarios. 
  6. Here is the http://jsfiddle.net/DV9Bw/558/ . I'm not sure why there is opacity less than 255. If you hover over the non-overlapping section, you can see that the opacity is 127/128. Can someone clear this up for me? Why isn't opacity full (255). Also more importantly, why in the overlapping section, the two rectangle pixels are combined, instead of the destination rectangle(blue one I believe) completely take over the pixel at that coordinate? Is this just how the strokeRectangle works? If I change the stroke to fill, as in fillRectangle, then everything works as expected. Any help is greatly appreciated!
  7. [CODE] void Building::_renderDefaultBuilding()const{ glColor3f(1.0f,1.0f,1.0f); glTranslatef(m_position.x,m_position.y,m_position.z); Vector3f t = m_size / 2.0f; glTranslatef(t.x,t.y,-t.z); //translate so its bottom surface starts at (0,0,0) glScalef(m_size.x,m_size.y,m_size.z); if(!Resource::textureList.empty()){ glBindTexture(GL_TEXTURE_2D, Resource::textureList[Resource::NIGHT_BUILDING_TEXTURE]); float s[] = {0.01f,0.0f,0.0f,0.0f}; float t[] = {0.0f,0.01f,0.0f,0.0f}; glTexGenfv(GL_S, GL_OBJECT_LINEAR, s); glTexGenfv(GL_T, GL_OBJECT_LINEAR, t); glEnable(GL_TEXTURE_GEN_S); // Auto Texture Generation glEnable(GL_TEXTURE_GEN_T); } glutSolidCube(1.0f); glScalef(1.0f/m_size.x,1.0f/m_size.y,1.0f/m_size.z); glTranslatef(-t.x,-t.y,t.z); glTranslatef(-m_position.x, -m_position.y, -m_position.z); } [/CODE] so I have the above code, but I need help with auto generating the textures such that I can scale which part of the texture gets rendered. Any help on this?
  8. The current problem I'm having right now is drawing the next branch starting at the end point of its parents branch. Not sure how to achieve the above using glRotate/glTranslate. Currently this is the drawing function [code] void _generateTreeBranches(const Point3f& newPosition, float length, float rotation, const int depth) { if(depth > MAX_DEPTH) return; cout << "at depth = " << depth << endl; //for debugging if(depth == 0){ glColor3f(1.0f,1.0f,1.0f); }else if(depth == 1){ glColor3f(1.0f,0.0f,0.0f); }else{ glColor3f(0.0f,1.0f,0.0f); } glTranslatef(newPosition.x,newPosition.y,newPosition.z); glRotatef(rotation, 0.0f, 0.0f, 1.0f); drawLine(length); //draws centered at origin glRotatef(-rotation, 0.0f, 0.0f, 1.0f); glTranslatef(-newPosition.x,-newPosition.y,-newPosition.z); const float newLength = length * BRANCH_LENGTH_DECREASE_FACTOR; int nextDepth = depth + 1; Point3f nextPosition = {newPosition.x+length, newPosition.y, newPosition.z}; float leftRotation = rotation + CHILD_BRANCH_ANGLE * nextDepth; _generateTreeBranches(nextPosition,newLength,leftRotation,nextDepth); float rightRotation = rotation - CHILD_BRANCH_ANGLE * nextDepth; _generateTreeBranches(nextPosition,newLength,rightRotation,nextDepth); } [/code] Not sure, I'm guessing my next step would be to calculate the 'nextPosition' based on the current rotation, which should be the endPoint of the current line. Any advice on how to properly setup the positioning so that the line is generated starting at the endpoint of its parent's line. I really want to avoid manually calculating the position end based on angle of rotation and just let opengl do that via glTranslate/glRotate, but for this maybe there is no way out.
  9. I think im doing it correctly but the end result is not what I want, here is the code : [CODE] void _generateTreeBranches(const Point3f& startPoint, const Point3f& endPoint, float rotation, const int depth) { if(depth > MAX_DEPTH) return; cout << "at depth = " << depth << endl; if(depth == 0)glColor3f(0.0f,1.0f,0.0f); else glColor3f(1.0f,1.0f,1.0f); float distanceOfPoint = pointDistance(startPoint, endPoint); glRotatef(rotation, 0.0f, 0.0f, 1.0f); glTranslatef(-startPoint.x, 0.0f, 0.0f); drawLine(startPoint, endPoint); glTranslatef(startPoint.x, 0.0f, 0.0f); glRotatef(-rotation, 0.0f, 0.0f, 1.0f); const float nextLength = distanceOfPoint; Point3f nextBranchStart = endPoint; Point3f nextBranchEnd = {endPoint.x + nextLength,endPoint.y,endPoint.z}; _generateTreeBranches(nextBranchStart, nextBranchEnd,45.0f,depth+1); } [/CODE] It draws something like [code] /____ [/code] instead of the desired [code] _____/ [/code] any advice? Also I've noticed that I can either manipulate glTranslate to position my object at position X or I can simply set its coordinates to be draw at position X. Which one is more preferable ?
  10. [quote name='lride' timestamp='1351346180' post='4994415'] [source lang="cpp"] class Menu { private: Menu * subMenu; ..... };[/source] is this possible? [/quote] Did you try to compile this? Simple question like this could just be tested. Learn to be more independent.
  11. [quote name='m3mb3rsh1p' timestamp='1331050134' post='4919803'] [quote name='SegmentationFault' timestamp='1330987047' post='4919612'] ... [code]class Foo : FastRunner { public run() const {} }[/code] Foo::run() does not override FastRunner::run() but hide it. As an example: [code]FastRunner * base = new FastRunner; base->run() // FastRunner::run() base = new Foo; base->run() // FastRunner::run(); ?! Calls Foo::run() for me ?! Foo * foo = new Foo; foo->run(); // Foo::run() foo->FastRunner::run(); // FastRunner::run();[/code] [/quote] Is this because of default private inheritance for "class" over struct? Regular public inheritance seems to dipatch FastRunner::run() to Foo::run for me. [/quote] ...and we found the solution for that problem. Thank you, forgot about that
  12. Ok sorry guys, I understand now. My confusion was me assuming that only one vtable would be needed per hierarchy. But I realize that each class has its own vtable/vptr, and it might not be possible with only one vtable per hierarchy. It makes sense now.
  13. [quote name='SegmentationFault' timestamp='1330987047' post='4919612'] [quote name='D.Chhetri' timestamp='1330896408' post='4919266'] [quote] I disagree. I think it would make more sense if FastRunner::run had to be labeled virtual, because it is virtual. [/quote] Thats a weird circular way to counter an argument? Its not really virtual is it? Its more like its overriding a virtual function. [quote] And anyone deriving a class with a run function would know that run was virtual. [/quote] Yes IRun::run is virtual and that makes sense, but IFastRunner::run doesn't really have to be virtual does it? It being virtual tells me that some other class might derive from FastRunner::run. I think one should instead have an option to explicitly state it as virtual. [quote] I may be confused here but it seems to me that you argue that the last run function in the vtable doesn't have to be virtual because it is the last one in the table. [/quote] No that is not what I was saying. Idk, maybe its there for efficiency reasons. Or that I'm just confused somehow and not seeing the reason for FastRunner::run to be explicitly virtual. Hope my question is clear [/quote] Your suggestions are correct. Virtual keyword only matters for derived classes. So in your case FastRunner::run() is not virtual any more. So that if you inherit it in the class Foo: [code]class Foo : FastRunner { public run() const {} }[/code] Foo::run() does not override FastRunner::run() but hide it. As an example: [code]FastRunner * base = new FastRunner; base->run() // FastRunner::run() base = new Foo; base->run() // FastRunner::run(); Foo * foo = new Foo; foo->run(); // Foo::run() foo->FastRunner::run(); // FastRunner::run();[/code] [/quote] Wait, but I thought FastRunner::run is virtual by default since it overrode the base classes implementation. How come Foo::run hides it?
  14. [quote] I disagree. I think it would make more sense if FastRunner::run had to be labeled virtual, because it is virtual. [/quote] Thats a weird circular way to counter an argument? Its not really virtual is it? Its more like its overriding a virtual function. [quote] And anyone deriving a class with a run function would know that run was virtual. [/quote] Yes IRun::run is virtual and that makes sense, but IFastRunner::run doesn't really have to be virtual does it? It being virtual tells me that some other class might derive from FastRunner::run. I think one should instead have an option to explicitly state it as virtual. [quote] I may be confused here but it seems to me that you argue that the last run function in the vtable doesn't have to be virtual because it is the last one in the table. [/quote] No that is not what I was saying. Idk, maybe its there for efficiency reasons. Or that I'm just confused somehow and not seeing the reason for FastRunner::run to be explicitly virtual. Hope my question is clear
  15. [quote name='Nessa' timestamp='1329589486' post='4914266'] the answer is 9 [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] win [/quote] May I ask how you came up with that answer? From your question, I generate the following equation $perPerson = 72,000 / n 4000 = 72,000 / (n-3) n = 72000/4000 + 3 = 21 So I thought the answer would be 21. Maybe my initial equation is wrong.