Game Engine Using Farseer

Oct 28, 2009 at 10:07 PM
Edited Oct 28, 2009 at 10:08 PM

Hey Everyone,

I've got an XNA Game Engine I've been developing for the past few months, and I've just got it into alpha and have been making it available.  It's just a 2D engine for now, (3D is planned) but considering Farseer is a 2D Physics engine I doubt that would matter much to people on this forum. :)

Anyway, I included the Farseer physics engine in the project, modified it a little, and I created an internal wrapper around it to interact with my engine.  I thought maybe some of you (and maybe even the Farseer programmers) would like to check it out.  Depending on the future of Farseer, I might want to make Farseer the staple of the 2D physics of the engine.  It works well for the most part, but there are some issues in side-scroller type stuff (which seem to have come up elsewhere on this board as well).  The engine can be found at http://xna.eekllc.com.  It's free to use, and I update it frequently.

I have a few video tutorials posted on the site right now, and I plan to make some more covering using the engine.

Coordinator
Oct 29, 2009 at 12:56 AM

Sounds great. Happy to see someone include it into an game engine. IceCream is another example of an XNA game engine using Farseer Physics.

I'm wondering what you changed and if it is anything I should be aware of? Also, could you find the side scroller issues, I would like to take a look at it so that I can improve Farseer Physics Engine in the future. I've not been too active on the forums lately, so any direct references would be great.

Oct 29, 2009 at 1:47 PM

I didn't really change the inner workings of Farseer yet.  Just added some objects to some of your classes to make everything compatable with my Engine as a gameobject.  I've only implemented your engine a little so far.. just basic geometry and collision, but the cool thing about the way it works is that for the classes that I've created wrappers for, you simply need to create a farseerphysicsobject as a child of a gameobject and it takes the info it needs from the gameobject class and automatically implements physics based on your settings for the class, and affects the parent gameobject accordingly.

As far as changing your engine, the only thing I'm really having a problem with in side-scroller type physics is objects bouncing off the ground when walking across flat surfaces, or many block items lined up together that shouldn't cause collision when walking across them.  The problem is that this throws off the floor collision detection and the object isn't able to then jump.  I've seen some "fixes" on the forum like creating a joint geom for the feet that's below the character, but rather than quick fix it I'd wanna see if I can get everything working as intended.  Adding "feet" doesn't really suit the workings of the engine, and I wouldn't want to be loading feet on objects that may not need them.

Nov 2, 2009 at 3:11 PM

I like that you implemented state into your GameObjects.

Walking does cause collisions.  Like genbox pointed out before, even still objects move around. If you're concentrating on a side-scrolling engine then try deriving from GameObject: Floor, Platform, Enemy, Player, etc...  Then define the interactions (OnCollision, OnSeparation) between different GameObject types.... 

Nov 2, 2009 at 4:51 PM
fixitchris wrote:

I like that you implemented state into your GameObjects.

Walking does cause collisions.  Like genbox pointed out before, even still objects move around. If you're concentrating on a side-scrolling engine then try deriving from GameObject: Floor, Platform, Enemy, Player, etc...  Then define the interactions (OnCollision, OnSeparation) between different GameObject types.... 

Yes, in fact the engine is very much state oriented.  The GameObject class has a state, which when changed affects all of the child objects (or at least the ones that care) and everything is adjusted accordingly.  TextureFactories change out the images and animations, Physics moves or stops moving accordingly, etc...  So far the design is coming out really nicely.  I've been shifting focus to a GUI editor to be able to set up the animations quicker since I have the main components down.  Then I'll be tailoring to specific game styles.

I've also made a base PhysicsObject2D for which Farseer inherits off of.. so the base structure code is there either way.. so it's possible to write a wrapper that uses another physics engine or write your own from inheriting off the base object.  The Farseer wrapper doesn't really do anything more than create the bodies and geoms and relay the data down the base class, which then controls movement.

Thanks for the input.  That's exactly what I am doing.  For instance, the SideScrollerPlayerObject inherits off SpriteObject which inherits off GameObject.. and the jump code is only in the Sidescroller class, because it's the only class that would really need that functionality.. so it's really easy to derive from there to adjust the collision code more carefully.  I've really just been focusing on getting the meat of the engine working before I start on details like that because it's easy enough for somebody using the engine to inherit off those classes and implement it themselves anyway.

 

Nov 2, 2009 at 5:29 PM

Have you looked into FlatRedBall engine?

One side-scroller that I have played recently that I think was made very well is Paper Mario for Wii.

 

Nov 4, 2009 at 12:12 PM
Edited Nov 4, 2009 at 12:15 PM
fixitchris wrote:

Have you looked into FlatRedBall engine?

One side-scroller that I have played recently that I think was made very well is Paper Mario for Wii.

 

Yes, I've seen FlatRedBall.  It's an interesting approach.  Actually, if you've ever used Unity, they kind of approach 2D the same way.  The paper mario series were great!  2.5D is an interesting way to go rather than having 2D support,  but since I plan to evolve this engine into a full-fledged 3D engine anyway, the same type of thing will also be possible with Eek! in the future.  It might actually be easier to start off the 3D engine in a "2D" setting not having to worry about Z axis, but my main goal is to have full 3D support.

Also, native 2D support is more appealing to me because my hopes are to cross this engine to Silverlight eventually and hit the online gaming community, which has been gaining a lot of popularity due to facebook and whatnot.  It's my hope that Microsoft will eventually natively support this, but in the meantime Silversprite looks very promising.