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

Stragen

Members
  • Content count

    40
  • Joined

  • Last visited

Community Reputation

318 Neutral

About Stragen

  • Rank
    Member
  1. While as a summary this article is great, IMO, the HTTP server is overkill...   You're only going to be able to make static calls to view information, unless you force a refresh or use a dynamic language which really moves this from a basic implementation to a more serious one, at which point the value of setting up a full blown web server in your code really is questionable because you've spent a deal of time to code this component over coding your game. I also wouldn't expect you would want to be running a full blown web server for your release versions to avoid the various issues that a 'basic' web server would result in (privacy, connectivity, exploitability), so the utility would be somewhat diminished.   In a similar ilk to the HTTP approach, perhaps just output your 'debug log'/'critical variables' file into a HTML format, which you're going to have to do anyway with the approach above, and either open the file with any browser or drop the file in a dedicated web server, append to the header of the file you create a 1 second refresh using javascript and use that as one option for debugging.
  2. still, would be a whole lot easier if we can see the code that you've got down to see where you've declared and used the variable...
  3. What SyncViews says... i dont think you're assigning anything within the constructor...   I would have expected that you would have had SimpleVertex(XMFLOAT3 _var){pos = _var; }   and then creating a variable of type SimpleVertex using: SimpleVertex newVertex(XMFLOAT3(x,y,z)) or what ever else you use.   or:   SimpleVertex newVertex; newVertex.pos = _var;   saying exactly what the tutorial says doesn't help a great deal, i don't have the particular tutorial that you're referring to... and i've seen many.
  4. What code are you using to create a variable from the simplevertex?   I would expect somewhere you're doing SimpleVertex someVertex; someVertex.pos = XMFLOAT3()....
  5. @bluespud, Where in your update/render loop do you put the color picking code? just before the swapping of buffers or after? for example, the code i use to determine the end point of the ray has to be put at the start of all the transforms otherwise the endpoint gets transformed incorrectly. I would imagine the readpixel would need to go after the buffer is swapped (ie rendered to screen) to get the right pixel information?
  6. [quote]However my code works on different PCs so i assume you are just doing it wrong, note that ScreenToClient method should be used when window has borders.[/quote] I'm sure the code works, it just didn't work in my case, and as you've alluded to it could be as a result of my use of different variables or slightly different set up... to be fair, i copy pasted your code directly below mine (adjusted some variables) and had the same results as my code within about 2%, so more than likely something to do with the way i'm calling rendering functions.
  7. You can also get rid of the console using "FreeConsole()" though this may be platform specific (in all likelihood it is) IIRC GlutInitWindowPosition is not a required call (i'm not doing it in my code) and if you leave it out it will default to the top left corner of the screen.
  8. @Steven Basically the method of generating the line that i've gone with is in line with whats on that link you've provided... I've seen the glReadPixels approach around the place, and was the first attempt but there were some oddities about it and perhaps limitations being imposed by some of the render methods i've had to use for rendering different models. It seems that this is probably the best way to do this in OGL, and its not too dissimilar to how i've done in DX previously. I have been looking for the way to stop using the gluUnProject as i've read this is deprecated, perhaps in favor of using the GLM version, however I've not invested the time into understanding the difference in syntax.
  9. For feedback...   I attempted the code that was supplied above and it seemed to be just as bad... perhaps i'm not tracking depth (if i recall this may be the case due to some code that i'm using).   I took the point about the inverted Y, and i've made modifications to my code to use gluUnProject to use z at 0 and z at 1 to generate the line, and stop using the pixel reader.   Thanks for the pointer.  
  10. Hello, Hoping that someone can give some guidance... void MouseRayPicker(){ //method 1, not sure if working. GLint viewport[4]; GLdouble modelview[16]; GLdouble projection[16]; glGetIntegerv(GL_VIEWPORT, viewport); glGetDoublev(GL_MODELVIEW_MATRIX, modelview); glGetDoublev(GL_PROJECTION_MATRIX, projection); // obtain the Z position (not world coordinates but in range 0 - 1) GLfloat z_cursor; glReadPixels(cursorPos.x, cursorPos.y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &z_cursor); // obtain the world coordinates GLdouble x, y, z; gluUnProject(cursorPos.x, cursorPos.y, z_cursor, modelview, projection, viewport, &x, &y, &z); fprintf(stdout, "Cursor target: %f, %f, %f .\n", x, y, z); } I'm using the above for generating a ray for picking objects in world space. At this time, i'm seeing the numbers generate ok when the cursor is precisely in the center of the screen, but if the cursor position changes as all the numbers go into large values that dont make a great deal of sense. (600,429,-560 for example) Can someone suggest where i'm going wrong?
  11. The use of String at the moment is more of a 'first cut' than anything else. I've done some 'safety testing' and it appears the way this has been implemented is that simply putting in a line that says "onDestroy" without parenthesis will simply do nothing (will be undefined variable, or invalid call of function) and to call it from the funcmap you have to actively call the funcmap to do the call, there's no magic pointer at a global level. I take the point about the invalid key though, there is no error checking at the moment to ensure that the key being used actually exists in the maps, other than the map security itself, and if a non-mapped key is used it does error out. That is my next step (people say i work backwards), the aim at this point was to create the ability to reference a function from a map and pass dynamic variables.
  12. Something to be wary of, and i've seen it happen to my code, if the compiler is doing any form of optimization, functions, classes, and variables may not be executed in the order that you expect... quite aside from a declaration being made in another piece of code.   When the error occurs (say an out of bound or buffer overrun) it may not breakpoint properly and can give wrong line numbers in extreme cases.
  13. So I thought I'd come back in here after having a tinker and give my outcomes. #include <functional> #include <vector> #include <string> #include <map> template int idType(void) { static const int id = typeid(varType).hash_code(); return id; } class Variable{ public: template Variable(const varType& _in) : type(idType()){ data = new varType(_in); } template const varType& GetValue(void) const{ assert(type == idType()); return *(const varType*)data; } int GetType(void) const{ return type; } private: void* data; int type; }; int destroyObject(Variable targetID){ if (targetID.GetType() == typeid(std::string).hash_code()) fprintf(stdout, "%s to be destroyed\n", targetID.GetValue().c_str()); else if (targetID.GetType() == typeid(int).hash_code()) fprintf(stdout, "%i to be destroyed\n", targetID.GetValue()); else fprintf(stdout, "ERROR: EVENTMGT - destroyObject passed invalid variable\n"); return 0; } int createObject(Variable targetID){ //will be passed 2 values, both will be strings... if (targetID.GetType() == typeid(std::string).hash_code()) fprintf(stdout, "%s to be created\n", targetID.GetValue().c_str()); else fprintf(stdout, "ERROR: EVENTMGT - destroyObject passed invalid variable\n"); return 0; } int testUpdate(Variable value){ int newValue = 5; return newValue; } class EVENTMANAGER{ std::map funcMap; std::map actionMap; //onCollide callAction doDestroy; //function* funcArray[1]; public: EVENTMANAGER(){ funcMap["doDestroy"] = destroyObject; funcMap["doCreate"] = createObject; funcMap["testUpdate"] = testUpdate; actionMap["onCollision"] = "doDestroy"; } void functionRun(std::string s){ std::string strings[2]; int targetId = 2; Variable returnVal = funcMap.at("testUpdate")(targetId); targetId = returnVal.GetValue(); std::string string = "this is a string"; Variable arg = string; (funcMap.at(actionMap.at(s)))(arg); //could simply pass the string variable, rather than casgint a Variable type to a string. //example of passing string to function, needs to be explicitly defined and passed as string. //[Variable arg = "this is a string"] will assume that the variable type is char* and char* is not a valid type. //std::string string = "this is a string"; //fprintf(stdout, "%s is set to arg\n", arg.GetValue().c_str()); //(funcMap.at(actionMap.at(s)))(string); //example of passing float to function //Variable argf = "1.0f"; //(funcMap.at(actionMap.at(s)))(argf) } }; As you outlined Juliean, the code you put up was somewhat non-functional, particularly had issues with the type identification in the first block.   Opted to try the typeid inbuilt function to use the hash code to track the variable type, though i've read there are some issues with this, particularly cross platform however its more of an issue using the name member from what i understand.   I've taken on the point of using <functional>, and toyed with the idea of using a Variable return type, for a Variable input.   I had thought about using STD::Vector though thought that this might be redundant, and when i played with it, there was a little bit more effort to pull the variable arguments out, but it completely worked, though its probably better using the vector vs passing a vector.   Its surprising how powerful this kind of templated class and function is, and from the research i've been doing, a lot of people simply say its not possible... which is really surprising that this is as simple as it is.   [edit] Borked formatting [/edit]
  14. Thanks for the responses so far... attempting to digest them.   I'm liking the look of std::function and was surprised that I've not seen that before... is this new with c++11?
  15. I'm currently considering how i might approach a parameter based event management system.   My aim is to build it such that the actions that are executed on a particular event are able to be dynamic. This would essentially extend the event system that is used for input control, however my aim is to use a lot less case statements.   My initial thought was to build up a couple of string based maps so that parameters may be allocated against events, for example:   map<string,string> actionMap; map<string,function> FunctionMap;   actionMap["onCollision"] = "doDestroy" FunctionMap["doDestroy"] = <pointer reference to function to execute for destroying an object>   allowing for other parts of the code to call, FunctionMap[ActionMap["onCollision"]](<object reference>);   I've already encountered some pitfalls with this approach, particularly the catches with using function pointers, and void* variables, and was curious to see what other people were doing in this kind of case?   Is there any real advantage in doing this compared to say, case statements against variables? Noting I'm hoping to have a few thousand objects at a time.