[gameprogrammer] Re: 2D Collision
- From: "Alan Wolfe" <alan.wolfe@xxxxxxxxx>
- To: gameprogrammer@xxxxxxxxxxxxx
- Date: Wed, 7 Mar 2007 14:09:45 -0800
sounds pretty cool (:
nope you are right on topic :P
On 3/7/07, David Olsen <jolynsbass@xxxxxxxxx> wrote:
...
> the lag spikes i'm talking about are CPU or GPU related. My game
> designer is way into skill jumps so that was a problem (i hate em
> myself too hehe) so just the general small variations between frame
> times would make the tiniest bit of difference and made skill jumps
> impossible.
I'm not entirely sure if this is related, but the excellent open-source game
Neverball (www.icculus.org/neverball) utilizes predictive physics in order
to achieve amazing consistency of "tricks" on various platforms and CPUs/
vid cards... Frame rate does not impact the ability of the player to perform
various jumps, and precise skilled movements. I'm not sure how easy it would
be to incorporate predictive physics into a 2d game, but I'd guess it's
easier than for 3d... You might look at the source, and see what sort of
tricks the author has pulled to achieve this consistency and maybe it could
be applied to your game.
And sorry if I'm way off from what you're really talking about... :)
-David Olsen
> I think seperating the logic and drawing into 2 seperate threads could
> work, i'd just want to make sure and mutex them so objects wouldn't be
> moved while being drawn.
>
> I wonder how a timer would hold up to get the best of both worlds?
>
> On 3/5/07, Scott Harper <lareon@xxxxxxxxxxx> wrote:
>> Just throwing more ideas out, what if the logic and drawing were
>> separated? That is, the drawing remains on the main graphical thread
>> (with the visual context) whereas the logic processing is offloaded
>> onto another thread which continually runs? How would this affect/be
>> affected by your lag spikes?
>>
>> Also, are these lag spikes you speak of originating from net-based-
>> play? Or are you referring to something else entirely?
>>
>> As for skill jumps based on a time-passed-since-last-frame system, I
>> have been able to assume (though this is just on my machine) that the
>> time fragments will be small enough that as long as I over-compensate
>> the height at which a player can jump it makes it run okay. Besides,
>> nobody likes (read: "I don't like") skill jumps where if you don't
>> jump on exactly the right pixel you don't make it, forcing you to
>> have to make a dozen attempts or so. ^_^
>>
>> Does anyone have any comment, however, on how to make sure one gets
>> their proper jump level on a system where the logic isn't necessarily
>> at a fixed rate? Or do you think that perhaps a fixed rate is indeed
>> the right way to go? Is there someone with insight as to how, say,
>> professional engines handle this? I would be interested to see how
>> Quake or Unreal Tournament handle the wide variety of framerates at
>> which they're run, and also how they handle collision detection!
>>
>> -- Scott
>>
>> On Mar 5, 2007, at 9:25 AM, Alan Wolfe wrote:
>>
>> > it sounds like you have the collision thing well in hand (:
>> >
>> > in my side scroller i too had it until recently use the time between
>> > frames as a multiplier in all the physics and logic equations but i
>> > hit a problem when it came to lag spikes.
>> >
>> > For instance if the player is falling into a deep pit and theres an
>> > enemy that moves lateraly (imagine the origional metroid hehe) and the
>> > enemy and the player are on a collision course for the next frame. If
>> > there is a lag spike or it's a slow computer, imagine that the player
>> > is processed first and then the enemy. Instead of colliding with
>> > eachother, the player will get processed and be put farther down
>> > screen and then the enemy will be put where he is supposed to be, but
>> > the collision wont ever happen because they both moved too far for a
>> > single frame.
>> >
>> > Oh also with using the time between frames as a multiplier, i got
>> > "random" results with jumps and falls. Basically it was nearly
>> > impossible to reproduce a specific jump or walking off a platform and
>> > landing on a platform below. It was close every time but it wasn't
>> > the same every time so skill jumps were not really a possibility to
>> > put into the game.
>> >
>> > What i did to get around this (and so far it works pretty good) is to
>> > have a "time accumulation bucket" and basically have a while loop...
>> >
>> > Bucket += Time_Since_Last_Frame
>> >
>> > while (Bucket > some_amount)
>> > {
>> > GameLogic();
>> > Bucket-=some_amount;
>> > }
>> >
>> > so that way it processes everything in bite sized increments.
>> >
>> > Right now i have the some_amount at 20 miliseconds but i knwo this
>> > isnt a perfect solution because if the GameLogic() takes more than 20
>> > miliseconds, there is trouble (:
>>
>> ---------------------
>> To unsubscribe go to http://gameprogrammer.com/mailinglist.html
>>
>>
>>
>
> ---------------------
> To unsubscribe go to http://gameprogrammer.com/mailinglist.html
>
>
---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html
---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html
- References:
- [gameprogrammer] 2D Collision
- From: Scott Harper
- [gameprogrammer] Re: 2D Collision
- From: Scott Harper
- [gameprogrammer] Re: 2D Collision
- From: Alan Wolfe
- [gameprogrammer] Re: 2D Collision
- From: Scott Harper
- [gameprogrammer] Re: 2D Collision
- From: Alan Wolfe
- [gameprogrammer] Re: 2D Collision
- From: Scott Harper
- [gameprogrammer] Re: 2D Collision
- From: Alan Wolfe
- [gameprogrammer] Re: 2D Collision
- From: David Olsen
Other related posts:
- » [gameprogrammer] 2D Collision
- » [gameprogrammer] Re: 2D Collision
- » [gameprogrammer] Re: 2D Collision
- » [gameprogrammer] Re: 2D Collision
- » [gameprogrammer] Re: 2D Collision
- » [gameprogrammer] Re: 2D Collision
- » [gameprogrammer] Re: 2D Collision
- » [gameprogrammer] Re: 2D Collision
- » [gameprogrammer] Re: 2D Collision
- » [gameprogrammer] Re: 2D Collision
- » [gameprogrammer] Re: 2D Collision
- » [gameprogrammer] Re: 2D Collision
- » [gameprogrammer] Re: 2D Collision
- » [gameprogrammer] Re: 2D Collision
- » [gameprogrammer] Re: 2D Collision
- » [gameprogrammer] Re: 2D Collision
- » [gameprogrammer] Re: 2D Collision
...
> the lag spikes i'm talking about are CPU or GPU related. My game
> designer is way into skill jumps so that was a problem (i hate em
> myself too hehe) so just the general small variations between frame
> times would make the tiniest bit of difference and made skill jumps
> impossible.
I'm not entirely sure if this is related, but the excellent open-source game
Neverball (www.icculus.org/neverball) utilizes predictive physics in order
to achieve amazing consistency of "tricks" on various platforms and CPUs/
vid cards... Frame rate does not impact the ability of the player to perform
various jumps, and precise skilled movements. I'm not sure how easy it would
be to incorporate predictive physics into a 2d game, but I'd guess it's
easier than for 3d... You might look at the source, and see what sort of
tricks the author has pulled to achieve this consistency and maybe it could
be applied to your game.
And sorry if I'm way off from what you're really talking about... :)
-David Olsen
> I think seperating the logic and drawing into 2 seperate threads could
> work, i'd just want to make sure and mutex them so objects wouldn't be
> moved while being drawn.
>
> I wonder how a timer would hold up to get the best of both worlds?
>
> On 3/5/07, Scott Harper <lareon@xxxxxxxxxxx> wrote:
>> Just throwing more ideas out, what if the logic and drawing were
>> separated? That is, the drawing remains on the main graphical thread
>> (with the visual context) whereas the logic processing is offloaded
>> onto another thread which continually runs? How would this affect/be
>> affected by your lag spikes?
>>
>> Also, are these lag spikes you speak of originating from net-based-
>> play? Or are you referring to something else entirely?
>>
>> As for skill jumps based on a time-passed-since-last-frame system, I
>> have been able to assume (though this is just on my machine) that the
>> time fragments will be small enough that as long as I over-compensate
>> the height at which a player can jump it makes it run okay. Besides,
>> nobody likes (read: "I don't like") skill jumps where if you don't
>> jump on exactly the right pixel you don't make it, forcing you to
>> have to make a dozen attempts or so. ^_^
>>
>> Does anyone have any comment, however, on how to make sure one gets
>> their proper jump level on a system where the logic isn't necessarily
>> at a fixed rate? Or do you think that perhaps a fixed rate is indeed
>> the right way to go? Is there someone with insight as to how, say,
>> professional engines handle this? I would be interested to see how
>> Quake or Unreal Tournament handle the wide variety of framerates at
>> which they're run, and also how they handle collision detection!
>>
>> -- Scott
>>
>> On Mar 5, 2007, at 9:25 AM, Alan Wolfe wrote:
>>
>> > it sounds like you have the collision thing well in hand (:
>> >
>> > in my side scroller i too had it until recently use the time between
>> > frames as a multiplier in all the physics and logic equations but i
>> > hit a problem when it came to lag spikes.
>> >
>> > For instance if the player is falling into a deep pit and theres an
>> > enemy that moves lateraly (imagine the origional metroid hehe) and the
>> > enemy and the player are on a collision course for the next frame. If
>> > there is a lag spike or it's a slow computer, imagine that the player
>> > is processed first and then the enemy. Instead of colliding with
>> > eachother, the player will get processed and be put farther down
>> > screen and then the enemy will be put where he is supposed to be, but
>> > the collision wont ever happen because they both moved too far for a
>> > single frame.
>> >
>> > Oh also with using the time between frames as a multiplier, i got
>> > "random" results with jumps and falls. Basically it was nearly
>> > impossible to reproduce a specific jump or walking off a platform and
>> > landing on a platform below. It was close every time but it wasn't
>> > the same every time so skill jumps were not really a possibility to
>> > put into the game.
>> >
>> > What i did to get around this (and so far it works pretty good) is to
>> > have a "time accumulation bucket" and basically have a while loop...
>> >
>> > Bucket += Time_Since_Last_Frame
>> >
>> > while (Bucket > some_amount)
>> > {
>> > GameLogic();
>> > Bucket-=some_amount;
>> > }
>> >
>> > so that way it processes everything in bite sized increments.
>> >
>> > Right now i have the some_amount at 20 miliseconds but i knwo this
>> > isnt a perfect solution because if the GameLogic() takes more than 20
>> > miliseconds, there is trouble (:
>>
>> ---------------------
>> To unsubscribe go to http://gameprogrammer.com/mailinglist.html
>>
>>
>>
>
> ---------------------
> To unsubscribe go to http://gameprogrammer.com/mailinglist.html
>
>
---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html
- [gameprogrammer] 2D Collision
- From: Scott Harper
- [gameprogrammer] Re: 2D Collision
- From: Scott Harper
- [gameprogrammer] Re: 2D Collision
- From: Alan Wolfe
- [gameprogrammer] Re: 2D Collision
- From: Scott Harper
- [gameprogrammer] Re: 2D Collision
- From: Alan Wolfe
- [gameprogrammer] Re: 2D Collision
- From: Scott Harper
- [gameprogrammer] Re: 2D Collision
- From: Alan Wolfe
- [gameprogrammer] Re: 2D Collision
- From: David Olsen