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

adam23

Members
  • Content count

    255
  • Joined

  • Last visited

Community Reputation

164 Neutral

About adam23

  • Rank
    Member
  1. I can completely understand your frustration. I went through the same thing building a very basic tile editor using Win 32. With all the work your going through you should maybe look at writing your own. I've had some pretty decent success rolling out everything I need for a game or editor just using OpenGL or DirectX. But that really does depend on what kind of functionality your looking for. Also I had a lot of conflicts with DirectX and Win32, so in my case it was better to just build them. The current editor i'm using at work was built with WTL, although its not really supported anymore it does seem to allow for a lot more options. http://wtl.sourceforge.net/ Adam
  2. Quote:Original post by Antheus Quote:Say I have a value of 12 and up to a 4 digit number Let 12 be m, and let 4 be n. What are the maximum values for m and n? Quote:find all the combinations Find? Or just count how many there are? If it's find, then the algorithm will inevitably be around n^m, since all possible results need to be printed. The maximum value for m would 180 ( 9 * 20 digits ). The maximum value for n would 20 in my algorithm. The count part is fairly complex so i'll do my best to explain. In the example above lets take 9111. I need to first find 9111 and then count the number of combinations it could possibly have. So in this example it would be 4!/3! since there are only 2 unique numbers one with 3 and the other with one digit. So really the second part of my algorithm is very simple, sort, and calculate the number of permutations. Its finding all the numbers to calculate the permutations that I was afraid was going to be exponential time. Maybe theres another way to approach this. I've tried these. -I started with a 0 - 9^20 approach that just calculates the sum and compares to something else to see if its correct. This didn't even get 1% done in one day. -So then I thought maybe working in reverse with taking the max sum and working down, finding all the possible numbers etc. This isn't seeming possible. Thanks Adam
  3. I've been working on a fairly complex algorithm, but ran into a part that i'm having trouble finding a solution for every situation in a reasonable time. Let me start with a smaller version of the problem. Say I have a value of 12 and up to a 4 digit number. I need to find all the combinations of digits that sum up to the value. The numbers i'm working with are much larger like 10^20 but this serves the purpose. I started with a top down approach to filling the number ( more greedy ). My idea is it would go like this for the value 12 9300, 9210, 9111 8400, 8310, 8220, 8211 7500, 7410, 7320, 7311, 7221 6600, 6510, 6420, 6411, 6330, 6321, 6222 5520, 5511 I'm not worried about the differences in numbers 3900, 9300, just that that somewhere in the number are digits 3 and 9. The only problem is my algorithm is basically O( n * n * n * n ) where n is the number of digits. In pseudo code the simpliest solution is a = 9 -> 5 b = 9 -> 0 c = 9 -> 0 d = 9 -> 0 if( a + b + c + d == 12 && NotAlreadyFound ) //Found One So in this brute force method is pretty much 9^n where is the number of digits. There are some ways to improve this method, but it doesn't get it to the O(n) or maybe even O(n^2) time I need. Does anyone have suggestions on how to approach this. Thanks Adam [Edited by - adam23 on May 29, 2010 10:50:47 AM]
  4. Quote:Original post by Zahlman The array-based implementations are binary trees. It's just that the child pointers are implicit. The implementation takes advantage of the fact that the tree will always be "full" to make this work, setting a mathematical relationship between the index of the parent and the indices of its children. That is an excellent point, and I do appreciate the array based implementations. I did some research on how different implementations were done before starting the tree version, and I have to say the array based method does seem very useful. I do understand the principal of the array based versions being binary tree's where indexing is used to find their children, I guess I worded my response incorrectly. With that said, say i'm building a priority queue to handle pathfinding in a game. I've found that I need more flexibility than a fixed size array that needs to keep doing full copies when it runs low on memory. I'm sure in the end i'll go back to the array based implementation as performing a sort on it is much easier than the tree version, but I really wanted to give this one a try.
  5. I updated my Heap with the new insertion and it makes a huge difference, theres probably some more optimizations I can do, but here's what I have so far. //! Returns first empty location Leaf< T >* GetFirstEmptySlot( ) { //Determine the path to take in the tree //First find the most significant bit and remove it unsigned int nMask = 1 << 31; while( ( m_nCount & nMask ) == 0 ) { nMask = nMask >> 1; } //Now remove the bit nMask >>= 1; //Traverse down the tree until a parent is found Leaf< T >* pNewParent = m_pRoot; while( nMask > 1 ) { //0 Go Left, else go right if( ( nMask & m_nCount ) == 0 ) { pNewParent = pNewParent->m_pLeft; } else { pNewParent = pNewParent->m_pRight; } nMask >>= 1; } return pNewParent; }
  6. Mine doesn't crash at all, but it leaves console windows open that can never be closed when the line system( "pause" ) executes. Adam
  7. I understand the problem with Visual Studio, but I'm wondering why use that method rather than this one? struct Base { protected: void func(int n) {} }; struct Derived : Base { public: template<class T> void func(T const& p) { Base::func(20); } }; Making the base class's function protected seems to give you everything your looking for.
  8. Quote:Original post by iMalc Here's the trick to filling the tree one level at a time: Take the count of how many items are in the tree prior to the insertion and add one Examine this number in binary, finding the leftmost bit that is a one Skip the leading one bit Repeat the following until you have processed the least significant bit: - if this bit is a zero, go down the tree to the left - if this bit is a one, go down the tree to the right - move along to the next bit You should now be at the point where you want to insert the new node So, imagine a tree with 10 items in it already: 1 / \. / \. 2 3 / \ / \. 4 5 6 7 / \ / 8 9 10(the dots are so that it doesn't screw up the diagram) Also note that the numbers shown are not in heap-order, they're just showing the order that items were inserted. You want to insert the 11th item. 11 in binary is 1011 Remove the leading 1, giving 011 That means go left(0) then right(1), then right(1). Stop and insert the 11th item there. Out of curiosity, why are you implementing a heap using a tree data structure rather than an array? I'm really excited to give this one a try, I've never heard of this insertion approach before Thanks! To be honest I've seen a lot of array based implementations of Binary heaps, but not many binary tree based implementations, so I wanted to see the comparisons when using a "binary tree heap" vs an "array heap" when used in a priority queue. Also one of the limitations I always disliked about the array based implementations is needing to grow the array, and using a binary tree fixes that. I guess call it curiosity more than anything. Thanks again for all the suggestions! Adam
  9. Quote:Original post by Sneftel A binary heap is filled from the left. Maintain a pointer to the "last" element, that is, the one with the highest depth such that no equal-depth cousin is to the right of it. To move right from there, just walk up parent links until you're at a left child, then move to the parent, then the right child, then to left children until you hit a leaf. Amortized cost of traversing in this manner is O(1). Very cool thanks, this is very similar to an idea that I had late last night, but in my solution it still required an expensive calculation to jump from the far right of the tree to the far left of the tree. I think my solution is figuring out when the tree is filled and doing a quick linear traversal along the far left side, instead of the more complicated check every node approach I was trying to make work.
  10. So I've been banging my head on a quick way to implement insert for a binary heap data structure built with a binary tree. The problem comes in finding the best possible insertion point to then peculate the node up into its position. Heres the algorithm i'm running now for insert which is way to slow. //! Insert a new item into the heap void Insert( T data ) { Leaf<T>* pNewNode = GetNewLeaf( data ); Leaf< T >* pBestParent = NULL; if( m_pRoot == NULL ) { m_pRoot = pNewNode; } else { int nDepth = 0; pBestParent = GetPositionInTree( m_pRoot, nDepth ); //See which side to insert the node on if( pBestParent->m_pLeft == NULL ) pBestParent->m_pLeft = pNewNode; else pBestParent->m_pRight = pNewNode; pNewNode->m_pParent = pBestParent; printf( "Depth = %d \n", nDepth ); } //Now time to heapify if( pBestParent != NULL ) HeapifyUp( pBestParent ); } And here is what the recursive call looks like //! Helper returns the best parent for this new node Leaf< T >* GetPositionInTree( Leaf< T >* pLeaf, int& nDepth ) { //Simple check if there is a left and right keep recurring if( pLeaf->m_pLeft != NULL && pLeaf->m_pRight != NULL ) { nDepth++; int nLeftDepth = nDepth; int nRightDepth = nDepth; Leaf< T >* pBestLeft = GetPositionInTree( pLeaf->m_pLeft, nLeftDepth ); Leaf< T >* pBestRight = GetPositionInTree( pLeaf->m_pRight, nRightDepth ); if( nLeftDepth > nRightDepth ) { nDepth = nRightDepth; return pBestRight; } else { nDepth = nLeftDepth; return pBestLeft; } } //No children this is the best parent return pLeaf; } The time to move the node into place is really fast, but I'd like to move my insertion speed to more of a rate of O(1) instead of 0(n) like it is now. So my question is does anyone know of a way I can improve this? Or is there a better way to perform insertion when using a binary tree for holding the data instead of an array? Thanks Adam
  11. I was wondering if anyone knew of a good algorithm for taking a DirectX vertex buffer filled with data, and a DirectX index buffer filled with data, to calculate the tangent of each vert. I am not using DirectX format meshes. The triangles are triangle strips. Basically I want to use this to do normal mapping. Thanks Adam
  12. wow, yup thats all I was missing, thanks for catching that.
  13. I'm building a tool that needs quite a few free floating child windows. I'm not an expert at Win32 but from the little bits of documentation i've found I need to use WS_EX_TOOLWINDOW window type. So i'm doing this. WNDCLASSEX wc; wc.cbSize = sizeof( WNDCLASSEX ); wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = TestCallback; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = m_hInstance; wc.hIcon = ::LoadIcon(0, IDI_APPLICATION); wc.hCursor = ::LoadCursor(0, IDC_ARROW); wc.hbrBackground = (HBRUSH)::GetStockObject(LTGRAY_BRUSH); wc.lpszMenuName = 0; wc.lpszClassName = "TestToolWindow"; if( RegisterClassEx( &wc ) == 0 ) { DWORD error = GetLastError( ); Logging::Instance( )->Printf( "Failed to register window, ERROR: %d", error ); } For some reason RegisterClassEx fails with error code 87 ( The classic Invalid Paramter ). Now if I use all the same settings and switch it over to the non ex versions it works fine and I can open all the windows I want. According to the docs they should be identical minus a few extra options. At the time this fails I do already have a main window open and updating. This window uses a DirectX device for rendering. Any ideas? Thanks Adam
  14. You don't need to use static for anything in your code. If you look in my above code I have a function static void initScript( ScriptManager *script ). Then in my ScriptManager I call it like this. Point2F::initScript( script ); Point3F::initScript( script ); RectF::initScript( script ); CObject::initScript( script ); Basically a static function is not technically owned by the class, so you don't need an object of that class to access it. I've noticed a lot of large older codebases to use a lot of static lists to keep track of the entities in the world. This causes problems when moving that codebase to one that runs on multiple processors.
  15. Quote:Original post by Simian Man Quote:Original post by Porthos // Return a Vector static Vector newVector( double x, double y, double z ); This should be static, shouldn't it? The same applies for the cross product. Why should it be static? It's not a member function. I would suggest instead of having newVector, to simply have a constructor with arguments. Quote:Original post by Porthos Vector Vector::operator-= ( const Vector& v ) And this should return a const reference to a Vector, not a copy. Plus the const keyword at the end as proposed by adam: const Vector& Vector::operator-= ( const Vector& v ) const OK this could at least syntactically be a const member function, but the function *changes* the calling object which would mean it's not a const function. Your absolutely right I was just going to post the same thing.