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

Beginners question on how to create the world

Feb 5, 2009 at 10:48 AM
Hi there,

First of all thanks for this engine which is a great oppertunity for creating original and gameplay minded games. I love it already.
I'm quite a beginner with physics and cannot totally work out the way of creating a solid world (ie walls/ground), which is not tile-based. For example, take the game Diver. The world is solid, but not tiled. How can one achieve this?
My idea was to create a sprite and extract a huge geometry out of it, using the TextureToVertices function. But then any floating rocks must be created seperatly and I'm wondering how this works with larger levels. Again, if you take a look at diver, I'm wondering how the world of dive #26 was done, with the sharp spikes, crossing eachother.

Any idea would be welcome.
Feb 5, 2009 at 11:13 AM
Creating a huge geometry might not be a good idea :) We generally say the landscapes should be chunked up so that we don't slow down the physics engine. Info on how to do this is in our manual. (It seems that is down right now.)

Playing with physics is as simple as it can be. You create your character with a graphics application and map him out. You can do this manually or use the texture to polygon code. Then you create a body (a body is affected by gravity and you can apply forces to it.) and then a geometry (geometries define the shape of the body). That's it...

Both the body and geometry needs to be added to the physics engine. That's done easily by using our Body and GeomFactory. You can also have a look at our samples. The Simple Samples show you the basics of adding a body, a geometry and how to use collisiongroups to make non collideable geometries. I've not seen level 26 of Diver, but I would think that the spikes are one geometry or several geometries with defined CollisionCategories so that they don't collide.
Feb 5, 2009 at 12:14 PM
Thanks for your reply.
I'm not a totally noob with Farseer. I mean, I read the manual and understand the basics. I was just wondering how to do landscapes. What you're saying, is to create a landscape out of numerous standalone bodies, like rocks, and place (pin) them on the correct place in the world, am I right?
Feb 5, 2009 at 2:23 PM
Edited Feb 5, 2009 at 2:27 PM
You may want to wait 'til Sunday noon. I can't promise but I'm planing on finishing the new polygon from texture code on Sunday noon. If genbox or someone else is on then they'll test the code and probably check it in. (I need this, too and I really want to get it done ... but I can't promise, sorry.)

This would solve the floating rock problem, because the new functionality will detect more then one polygon per texture and also holes in textures and textures in holes of the texture and so on ... recursively.

Quote mattbettcher:
Well you can add multiple Geom's to a single Body and they will act as one without any joints between them.
Feb 5, 2009 at 3:34 PM
Yeah I read your posts and I'm very interested in that function. What does it do when it finds those holes and floating parts? Does it return like an array of geometries with their position relative to the position on the texture? That would be of great use!
Feb 5, 2009 at 6:56 PM
It will create a list of vertex lists in texture coordinates. So your floating parts - and everything else - will have the same coords as on the texture.
I'm also planning on adding some functions to the Body, Geom and Complex factories ;).
Feb 6, 2009 at 12:24 AM
@sickbattery: Man... you are really active right now :) Good to see you in action.
I still have my doubts about the whole hole in texture stuff, I hope it all gets better when I see your code in action.
What's up with the body, geom and factories extension? Would like to hear what your ideas are.