• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About rfranknj

  • Rank
  1. Why would you bother writing windows specific code when you could use a great cross platform library like SFML (http://www.sfml-dev.org/)? No platform-specific code required, and you can get input events easily. All you need to do is think of a way to handle it -- personally I like to use the chain of responsibility design pattern for this, see http://en.wikipedia.org/wiki/Chain-of-responsibility_pattern
  2. How to Manage Collisions

    Quote:Original post by simotix I would recommend taking a look at this thread http://www.gamedev.net/community/forums/topic.asp?topic_id=554643 It definitely helped me out. are you aware that you just posted a link to your own thread
  3. Physics engine in a 2D tile-based game?

    I dealt with this same problem before I started my platformer a week ago or so. The problem is that platformers don't have real physics, so a real simulation engine is useless. It wouldn't be pretty resource-intensive, however. Most 2D physics engines have some form of broad-phase collision detection algorithm (AABB, spatial hashing, etc), so unnecessary collisions just wouldn't be checked. If you're curious what a platformer would look like when written with a real physics engine see http://www.runhello.com/ It's a great game but it definitely deviates from 'most' platformers. If that's what you're going for go ahead and download Chipmunk and start reading the docs. Personally, however, I'm looking for a more classic-style platformer; so I'm writing all of my interaction code myself.
  4. How to Manage Collisions

    Heya, I'm working on a platformer in C++ using SFML. All game objects (enemies, items, player, tiles) are derived from a Body base class which has a polygon & AABB. I have my AABB and Polygon collision functions down. My question is: how do I check / manage collisions between objects? I have an idea of how to do so, but I've never written such a thing before and I'm curious if there is a better method than the one I'm about to describe. I'd have an object called Interactions. This object would keep a few lists: friendly objects, unfriendly objects, and tiles. Every game loop, this object would go through the friendly objects and check them with all unfriendly objects. Then, it would check all friendly and unfriendly objects with the land. The actual checking would be done by the objects themselves (since some collision types do not require polygon/polygon collision). For example, the player with the ground is not a polygon/polygon collision; it's simply point-in-polygon. The collision test / response functions in these objects would return true if a collision occurred and false if a collision did not occur. These functions would also take a bool to denote whether or not the actual collision test was run. So all the interaction manager would do is make a bunch of calls like if (Body1->Collide (Body2, false)) Body2->Collide (Body1, true); For each object that needs to be collided with each other object. Make sense? Thanks in advance! edit: Hey, I thought of a better way to do movable object / tile collision. If I store all tiles in a 2-dim array I can just use int. division and collide with all tiles in the area (within the object's width and height). That way, each moving object only has 1 tile to collide with and not a list of hundreds. [Edited by - rfranknj on November 30, 2009 9:14:32 PM]
  • Advertisement