ekdev wrote:
Google "game ai programming by example pdf" and download one of the first links that looks good. This has a lot of good information on player movement using linear velocity. You won't be able to accomplish anything close to navigating "bezier curves?" without using linear velocity. I'd suggest you try and implement just the seek and flee behaviors, if you can do those then you can probably do anything else. Probably should make a b2Object class to store and update all of your velocity, rotation, position, b2body, etc.
Good luck :]
From the sounds of it, it's not really what I'm looking for, but I'll look into it thanks!
(As per below, I may have been slightly unclear it seems).
irresistible force wrote:
By 'navigating', do you mean the user controls the character, or the computer controls the character?
Maybe you could give an example of the type of terrain you mean, what the issues are that you mention, and what kind of tweaking you mean. If you are writing the program yourself, I don't understand why it's not tweakable 🙂
Perhaps I wasn't as clear as I thought!
I want to implement a player character who is controlled by a human.
I currently have it up and running very crudely by setting the linear force of the player body perpendicular to the contact normal and disabling gravity while on the ground. However, there are obviously a bunch of issues with this, the body will leave the ground slightly when crossing edges... if the player jumps and smacks into the ground, depending on the angle, the player will slide small distance upon landing, etc.
I have little to no intention of having any real physics interaction for the player character, and any such interaction would be minimal and probably easiest just "hacked". The intention is a platformer and not a physics game, meaning, I want to have precise control over how the player moves and behaves (on various slopes and areas), and any physics will be visual fluff and not really interact with the player... meaning, my current intention is to discard the Box2D physics simulation for the player and manually solve it, unless there is a really good solution.
In practice, we may in the future want the player to be able to walk on walls, slide on slopes, walk on moving platforms, jump up and down "through" platforms, use a grappling hook, push/grab blocks, etc... and be able to precisely control how these behave and not just rely on whatever the physics simulation says. I.e, we may want the player to walk at a fixed speed at all angles between 0-30, and anything above that, the player will simply slide, etc.
Here is a very crude image I did a little while ago to demonstrate internally, #2 and #3 is pretty what we have in mind for terrain (again, very crude image, and it's "zoomed out").
But the core intent is basically, your average tiled platformer, but a little less flat.http://home.syranide.com/terrain.jpgSo, as above, my current idea is to not simulate the player body via Box2D but simply implement that myself, giving me full control. Long story short, what (I think) I'm really looking for is just a way to move the player a certain distance along the ground... I've only had a little time to experiment with this approach yet... but I'm curious what's recommended or if I've missed something trivial.(My last quick and dirty approach with shape collision tests and "recursively" finding the point of collision was really really inefficient, and not precise enough it seemed)
Just to give you
some idea of what we're intending, here's a random image of a platformer, with slightly curved terrain:
