Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

203 Neutral

About VanillaSnake21

  • Rank
    Advanced Member


  • Twitter
  • Github
  • Twitch
  • Steam

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Yep, this is kind of what I was looking for. After downloading a trial and playing with it for an hour I kind of get an idea of what such an app might feel like. It's extremely close to what I had in mind it's just taking a different approach. So I guess I'm now questioning my intention of using vision vs what this app does, which is just direct system hooks that allow it to read info directly. Thanks, saved me a bunch of time.
  2. VanillaSnake21

    Storing full games on paper?

    I think the best way to represent source code universally is by using the most minimalist assembly instructions. That would be something like mov, add, mul etc. Just find the most basic instructions that any program can be rewritten with and use only those instructions for writing the source of the game. Then you would include some kind of a primer that would identify the mov instruction as such. All data would be written in regular binary formats, just basically color dumps for images. You'd still need primers for data, but it wouldn't be that difficult to write those.
  3. VanillaSnake21

    Best way to write windows user interfaces for c++ programs

    So it turns out the option of using XAML is actually viable. I think I should be able to use the Visual Studio's XAML UI designer and still write the code in a version of C++ called C++/CX. I'm not exactly sure if it's entirely the same but it appears that it's just C++ with extensions that enable the calling of Windows Runtime. For now I'll try that although I think the drawback is that I can only create the new Windows control elements that the new UI uses. I'm not too fond of them to be honest, I'd rather have the old interface look but I guess it beats writing the whole UI by hand. Thanks.
  4. I'm not sure which forum this kind of a question belongs in, so sorry in advance if it's a bit off topic on this particular board as I'm neither looking for gameplay nor general programming advice but rather software design advice and assistance in selecting proper APIs/technologies to implement a design (I did considering posting this in Game Design but this is not a game so...). I have an idea for a program that I've wanted to implement for a while so feel free to critique it or let me know if it's already been implemented. Here's the idea: I'd like to make a computer automation program that could control your mouse and keyboard but with a twist that it would use computer vision to help it navigate. So in essence I'd like to make something like a virtual AI user, where the program can operate a computer by itself given a set of directions. So just to give an example: I'd say "Open site gamedev, and create a new post in a gameplay programming category and title it What do you think of a.." the program would then take over the mouse, look for the browser icon on the desktop or in the start menu, click on it, look for the search bar, click on it, type in the site address, navigate to this site, find the right forum etc. Of course I'm not looking to have this crazy AI that can do that all without being shown at least once or trained a bit. But after training I'd expect it to know the layout of this site, how the "Create New Post" button looks, how the search bar looks, etc. So kind of like how an actual person uses a computer, instead of iterating directories and issuing browser commands it would just use vision in order to interact with the computer solely using the mouse and keyboard (like we do). It would also be a bit different than something like AutoHotKey because for example if something gets updated on the site, and the "Post Now" button moves to the bottom of the screen, since the program is not relying on exact positions but on visual input it would still be able to follow commands. Do you think this is something worth writing? Why or why not? And what are some difficulties that I might encounter?
  5. VanillaSnake21

    Maya Learning 3D Modelling

    I have some great experiences with Gnomon Workshop. They only invite industry professionals who previously worked on mainstream titles to host their courses, so you always get quality content, and they have a great library of older courses which are still very much relevant. Modeling itself is an art so you can effectively use courses made for Maya 6 for example (when it was still under Alias) and still learn a decent amount and be able to use everything you learned in the newest version. The great thing about Maya is that it evolved incrementally and pretty much supports the same workflow as it did back in the day.
  6. It's been a while since I've had to develop a windows interface for an app, and now I must do exactly that but I'd like to go about it in the best way possible. Years ago when I had to do it, I just used straight forward WinAPI with GDI to manually create and position buttons, frames, etc. directly in C++ code. Now with the advent of the unified windows architecture I'm not sure that's the best possible way to do it anymore (and frankly I'd rather it not be since it was pretty tedious). I'll start off with the choices I'm considering at the moment, please feel free to add anything to that list that I'm missing: Using Visual Basic .NET - this is probably the easiest choice as I'm familiar with the language and the ability to graphically design the UI is enticing Using XAML - I'm not so familiar with this, but I did write a small interface for a Windows Phone app (when the platform was still running) and I remember there also being a graphical design tool although I'm not sure it's available on windows. Another aspect of that matter is that as the title suggests, I'd like to eventually interface with c++, I know it's not incredibly difficult to do with any system through DLLs but I'd thought I'd mention that in case there is a way that I can somehow avoid that. An ideal situation would be if I had a graphical editor that I could design the interface in and the write all the code that interacts with it in C++, but it might be wishful thinking and so I'll take what I can get. Thanks.
  7. Oh my God, thank you that is a brilliant implementation. It just seems so elegant and beautiful the way you reuse the indices from tree to stack and yet I just can't seem to write my own routine without looking that would convert your recursive traversal implantation (above) to the iterative approach. I ended up just peeking at the solution you provided at the previous page where you provided the implementation. I'm going to keep looking at this until I can successfully write my own routine, but do you happen to know if there are any resources that can help me get this down? For example I see you use the word "tail" in the solution on the previous page, I looked it up and came to a "tail call", so there must be a whole area of study that deals with things like that. Should I just look up like general "recursion" chapter in a comp sci book or something? In particularly I'd like to focus on this manual stack management, and maybe do a few exercises of converting recursion to manual loops, like we did here. And if you don't mind, just give me a day or two, I'm going to try to study this and re-write the whole thing from scratch once I feel comfortable enough because I just want to have this really under my belt. I know I can probably just use what you provided, at this point you pretty much wrote the whole thing for me (thanks ), but I _really_ feel like this is a great opportunity for me to actually improve my coding and learn an area that I'm obviously completely oblivious to. And I'd really like to finally finish this BVH implementation too (heh, I feel like at this point it's like a secondary objective 😂). Thanks again, I really appreciate how much you've helped so far!!
  8. First of all sorry for taking so long to respond. Your last post was very dense and it took me a while to absorb all the information. I've been pouring over it for the last few days try to make sense of it and I hope that I managed to do that because almost everything here is new to me. So starting with my most glaring problem, which was not sorting at every iteration, I've implemented that hopefully correctly this time. The second thing I did was remove the root special case, and instead just generalized the function where it just takes any case. Also rewrote some functions to be cleaner/clearer, removed the redundant float cast etc (minor things) The major issue I had was rewriting the whole thing without using new operators and without letting the program manage the stack, this I'm still having issues with and I'm not even sure I'm doing it right. I've basically resorted to using the binary heap implementation I found online which stores the whole tree in an array (is that what you meant when you said use arrays for the trees?). So I've rewritten my generation code (hopefully correctly) using that implementation.The problem is that I'm now having some difficulties writing the traversal code, I was wondering if you can provide any sort of hint to get me going. This is my new generation code: struct _heap_node { //the bounding box of this volume _bounding_box bounding_box; //the list of bounding boxes of the triangles this volume encompasses std::vector<_bounding_box_tri> triangleBoundingBoxList; bool isEmpty = true; }; std::vector<_heap_node> midpoint_split(std::vector<_bounding_box_tri>& completeBoundingBoxList, UINT unitsPerLeaf = 100) { //support 7 levels of the tree //1st level after root is 2 nodes, 2nd level is 4 nodes, 3rd level is 8 nodes, 4th level is 16 nodes, 5th level is 32 nodes, 6th level is 64 nodes, 7th level is 128 nodes //2 + 4 + 8 + 16 + 32 + 64 + 128 = 256 //256 + 2 (1st is empty and second is root) = 258 UINT totalNumberOfNodes = 258; //initialize the binary heap _heap_node emptyNode; emptyNode.isEmpty = true; std::vector<_heap_node> tree(totalNumberOfNodes, emptyNode); //generate the root node _heap_node rootNode; //find the volume of all the triangles in the terrain rootNode.bounding_box = FindBoundingBox(completeBoundingBoxList); rootNode.triangleBoundingBoxList = completeBoundingBoxList; rootNode.isEmpty = false; //add the root to the tree at 1st index (since the 0th slot is always empty) tree[1] = rootNode; //start with index 1 because slot 0 is always empty for (UINT i = 1; i < totalNumberOfNodes; i++) { //if the number of triangles in the list is less than the set amount don't divide futher if (tree[i].triangleBoundingBoxList.size() <= unitsPerLeaf) break; //generate a left branch _heap_node leftChild; leftChild.isEmpty = false; //split the list of triangles in half (0 to 1/2 list) UINT parent_index = i; UINT start_box_index = 0; UINT end_box_index = UINT(tree[parent_index].triangleBoundingBoxList.size() / 2.0f + 0.5f); //create a sublist of triangle bounding boxes that are contained in this split std::vector<_bounding_box_tri>::const_iterator startIter = tree[parent_index].triangleBoundingBoxList.begin() + start_box_index; std::vector<_bounding_box_tri>::const_iterator endIter = tree[parent_index].triangleBoundingBoxList.begin() + end_box_index; std::vector<_bounding_box_tri> leftsideBoxList(startIter, endIter); //sort the new list of boxes char axis = FindLongestSide(leftChild.bounding_box); OrganizeListByAxis(axis, leftsideBoxList); //find the bounding box around that split half leftChild.bounding_box = FindBoundingBox(leftsideBoxList); //pass on the new bounding box list leftChild.triangleBoundingBoxList = leftsideBoxList; //assign child to the 2n node of the binary heap (which represents the left tree) tree[2 * i] = leftChild; //generate the right branch _heap_node rightChild; rightChild.isEmpty = false; //assign the other half to the right branch (1/2 list + 1 to end) parent_index = i; start_box_index = end_box_index + 1; //start where left box has ended, just ofset by one end_box_index = tree[parent_index].triangleBoundingBoxList.size(); //end at the end of the list //create a sublist of bounding boxes to sort std::vector<_bounding_box_tri>::const_iterator startIter = tree[parent_index].triangleBoundingBoxList.begin() + start_box_index; std::vector<_bounding_box_tri>::const_iterator endIter = tree[parent_index].triangleBoundingBoxList.begin() + end_box_index; std::vector<_bounding_box_tri> rightsideBoxList(startIter, endIter); //sort the list on the longest axis axis = FindLongestSide(rightChild.bounding_box); OrganizeListByAxis(axis, rightsideBoxList); //find the bounding box around that split half rightChild.bounding_box = FindBoundingBox(rightsideBoxList); //pass on the new bounding box list rightChild.triangleBoundingBoxList = rightsideBoxList; //assign child to the 2n + 1 node of the binary heap (which represents the right tree) tree[2 * i + 1] = rightChild; } return tree; } And this is as far as I've gotten with my traversal code. Since you said that the bounding boxes will intersect, I'm not even sure how to find the bounding volumes of the point anymore, do I just have to search every node? Anyways, here how I start it: std::vector<_bounding_box_tri> FindPointInTree(XMVECTOR point, std::vector<_heap_node> tree) { //begin iteration at 2nd element since 1st element (slot 0) is always empty for (UINT i = 1; i < tree.size(); i++) { //check if the point is in the node at all if (IsPointInBox(point, tree[i].bounding_box) == false) break; //check if the point belong in the left side of the tree if (IsPointInBox(point, tree[2*i].bounding_box)) //what do I do here? Start a new loop and go into the 2*i tree? //check if the point belong in the right side of the tree if (IsPointInBox(point, tree[2 * i + 1].bounding_box)) //what do I do here? Start a new loop and go into the 2*i + 1 tree? } } And thank you for all your help so far, this is has been really helpful for this issue and in general as these concepts (representing trees as arrays and using arrays instead of recursion) are new areas for me which I have not previously explored. So either way I've learned a bunch already, and ironing out the remainders to get the BVH to work would just be icing on the cake at this point.
  9. Oh traversing? I use this method: //outIndexStart and End are passed with -1 in the beginning to signify they're empty void FindPointInTree(XMVECTOR point, const _node* tree, int* outIndexStart, int* outIndexEnd) { //check if the point is in the root node at all if (tree->isRoot) if (IsPointInBox(point, tree->bounding_box) == false) return; //if a left node exists see if the point belongs in that volume, then decend if (tree->leftChild != nullptr) if (IsPointInBox(point, tree->leftChild->bounding_box)) FindPointInTree(point, tree->leftChild, outIndexStart, outIndexEnd); //outIndexStart and End are passed with -1 in the beginning to signify they're empty //if we set them already then the point is already found and so no reason to test further if (!(*outIndexStart == -1 && *outIndexEnd == -1)) return; //otherwise search the right side if(tree->rightChild != nullptr) if (IsPointInBox(point, tree->rightChild->bounding_box)) FindPointInTree(point, tree->rightChild, outIndexStart, outIndexEnd); //this part of code is only reached when the last leaf node is found //at which point, just pass out the triangle indices caontined in that node if (*outIndexStart == -1 && *outIndexEnd == -1) { *outIndexStart = tree->start_box_index; *outIndexEnd = tree->end_box_index; } } Thanks for looking over the code, I know it's a lot.
  10. @Gnollrunner I see what you mean, I actually do have a collision box associated with a character, I suppose I can just check the triangles inside the BVH volume that my character is in for collision instead of just using a ray? At this moment I'm just using a single point to see if I can get the BVH to work correctly. @JoeJ Yea I think I'm missing some part of the process of building the tree. This is my current approach: 1. I go through every triangle in the terrain and generate a bounding box around that triangle 2. I sort all the triangles and their respective bounding boxes along the longest axis of the terrain 3. I find a bounding box surrounding the entire terrain, essentially the bounding box that contains all the bounding boxes of the triangles, and assign that to the root node 4. I split list of organized triangles in half and find a bounding box that covers that split, I assign the one half of the list to the left branch of the binary tree and the other side of the list to the right branch. 5. I go on splitting the list until each leaf contains about 100 triangles I don't want to overwhelm with code but I'll try to keep it as short as possible, this is those 5 steps as I have them in code right now: struct _node { //pretty much the start and end index of the trianlges contained in this node //in actuality they are the start and end indices of the bounding boxes that surround the triangles //the bounding boxes themselves have indices to actual triangles UINT start_box_index; UINT end_box_index; //the bounding volume surrounding the triangles defined by the indices above _bounding_box bounding_box; _node* leftChild; _node* rightChild; bool isRoot; }; //I pass this method the root of an empty tree and the list of bounding boxes around each triangle, this list is organized according to //the longest axis void midpoint_split(_node* tree, const _bounding_box* const boundingBoxList, UINT numBoxesInList, UINT unitsPerLeaf = 100) { if (tree->isRoot) { //the root holds all the triangles in the terrain ( 0 to number_of_triangles ) tree->start_box_index = 0; tree->end_box_index = numBoxesInList; //find the volume of all the triangles the terrain tree->bounding_box = FindBoundingBox(boundingBoxList, tree->start_box_index, tree->end_box_index); //generate a left branch tree->leftChild = new _node; tree->leftChild->isRoot = false; //split the list of triangles in half (0 to 1/2 list) tree->leftChild->start_box_index = 0; tree->leftChild->end_box_index = UINT(float(numBoxesInList) / 2.0f + 0.5f); //just set the leaf nodes to null tree->leftChild->leftChild = nullptr; tree->leftChild->rightChild = nullptr; //find the bounding box around that split half tree->leftChild->bounding_box = FindBoundingBox(boundingBoxList, tree->leftChild->start_box_index, tree->leftChild->end_box_index); //descend in order to generate the entire left branch midpoint_split(tree->leftChild, boundingBoxList, numBoxesInList); //generate the right branch tree->rightChild = new _node; tree->rightChild->isRoot = false; //assign the other half to the right branch (1/2 list + 1 to end) tree->rightChild->start_box_index = UINT(float(numBoxesInList) / 2.0f + 1 + 0.5f); tree->rightChild->end_box_index = numBoxesInList; tree->rightChild->leftChild = nullptr; tree->rightChild->rightChild = nullptr; tree->rightChild->bounding_box = FindBoundingBox(boundingBoxList, tree->rightChild->start_box_index, tree->rightChild->end_box_index); midpoint_split(tree->rightChild, boundingBoxList, numBoxesInList); } else // this is done when the node passed in recursively is no longer the root { //find how many triangles are in this node UINT numTrianglesInRange = tree->end_box_index - tree->start_box_index; //if less than the set minimum then don't split further if (numTrianglesInRange <= unitsPerLeaf) return; tree->leftChild = new _node; tree->leftChild->isRoot = false; //split the node in half tree->leftChild->start_box_index = tree->start_box_index; tree->leftChild->end_box_index = UINT(float(numTrianglesInRange) / 2.0f + 0.5f) + tree->start_box_index; tree->leftChild->leftChild = nullptr; tree->leftChild->rightChild = nullptr; tree->leftChild->bounding_box = FindBoundingBox(boundingBoxList, tree->leftChild->start_box_index, tree->leftChild->end_box_index); midpoint_split(tree->leftChild, boundingBoxList, numBoxesInList); tree->rightChild = new _node; tree->rightChild->isRoot = false; tree->rightChild->start_box_index = tree->leftChild->end_box_index + 1; tree->rightChild->end_box_index = tree->end_box_index; tree->rightChild->leftChild = nullptr; tree->rightChild->rightChild = nullptr; tree->rightChild->bounding_box = FindBoundingBox(boundingBoxList, tree->rightChild->start_box_index, tree->rightChild->end_box_index); midpoint_split(tree->rightChild, boundingBoxList, numBoxesInList); } }
  11. There is a root bounding box, in the image you see it as the navy blue box that surrounds the red bounding boxes (which are bounding boxes for individual triangles). But if the player is located only in the root bounding box and not in any of it's children bounding boxes (as Player Position is in the image), doesn't that mean I have to check every triangle in the terrain for collision? Also I'm using a binary tree, and I store triangles in every level of the tree. Also can you elaborate why this wouldn't work for things like houses and trees? I'm not using heightmaps, so I'd imagine the triangles of a house or a tree (if it's a part of the terrain) would just get mapped to the bvh tree like the rest of the terrain, or that wouldn't work for some reason? If not what would be a more wholesome approach that would work in every case?
  12. I'm trying to implement walking on a polygonal mesh terrain. I've chosen to use the ray-trace method (by shooting a ray from the player position downward until it hits a terrain triangle) to find out the height of the terrain at that point. I'm using BVH approach to segment the space around the level so that I only have to ray-trace a small number of triangles. However I'm having trouble conceptualizing the following scenario (see the image for an illustration). Lets say the player jumps up over the bounding volumes (or dives off a cliff or out of plane). If you look at Player Position 1 in the image I've attached, the player is located in the largest bounding volume of the word, meaning that I'd still have to iterate over every triangle in the world to find the position. Also if you look at Player Position 2, how would I even handle that? Since the player is completely outside of the terrain bounding box. I
  13. VanillaSnake21

    Finding a bounding box around other boxes

    @Zakwayda That simplifies it by a bunch, thanks! The thing is that I'm trying to implement bounding volume hierarchies in my terrain at the moment and I have 60,000 of these said bounding boxes (one for each triangle) so having this extra internal loop is a bit much, but this 3 ply loop is actually much better than what I currently have, so I'll take it! I just thought there was some vector/matrix magic that could just run off the extents.
  14. I think the most important thing that you can undertake at the moment that will bring you closer to your plans (and reality) is building a prototype. It's not that expensive. You can probably get one going for under 5k (or maybe even less). It's not going to be pretty but you can probably get the essence of your ideas into it. My guess is from there you will probably re-evaluate your original plan and the worthwhileness of the idea, but if you decide to stick to it then just refine the prototype through the years. Whether be it by yourself or through hired help, in a couple of years you will have a reasonably working product, which you can then try and market to anyone interested.
  15. I have individual bounding boxes around objects in my world, I'm trying to find one larger bounding box that encompasses all the bounding boxes of the small objects. How would I do that considering that my current bounding box is defined as such: struct _bounding_box { XMFLOAT3 center; float xExtent; float yExtent; float zExtent; }; Also it's worth noting that all the bounding boxes are axis aligned. At the moment what I'm doing is converting the (center, extent) representation into individual vertices and then finding the smallest and largest vertex, but this involves me decomposing each individual box into 8 verticies as such: Vertex v1, v2, v3, v4, v5, v6, v7, v8; v1.pos = center + xAxis*xExtent + yAxis*yExent; v2.pos = center + xAxis*(-xExtent) + yAxis*yExtent; v3.pos = center + xAxis*xExent - yAxis*yExtent; //.. and so on I feel like there might be some solution that allows me to directly use the (center, extent) representation of the boxes directly to find the overall bounding box. Is there?
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!