This project has moved and is read-only. For the latest updates, please go here.

Drawing Shapes

Topics: User Forum
Feb 17, 2009 at 9:01 PM

I do apologise if this has been asked before, or if my google-fu is failing me, however I cant seem to find any help ont his topic. Watching this video: the person is able to draw shapes which happily work together inside farseer. Im currently researching and prototyping for a new game, more specifically how I will build levels, and am wondering upon something:

I ould like a level editor where I am able to "draw" the level by specifying vertex points and creating polygons, the player would then drive along these polygons to get to the exit. Is the ability to do this a standard feature within farseer, and if so, could any point me in the correct direction for where I would start to create this.

If any more information is needed, or I have not explained myself very well please ask for more details.

Any help is appreciated.

Scott Bevin
Feb 17, 2009 at 10:27 PM
Farseer Physics does not in any way draw anything to the screen. It's up to the developer to draw the simulation that Farseer Physics does to  the screen. But don't worry, we are able to help you to an extend.
The demos you see in that movie is actually made by us (they are just ported to BlitzMax). They are called Simple Samples and can be downloaded on our download page. The samples build on a relatively simple foundation that is able to draw simple shapes like rectangles, ellipses and lines. To support a polygon shape (more complex shapes) you will need to create your own method of doing that. (Saw something about it on the forum not too long ago).

Try downloading the samples and run them. They show off the engine's capabilities and gives you a great foundation to build your own game on.
Feb 17, 2009 at 10:47 PM
Ahh i think you misunderstood me, however telling me to go look at the demos was a good prod, I had only actually noticed one, not the second. The demo on creating vertices from textures is exactly what im after.

Thankyou, Scott
Feb 17, 2009 at 10:59 PM
Edited Feb 17, 2009 at 10:59 PM
Oh, sorry about that. Thought you were focusing on the drawing of the polygons.

Anyway, yep, we do have a texture to polygon method that finds the outer hull of a texture. You will still need to create the texture before you can map it. The texture you see is created in a graphics application, and not by code.
Feb 18, 2009 at 1:08 AM
One more question, as im still slightly unsure of the inside workings of farseer, at the moment I just have it so basic shapes can be drawn to define a level, Click here for image, I ned to keep the grid size inside these level polygons fairly small else i experience object cutting corners, however this kills performance. My idea is to post process the level where I will split it into smaller chunks, each chunk will then be able to have a farily small gap between grid spaces, before I spend time implementing this, I am correct in my thoughts that the broad phase collision will make this a viable option?

Thanks again, Scott
Feb 18, 2009 at 8:11 AM
If you chunk up the geometries, you can get away with some higher grid cell sizes. You need small grid cell size for sharp corners and large geometries. If you chunk up your geometries, you will gain a lot of performance. First of all, the geometries are not as often in the broad phase and second, you can generate your geometries faster because of higher grid cell sizes. (and not use as much memory).
Feb 18, 2009 at 5:56 PM
Thanks for all the help, Scott