[gameprogrammer] Re: 2D Collision

You know what, I wonder if this was the issue I was experiencing in my 3rd
Person Destructo game, where sometimes the buildings would animate and
destroy correctly on collision, then others, you would hit one, and all the
buildings would destroy or other strange things like this.  Meaning
sometimes, it would appear to let the vehicle collide perfectly with the
buildings, and other times, it was like obvious it was like half the width
away from it.  Still other times the collision didn't register, you would
sit there right next to the buildings and they would not animate to show any
damage at all.

I was running it in windowed mode window under xp, wonder if the OS was the
culprit, I never could figure out why it was wigging out sometimes, but
acting correct others.

Hmmm, that is why I love this email list.

Ken,

BTW: Scott, your setup is on the way, I have just been really busy, out of
town almost every day, starting last Thursday, I have to run again to
Nashville today, then when I get home I will set you up.  Can you make sure
an email me your user and pass again to make sure I still have it.

Thanks... Ciao' 4 Now.


-----Original Message-----
From: gameprogrammer-bounce@xxxxxxxxxxxxx
[mailto:gameprogrammer-bounce@xxxxxxxxxxxxx] On Behalf Of Dominic McDonnell
Sent: Tuesday, March 06, 2007 7:23 AM
To: gameprogrammer@xxxxxxxxxxxxx
Subject: [gameprogrammer] Re: 2D Collision

Lag spikes can and will happen for a variety of reasons on modern 
multitasking operating systems as we don't have complete control of the 
cpu and os. Say the os decided to switch away from your game to do 
something like check the network stack or something. You cannot be sure 
that your game is the only process running on the computer, and besides 
which driver software sometimes takes a variable amount of time to do 
the same operation, like doing a bit transfer.
   I also find the move object time since last update X speed of objects 
makes debugging a nightmare. I prefer to move each object a certain 
amount per frame and have a pause that ensures that the loop has a 
minimum length, say 30 milliseconds.

Dominic McDonnell

Alan Wolfe wrote:

> totally good discussion goin on here, im curious too (:
>
> 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 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


Other related posts: