Newbie stuff
-
- Posts: 188
- Joined: Wed Feb 02, 2011 4:23 am
- Contact:
Newbie stuff
Hi all,
Have decided to bite the bullet (no pun intended) and add Chipmunk to my project.
A few simple questions though
1) I am doing a top down rpg; as I don't need gravity I assume I just set it to 0?
2) My top down world is tile based; do I 'somehow' create polys around my 'tiles' and add them to the chipmunk world for collisions?; is this the best method?
3) Currently in game I can pick up objects (i.e. actually carry them above my head), and then throw or put them down. What's the best method to implement this in chipmunk when I have no height? )). Obviously once the object is 'thrown' I will need it to check for collisions but only with objects that are in line (i.e. though visually behind)
4) The main character is joypad based; therefore his movement 'physics' are almost non existent; how can I have him move left/right etc. instantly i.e. no physics applied.
5) Can I manually update an objects x/y; if so where/how/when without breaking the physics world (e.g. teleport an object)?
6) My tile landscape scrolls. Does that mean my tiled scenery object is static???; but it has too move for the scroll; so is it not static! )) , where would I update it's scroll pos?
7) Can I check for a collision 'real-time' i.e. I need to know 'now' if this object has collided; or is this the wrong approach :-/ ?
Sorry for soooooo many questions!
I just hope I get the basic character against static (scrolling) scenery working at 60fps; then I will have proved that Chipmunk is viable for my needs; and I will be a happy guy!!! ))
Cheers
Have decided to bite the bullet (no pun intended) and add Chipmunk to my project.
A few simple questions though
1) I am doing a top down rpg; as I don't need gravity I assume I just set it to 0?
2) My top down world is tile based; do I 'somehow' create polys around my 'tiles' and add them to the chipmunk world for collisions?; is this the best method?
3) Currently in game I can pick up objects (i.e. actually carry them above my head), and then throw or put them down. What's the best method to implement this in chipmunk when I have no height? )). Obviously once the object is 'thrown' I will need it to check for collisions but only with objects that are in line (i.e. though visually behind)
4) The main character is joypad based; therefore his movement 'physics' are almost non existent; how can I have him move left/right etc. instantly i.e. no physics applied.
5) Can I manually update an objects x/y; if so where/how/when without breaking the physics world (e.g. teleport an object)?
6) My tile landscape scrolls. Does that mean my tiled scenery object is static???; but it has too move for the scroll; so is it not static! )) , where would I update it's scroll pos?
7) Can I check for a collision 'real-time' i.e. I need to know 'now' if this object has collided; or is this the wrong approach :-/ ?
Sorry for soooooo many questions!
I just hope I get the basic character against static (scrolling) scenery working at 60fps; then I will have proved that Chipmunk is viable for my needs; and I will be a happy guy!!! ))
Cheers
-
- Posts: 37
- Joined: Tue Sep 14, 2010 4:33 am
- Contact:
Re: Newbie stuff
I don't understand why you need chipmunk for this sort of thing
You know it's tile based, is top down, and you won't be needing physics for most of your game. It seems to me that the only feature of Chipmunk you're using are Collisions. I suggest you skip physics altogether, tough slembcke may not agree with me
Hope this helps!
You know it's tile based, is top down, and you won't be needing physics for most of your game. It seems to me that the only feature of Chipmunk you're using are Collisions. I suggest you skip physics altogether, tough slembcke may not agree with me
Hope this helps!
-
- Posts: 188
- Joined: Wed Feb 02, 2011 4:23 am
- Contact:
Re: Newbie stuff
LOl!
You are almost right.
But it would be great to later on have rope bridges/physics puzzles/ objects you can push/pull.
Throwing an object might hit other objects causing them to move.
So although initially it's the collision side I really need; the physics side would come in to play later.
That sound like a reason to use Chipmunk? ))
Cheers
You are almost right.
But it would be great to later on have rope bridges/physics puzzles/ objects you can push/pull.
Throwing an object might hit other objects causing them to move.
So although initially it's the collision side I really need; the physics side would come in to play later.
That sound like a reason to use Chipmunk? ))
Cheers
-
- Posts: 188
- Joined: Wed Feb 02, 2011 4:23 am
- Contact:
Re: Newbie stuff
Ok!
having lots of issues with the character control.
I move my character with bodyapplyimpulse and have the friction really high; but he still steers like a mad thing!. I just want him to be instantly responsive and reactive to the joystick input.
Also, I have set my scenery with addstaticshape; but is this correct if it scrolls?
Which brings me onto my next issue. Essentially when scrolling the character stays in the centre of the screen; but can 'move' when at the edge of the map i.e. the scrolling stops.
How can I implement this with chipmunk???
Getting confused by how I move the character,rogue and static objects; and there seems to be a general sentiment on other threads that perhaps for 2d top-down chipmunk isn';t the way to go..... ((((
Cheers
having lots of issues with the character control.
I move my character with bodyapplyimpulse and have the friction really high; but he still steers like a mad thing!. I just want him to be instantly responsive and reactive to the joystick input.
Also, I have set my scenery with addstaticshape; but is this correct if it scrolls?
Which brings me onto my next issue. Essentially when scrolling the character stays in the centre of the screen; but can 'move' when at the edge of the map i.e. the scrolling stops.
How can I implement this with chipmunk???
Getting confused by how I move the character,rogue and static objects; and there seems to be a general sentiment on other threads that perhaps for 2d top-down chipmunk isn';t the way to go..... ((((
Cheers
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Newbie stuff
Hey Markhula. I did see your PM from iDevGames, but haven't had time to reply to it yet.
Basically, if you want to use a physics engine you are going to have to deal with how it wants to control the motion of your objects. You are also going to run into quirks now and then that you could easily work around with simpler collision detection/response. Some potential problems:
http://files.slembcke.net/chipmunk/rele ... emoOSX.tgz
http://files.slembcke.net/chipmunk/rele ... emoWin.zip
In the past, I would have tried to discourage people from using Chipmunk for stuff like this. After I figured out the trick that makes the Tank demo work so smoothly, I've changed my mind a bit. If you can control most of your objects using force or constraints, you should have few problems.
Basically, if you want to use a physics engine you are going to have to deal with how it wants to control the motion of your objects. You are also going to run into quirks now and then that you could easily work around with simpler collision detection/response. Some potential problems:
- Chipmunk isn't super friendly to tilemaps. You could insert a static square shape for every tile, but I'm not sure if the performance would be acceptable or not. It would probably be fine as long as you tuned the spatial hash's grid to match your tile grid.
- Physics engines tend to have problems with "cracks" between shapes. Even if your tile squares line up exactly, you are still going to notice that you catch corners once in a while. There are a number of simple and complex fixes with different tradeoffs.
- It can be hard to mix physics controlled objects and non-physics controlled objects.
http://files.slembcke.net/chipmunk/rele ... emoOSX.tgz
http://files.slembcke.net/chipmunk/rele ... emoWin.zip
In the past, I would have tried to discourage people from using Chipmunk for stuff like this. After I figured out the trick that makes the Tank demo work so smoothly, I've changed my mind a bit. If you can control most of your objects using force or constraints, you should have few problems.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 188
- Joined: Wed Feb 02, 2011 4:23 am
- Contact:
Re: Newbie stuff
Hey there Slembcke,
Thanks for the input.
Some thoughts!
I could group tiles together to form one large poly and therefore reduce overhead; that sound good?
'cracks' between tiles; can I not overlap adjacent tiles so no cracks occur??
Can I teleport objects?
I guess I need to get the tank demo working!!!
Cheers
p.s. got what I think is the tank demo working. Where it follows the mouse and pushes the cubes around. Seems promising. If the objects were static (unmovable) would it steer correctly around them?
p.s.s Don't you think it would be great to have a top-down arcade style game with physics!
Thanks for the input.
Some thoughts!
I could group tiles together to form one large poly and therefore reduce overhead; that sound good?
'cracks' between tiles; can I not overlap adjacent tiles so no cracks occur??
Can I teleport objects?
I guess I need to get the tank demo working!!!
Cheers
p.s. got what I think is the tank demo working. Where it follows the mouse and pushes the cubes around. Seems promising. If the objects were static (unmovable) would it steer correctly around them?
p.s.s Don't you think it would be great to have a top-down arcade style game with physics!
-
- Posts: 188
- Joined: Wed Feb 02, 2011 4:23 am
- Contact:
Re: Newbie stuff
Ok
This is very problematic
Can't I just set linear velocity for the character movement?
Though to be honest I think it's best as suggested just to use for collisions and not physics
Can I do that ? , why do I think this isn't as easy as it sounds
Cheers
This is very problematic
Can't I just set linear velocity for the character movement?
Though to be honest I think it's best as suggested just to use for collisions and not physics
Can I do that ? , why do I think this isn't as easy as it sounds
Cheers
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Newbie stuff
Directly setting the linear velocity doesn't always work very well. The problem is that when you run into a wall, the velocity is reduced to zero, then you go back and overwrite that value with a fairly large number again the next frame. This is especially problematic when trying to push objects around. The player will have a gigantic amount of strength and this can cause stability problems.
Is there anything in particular wrong with the constraint method? Basically you are setting the linear velocity of the control body and that passes the velocity on to the controlled body while respecting the player's maximum movement strength. It also moves the application of the velocity into the constraint solver which pretty much solves the stability problems.
If you really just want collisions only, you can override the spaces default collision handlers. Just make the pre-solve callback always return false to tell it not to resolve the collision. This pretty much means that you don't get to do any physics though. No rope bridges or pushable boxes.
Is there anything in particular wrong with the constraint method? Basically you are setting the linear velocity of the control body and that passes the velocity on to the controlled body while respecting the player's maximum movement strength. It also moves the application of the velocity into the constraint solver which pretty much solves the stability problems.
If you really just want collisions only, you can override the spaces default collision handlers. Just make the pre-solve callback always return false to tell it not to resolve the collision. This pretty much means that you don't get to do any physics though. No rope bridges or pushable boxes.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 188
- Joined: Wed Feb 02, 2011 4:23 am
- Contact:
Re: Newbie stuff
Arrrghhhhh , what to do !
Problem is if I go the physics route with my player all collisions etc are out of my control
Whilst if I just have collisions at least I am in control
I guess I should try tank mode first
What do I do about scrolling the static scenery ? ; how can I scroll it within the physics correctly ?
Is there no way I can move an object with such speed but no deceleration that it gets to it's destination instantly ? I.e effectively teleport ?
My real issue is which route to go and suffer no physics or suffer the issue the physics cause me !
If I am fighting the physics engine all the time then I am wasting my time with that approach
I am desperate to integrate physics in a top down approach but not if I bang my head against a wall at every turn
Help !
Cheers
Problem is if I go the physics route with my player all collisions etc are out of my control
Whilst if I just have collisions at least I am in control
I guess I should try tank mode first
What do I do about scrolling the static scenery ? ; how can I scroll it within the physics correctly ?
Is there no way I can move an object with such speed but no deceleration that it gets to it's destination instantly ? I.e effectively teleport ?
My real issue is which route to go and suffer no physics or suffer the issue the physics cause me !
If I am fighting the physics engine all the time then I am wasting my time with that approach
I am desperate to integrate physics in a top down approach but not if I bang my head against a wall at every turn
Help !
Cheers
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Newbie stuff
I think you'll find that the Tank demo control will work pretty well. You can even ignore the rotation bits, and logic for turning steering so it will be pretty trivial to try out.
As for scrolling static scenery, just leave everything in absolute coordinates and move your viewport around. Doing anything else would be insanely complicated for no good reason.
Lastly, things aren't completely out of your control, you just need to consider an new angle about how to make them move.
As for scrolling static scenery, just leave everything in absolute coordinates and move your viewport around. Doing anything else would be insanely complicated for no good reason.
Lastly, things aren't completely out of your control, you just need to consider an new angle about how to make them move.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Who is online
Users browsing this forum: Bing [Bot] and 23 guests