woensdag 30 mei 2012
Decreased activity
Since exams are coming up, I won't have much time to blog anymore. I'm working on something entirely different than what I usual make (games ^^) in collaboration with a friend who'll take the financial side of things on his shoulders. All will be revealed when the time is right!
woensdag 23 mei 2012
Nodes!
The latest revision of SFGE introduces two new classes: Node and CollidableNode.
The idea is that a Node can have child nodes, which on their turn can have even more child nodes an so on.
The interface of the Node class:
When the draw function is called, the Node draws itself as well as all his children. Same holds for the update function. onDraw and onUpdate draw and update the current node.
ConvexCollidable has been changed to CollidableNode (derives from Node) and the AABB classes have been removed.
The idea is that a Node can have child nodes, which on their turn can have even more child nodes an so on.
The interface of the Node class:
namespace sfge
{
class Node
{
public:
Node(const std::string& name = "Node");
virtual ~Node();
std::string getName();
void draw(sf::RenderTarget& target);
void update(sf::Time delta);
void addNode(Node* node);
void removeNode(Node* node);
Node* getParent();
void setParent(Node* parentnode);
protected:
virtual void onDraw(sf::RenderTarget& target){}
virtual void onUpdate(sf::Time delta){}
Node* parent;
std::vector<Node*> children;
std::string name;
};
}
When the draw function is called, the Node draws itself as well as all his children. Same holds for the update function. onDraw and onUpdate draw and update the current node.
ConvexCollidable has been changed to CollidableNode (derives from Node) and the AABB classes have been removed.
vrijdag 18 mei 2012
Previous projects
Before I started this blog I had already completed quite a few projects. I made them available on this blog through static pages (see top of page). Every project I'll complete will get it's own page next to them.
Here is a small overview of my past projects:
Here is a small overview of my past projects:
- X-Break
First game I ever got to finish. It's a breakout clone boasting new graphics and some more features.
- Chest Crusher
This game was the result of me diving into Box2D (a physics library). Due to my outstanding creativity it ended up like an Angry Birds clone. Not a literal clone, but the core gameplay is the same as in Angry Birds.
- Damn Asteroids!
My first game made in a language other than C++: Python! I used the Cocos2D framework (which is built on top of Pyglet). This allowed for insanely fast development, the game was completed in less than a week.
woensdag 16 mei 2012
Spatial Hashing for improving performance
The current implementation of my CollisionDetector class in SFGE uses a brute-force algorithm. It simply iterates through all objects it's holding and checks for collision with all other objects (however, no two objects are ever checked twice against each other). At first, I thought this wouldn't give me much trouble because, you know, C++ is fast right? Obviously, I ran into trouble when I used the class for collision detection in my platformer game. The implementation runs in O(n²/2) time. Say, we have a game with 10 cars that can collide with each other. The amount of checks needed in my current implemenation would be 50. Not too much, right?
Now imagine a platformer game with 200 tiles, 10 monsters and one player in one level. The amount of checks would be 2100! This makes the framerate drop quite severely.
The solution for this problem is Spatial Hashing. It basically divides the game world in cells which hold game objects. Using this method, objects only need to be checked against the other objects it's cell is holding. Simple, yet very effective.
Now imagine a platformer game with 200 tiles, 10 monsters and one player in one level. The amount of checks would be 2100! This makes the framerate drop quite severely.
Spatial Hashing visualised
The solution for this problem is Spatial Hashing. It basically divides the game world in cells which hold game objects. Using this method, objects only need to be checked against the other objects it's cell is holding. Simple, yet very effective.
zaterdag 12 mei 2012
SAT implemented in SFGE!
The Seperating Axis Theorem is successfully implemented in the engine. It is now able to handle collision detection AND response between convex shapes. All this functionality has been integrated in the form of three classes: ConvexCollisionDetector, ConvexCollidable and ConvexShape. ConvexCollidable objects have a ConvexShape object as member. these can be added to a ConvexCollisionDetector who handles the collision checking & notifies the objects that collided with the necessary information to respond to the collision (it gives the Minimum Translation Vector and the object we collided with).
The documentation has been updated and the latest revision is supposed to be stable.
The documentation has been updated and the latest revision is supposed to be stable.
donderdag 10 mei 2012
Seperating Axis Theorem
Since my current CollisionDetector class is rather primitive (AABB only) I searched for alternatives. I found a satisfying algorithm very fast: SAT (Seperating Axis Theorem). The online flash game "N" used this method and wrote a tutorial about the subject. I have the algorithm implemented, now I need to reflect a bit on how I'll redesign my Collidable class.
A quick video of my test application:
Expect the next revision of the engine to have this included!
A quick video of my test application:
Expect the next revision of the engine to have this included!
maandag 7 mei 2012
SFGE Test Project
In order to iron out all the little bugs in SFGE I'm making a game using the engine. I chose for a platformer since my previous attempt somewhat failed (it was too ambitious). I'm aiming for a simple & fun game.
First progress video:
First progress video:
Abonneren op:
Posts (Atom)