Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

My engine supports Scene handling, Cameras, and has a Renderer. Also, it has a class called Drawable, which has the position, the shape and the picture of an object. The picture property has width, height, rotation and a draw method. All game objects are supposed to inherit from this Drawable class, and are added to the Scene, along with a Map (collection of Tiles, that also inherit from Drawable), lights, and so on and so forth.

The shape property of a Drawable is a Polygon, a collection of user defined vertices around the position of a Drawable (this is a relative coordinate system, so [0, 0] is the position of the Drawable.

With this setup, will the users of my engine (probably only me) still be able to intergrate physics engines such as Box2DJS into their games?

share|improve this question
5  
You should do some quick research into various physics engines' APIs and "bouncing box" sample codes, to get rid of the 800lb gorilla in the room: "a premise that most physics engines work in a similar way" and replace it with real knowledge to work with. –  Patrick Hughes Jun 25 '12 at 16:08
add comment

1 Answer 1

up vote 1 down vote accepted

From what I can see there are two ways of doing this.

The first option is to build your engine around the the idea of composition. The idea being that an end users game won't inherit anything you have made, but will hold instances of the relevant classes in objects they want to construct. For example;

Enemy
{
    Drawable Draw;
}

The other options is to just pick a physics engine that works with your system and add it in. It limits the end uses choice, but you may also find people appreciate it more because you can then change your engine interface to allow for easier creation of complex objects for which a physics engine in necessary.

share|improve this answer
    
Hi, please see the edit I made. –  jco Jun 25 '12 at 16:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.