• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

157 Neutral

About PistachioPro

  • Rank

Personal Information


  • Twitter
  1. surviv.io

    Hi all! Long time no post. We've been on extended hiatus from game development for several years, but came out of hiding to develop a fun little browser game. It's called surviv.io, and you can find it (appropriately) at http://surviv.io. It's strongly influenced by way too many hours spent playing PUBG. Spawn in, grab some loot, and be the last person standing. Please check it out and let us know what you think!
  2. Knight of the Living Dead: XNA game

    Thanks for the kind words, nugums and Leaedas! We're glad you enjoyed the game. We just posted a speed run video on YouTube in case anyone is interested in seeing "what it takes" to finish the game in just about 4 minutes. Knight of the Living Dead Speed Run
  3. Knight of the Living Dead: XNA game

    Thanks for checking it out! @kosmon_x Multiplayer would definitely be a lot of fun, whether coop or versus or coopertition. If we decide to do a sequel, that will be at the top of the feature list. @eedok Yes, you probably had a long install because of the .NET Framework. Sadly, there's not much we can do about that at this time. I'm glad you hung in there, though. :) @Dunge Sir Galahad is a master of repeating any phrase with the exact same inflection. It's his greatest talent. But seriously, we'll take note of that for the future. Just curious, did anyone have a desire to go for a high score? Perhaps the ones we populated the list with are a bit too daunting?
  4. Hi all! We just launched our game today, built using C#/XNA Game Studio. Please check it out and tell us what you think! savegalahad.com Our trailer on YouTube!
  5. If you treat each body part as a physical particle, you can connect them with joints and then simulate the system. This will make your snake look a little ropey, but it sounds like that's what you're going for. Using Verlet integration and infinitely stiff springs would probably take the least amount of time to code up. Along the same lines, you could use an implicit integration scheme and connect the body parts with nearly infinitely stiff springs, or you could use a physics system that supports hard constraints and connect the parts with pin joints. If you're not into writing physics code, though, you're probably better off using the first option. John Edwards EDIT: I just understood haphazardlynamed's suggestion. I like that better. It'll give you a slightly different look than the physics route, but it's far simpler. I guess it's like the Verlet method in the case where each body part is much heavier than the one following it. [Edited by - PistachioPro on June 12, 2006 4:12:58 PM]
  6. Have you tried this: http://www.devmaster.net/wiki/Ray-triangle_intersection?
  7. Sorting classes in STL lists?

    According to the old SGI site, stl::sort requires RandomAccessIterators. std::list uses BidirectionalIterators, so you have to use the member function. John Edwards
  8. Yeah, it certainly works, and I think it's just a matter of preference whether it or the second method is better (they are both about the same number of keystrokes). At this point I'm just kind of curious as to why the second method doesn't behave as you would expect it to in the absence of templates. I don't need to know the answer to finish implementing my system, but I'm always interested in developing a deeper understanding of the workings of C++. John Edwards
  9. I'm trying to implement a cheap little RTTI system for hierarchies of classes using only single inheritance. To do this, between each level of inheritance, I sandwich in a class that generates the RTTI info. This class (called TInheritor, in my code) needs to know the name of the direct subclass and needs to be able to access static members of the direct base class. In code: // Normal inheritance looks like this: namespace Normal { class CBase { }; class CDerived : public CBase { }; } // With the RTTI system: namespace RTTI { template< typename tSub, typename tSuper > class TInheritor : public tSuper { public: // Static RTTI stuff. private: TInheritor( ) { } friend tSub; }; class CBase { }; class CDerived : TInheritor< CDerived, CBase > { }; } This works just fine, but I'd prefer to use a syntax like this: namespace RTTI { class CBase : public /* some starter mechanism.*/ { }; class CDerived : public CBase::TInheritor< CDerived > { }; } The problem is: I haven't been able to figure out how to make something like that work. Here's my attempted implementation: // Includes #include <iostream> // Class definitions template< typename tSub, typename tSuper > class TIntermediate : public tSuper { public: template< typename tNewSub > class TInheritor; }; template< typename tSub, typename tSuper> template< typename tNewSub > class TIntermediate<tSub, tSuper>::TInheritor : public TIntermediate<tNewSub, tSub> { private: TInheritor( ) { } friend tNewSub; }; class CDummy { }; class CBase : public TIntermediate< CBase, CDummy > { public: void Print( ) { std::cout << "Base" << std::endl; } }; class CDerived : public CBase::TInheritor< CDerived > { public: void Print( ) { std::cout << "Derived" << std::endl; } }; class CDoubleDerived : public CDerived::TInheritor< CDoubleDerived > { }; // Main int _tmain(int argc, _TCHAR* argv[]) { CDoubleDerived dubDer; dubDer.Print( ); // Prints "Base"!!! return 0; } Both CDerived and CDoubleDerived inherit from CBase::TInheritor, meaning CDoubleDerived never inherits from CDerived at all. Changing the class definitions as follows makes everything work as expected, but ruins the nice syntax: class CDummy { }; class CBase : public TIntermediate< CDummy, CDummy >::TInheritor< CBase > { }; class CDerived : public CBase::TIntermediate<CBase,CDummy>::TInheritor< CDerived > { }; class CDoubleDerived : public CDerived::TIntermediate<CDerived,CBase>::TInheritor< CDoubleDerived > { }; Now, for anyone who's still awake, my question: Is there a way to make my desired syntax work? If not, why not? (I feel like it has something to do with #35.18 in the C++ FAQ Lite, but I can't quite make the connection.) Thanks for you help, John Edwards
  10. Dynamic Object Collision Trees

    About two years ago, I tried out both the quadtree and sort-and-sweep algorithms for the broad phase of a 2D collision system. The "universe" was composed of 1000-2000 circles with radii ranging from nearly zero to about 10 units. The space was 1000 x 1000 units. About 80% of the circles were static and the rest were mobile, some quite fast. With my implementations, at least, the quadtree was a little bit harder to program, but ran significantly faster. I can't say exactly how much faster, since I did the tests a long time ago, but because your setup sounds relatively similar to mine (that is, we both have a lot of shapes), I thought you might find the results interesting. John Edwards
  11. C++ : nested STL woes...

    I've gotten a similar error in VS2005. It happened when I tried to include a locally defined class as a template parameter: void func( ) { class Foo { /**/ }; std::vector< Foo > vec; // INTERNAL COMPILER ERROR! } I get the feeling this isn't legal C++, but regardless, the error went away when I moved the class definition to global scope. John Edwards
  12. Know Any O(ln N) Convex Poly-Circle Overlap Tests?

    @Dmytry: I'm glad you showed me that link. I think one of my biggest problems figuring all this stuff out is that I must have misinterpreted the original David Eberly ExtremeVert function, because my code looks like this: int ExtremeVert( const CVector2D& v ) const { // Returns the index of the vertex whose projection is farthest along // the given vector. int i0 = 0, i1 = 0; for( ;; ) { int mid = MiddleIndex( i0, i1 ); if( v.Dot( m_vecBodyEdges[mid] ) > 0.0f ) { if( mid != i0 ) { i0 = mid; } else { return i1; } } else { if( v.Dot( m_vecBodyEdges[(m_nVerts+mid-1)%m_nVerts] ) < 0.0f ) { i1 = mid; } else { return mid; } } } } This works on many polygons (all the polygons I tested with), but it seems to break down when there are unequal numbers of "backwards"- and "forwards"- facing edges. When I tried to apply the same search framework to criteria other than "v.Dot( m_vecBodyEdges[mid] ) > 0.0f", the problem cropped up a lot more often. Since I thought the framework was right, I blamed the problem on the criteria, which has probably turned me away from several correct solutions. @jyk: I figured you probably got it from a book ... oh well. As far as whether or not optimization is necessary, I figured that in a physics system such as the one described by Thomas Jakobsen, where constraints are satisfied through a method of relaxation that requires repeated overlap queries, a simple O(ln N) algorithm would save at least some time, overall. However, since it appears that there aren't any well known O(ln N) algorithms, and I'm getting kind of anxious to move on, I do plan on using an O(N) method. Thanks again for the input, guys, John Edwards
  13. Know Any O(ln N) Convex Poly-Circle Overlap Tests?

    @ jyk: I've looked around for information on Dobkin-Kirkpatrick hierarchies, and I found a lot of papers using them, but no information on how to build them. Do you have a link? @Dmytry: Yeah, I know that when dealing with small input sizes O(ln N) algorithms are often slower than O(N), but I figured there might be some simple binary search-type method for finding the closest vertex to a point that would shave off a few dot products from the overlap calculation (which might reduce total collision calculation time by 10%, or more). As far as searching on distance(vertice1,circle_center)-distance(vertice2, circle_center) is concerned, I don't know how to do that, since that value isn't strictly increasing or decreasing around the polygon. Unless it turns out I can get a hold of an explanation of Dobkin-Kirkpatrick hierarchies, and it looks like they're worthwhile, I'll probably just do an O(N) search through all the vertices for the one that has the smallest squared distance to the circle center. Thanks for the suggestions, though. This has been an interesting exercise. John Edwards
  14. Know Any O(ln N) Convex Poly-Circle Overlap Tests?

    Eberly uses a binary search to find where the direction vector dotted with the edge vector changes signs. It certainly would be nice to adapt the algorithm to find the closest point, though, since using ExtremeVert can break down when the circle's center is inside the polygon. Practically speaking, it's only a problem for oblong polygons with a lot of vertices, which won't come up too often, but it would still be nice to have an algorithm that works in all cases. John Edwards
  15. Know Any O(ln N) Convex Poly-Circle Overlap Tests?

    Okay, I've figured out a method that more-or-less meets the criteria: David Eberly defines a function called ExtremeVert in his game physics book that returns the index of the vertex with the largest projection onto a given direction vector in O(ln N) time for convex polygons with clockwise (or counter-clockwise) ordered vertices. If you pass ExtremeVert the vector pointing from the polygon's center to the circle's center, it returns the vertex that (as much as we need it to be) is, or is in the edge that is the the closest feature to the center of the circle. That means, to find the overlap, we just have to overlap-test against two edges and a vertex (which takes constant time). This algorithm takes O(ln N) and doesn't require any elaborate data structures, so it satisfies my requirements. If people know better methods, I'd still be interested in hearing them, though. John Edwards
  • Advertisement