Page 17 of 23

Re: [library] bump.lua v3.1.4 - Collision Detection

Posted: Tue Jan 19, 2016 9:26 pm
by stakira
This is a really good library. I really enjoy using it. The only additional thing I wish it has is circles. Representing characters as rectangles makes it hard to push through each other. If they are represented as circles, using "slide" as resolution, two characters (roughly) moving towards each other won't get stuck. However I like the simplicity of this library. Supporting arbitrary shapes would give bump.lua too much weight.

Re: [library] bump.lua v3.1.4 - Collision Detection

Posted: Tue Jan 19, 2016 9:53 pm
by kikito
Thanks!

Remember that you can use several rectangles to represent a character too. That's how it's done in games like Street Fighter:



For circles in particular, see how they did the "barrels" (around the 8:00 mark) - they just used rectangles for them too.

If you really need circles with more precision, you can always use bump for the "broad phase" (if the two rectangles containing two circles don't collide, then the circles don't collide either), and then "fine-tune" the collision using your own stuff. Circle-circle collision is very easy to calculate.

Re: [library] bump.lua v3.1.4 - Collision Detection

Posted: Thu Feb 04, 2016 6:40 am
by 4aiman
kikito wrote:Does your computer segfault with other games or programs? Have you tried running it from the console, to see if it leaves any message before it "dies"? Also, is your keyboard ok? Pressing "escape" closes the demo, maybe it "presses it" due to a hardware error.
1. No, it doesn't. In fact, I have had a bad surprise getting segfault with love2d...
2.Yes, I've tried. The only message I'm getting is "segmentation fault".
3. Yes, my keyboard is perfect.
4. Pressing "escape" won't trigger segfault, since the demo in question should quit normally.


However, I did a bit more testing and was able to isolate the issue:
The "nkro USB" keyboards with "asiokbd" driver segfaults the demo after PC has been put into suspend mode and then "waked up". The demo works just fine if no suspension took place.
I think the reason is the driver, since this only happens on Debian (x64) whereas Windows with all the same HW operates normally. It's a shame that my kbd is not supported by the latest Sid kernels.


Oh, I have also discovered another issue:
A netbook with Debian Sid (x86) and some i945 IGA segfaults upon launching the demo (i.e. no keys were pressed at all) when the following is true:
a) there are 2 displays (LVDS1 & VGA1) connected;
b) some freak disconnects the VGA1 w/o disabling it in the xconf (I'm using XFCE 4.10);
c) user logs out and the re-logins.
Reboot helps a lot in this case.

Hope that'll help someone.

Re: [library] bump.lua v3.1.4 - Collision Detection

Posted: Thu Feb 04, 2016 10:34 am
by kikito
I was under the impression that you were getting segfaults under regular use. If you are getting these errors while doing those "unusual things" (suspending, unhooking monitors, logging in and out etc), could it be that they are not exclusive to the bump demo, but to all LÖVE games. Have you tried doing those things in other LÖVE games?

Re: [library] bump.lua v3.1.4 - Collision Detection

Posted: Fri Feb 05, 2016 5:54 am
by 4aiman
Yes, I did try doing those things with other LÖVE games.
Aside from various demos like "Jelly Beans", "slopeFixed", "Raycaster_latest" (although the latter gave me 0 fps with i945 IGA) I've tried re-implementing the "Your first game in under 200 lines" tutorial with some modifications (nothing so special) as well as writing a variation of "Magic Jewelry" (using BGMs, particles systems, SFX, various image and sounds formats, shadowed labels with custom font, saves, etc).

Parallax occlusion demo has crashed several times (2-3?), but after several unsuccessful launches it did start normally and I was able to run it normally ever since.

The one and only symptom I managed to single out was the fact that if xrandr fails to turn on/off the VGA1 output from tty, then some LÖVE games with cameras would crash several times on LVDS1.

Dunno how to fix and what to try.

PS: I wouldn't have called those things "unusual", thought :)

Re: [library] bump.lua v3.1.4 - Collision Detection

Posted: Fri Feb 05, 2016 6:27 am
by Davidobot
4aiman wrote: "slopeFixed", "Raycaster_latest" (although the latter gave me 0 fps with i945 IGA)
The slope demo is mine, does it work alright?
Are you also referring to my raycaster or someone else's? If it's mine, the demo uses 0.9.2 and heavy usage of shaders, so if you're running off a CPU only it could prove to be a problem, but not to that extent.
Also, I'm not sure it's normal for LOVE games to crash that often.. Maybe your computer is just incompatible?

Re: [library] bump.lua v3.1.4 - Collision Detection

Posted: Sat Feb 20, 2016 5:06 pm
by Garb
Does anybody know how i can use the cross filter when I'm applying velocities to my player?
Right now my the world:check of my player when he jumps is this:

Code: Select all

  local actualX, actualY, cols, poop = world:check(player, player.x, player.y+1)
  for i=1,poop do
    player.yvel = 0
    player.onGround = true

end
this makes the player move properly, however the issue is that if I set yvel to 0 then every time the player touches anything, the player keeps having his yvel reset, so he very slowly moves through objects with the cross filter.

I'm not sure how to work around this?

Re: [library] bump.lua v3.1.4 - Collision Detection

Posted: Sun Feb 21, 2016 1:24 am
by NightKawata
Garb wrote:Does anybody know how i can use the cross filter when I'm applying velocities to my player?
Right now my the world:check of my player when he jumps is this:

Code: Select all

  local actualX, actualY, cols, poop = world:check(player, player.x, player.y+1)
  for i=1,poop do
    player.yvel = 0
    player.onGround = true

end
this makes the player move properly, however the issue is that if I set yvel to 0 then every time the player touches anything, the player keeps having his yvel reset, so he very slowly moves through objects with the cross filter.

I'm not sure how to work around this?
I.... would probably re-read the documentation. That's a tad bit odd in terms of how you're going about that...
Generally the "cross" filter is for colliding with projectiles or so, the "bounce" filter could be used for springs or jumping on enemies (I do that in Metanet Hunter CD else it causes bugs, since bounce isn't quite continuous), "slide" is good for solids and the like, and false is good for all dat unimportante stuff.

Right now, that would make him reset his velocity for literally anything 1 pixel under him, which would be imprecise due to not properly taking advantage of delta time and... yeah, definitely check out kikito's examples. I learned a lot in my first rodeo with bump due to that!

Re: [library] bump.lua v3.1.4 - Collision Detection

Posted: Sun Feb 21, 2016 4:00 pm
by kikito
Garb wrote:I'm not sure how to work around this?
Hi, In your case you have two options:
  • If what you want to do is ignoring the collisions completely, you can make the filter function return nil for the items you want to ignore. This will not produce any collision at all (the "cross" collision type produces a collision - it just doesn't "move" the item. This is useful for things like picking up coins).
  • If you *do* want to know about these collisions, then what you must do is stop resetting yvel in all your collisions. You clearly want to set it only in certain cases. You will need to add at least one "if" to your code which uses cols.type, maybe with something like if cols.type == "slide" then ...
  • If you are doing a platformer, you should also know that setting the yvel in all types of collision is not a good idea. Instead, you should set it only when the collision is "with something that is below", like a floor tile, but not when you collide with "something to the right or left", like a wall. The way to do this is using the collision normal, which bump puts in cols.normal.y. A collision with a floor is usually happening when that value is < 0.

Re: [library] bump.lua v3.1.4 - Collision Detection

Posted: Tue Feb 23, 2016 7:58 pm
by 4aiman
Davidobot wrote:
4aiman wrote:... running off a CPU only it could prove to be a problem, but not to that extent.
...
Maybe your computer is just incompatible?
I've tried to boot another OS (Linux Mint) from a removable drive and there were no crashes with the same binaries of love2d.
I've figured it out that if VESA driver works just fine then it must be some Intel driver (or it's settings) issue.
On the other hand, i945 does not support shaders in OpenGL so that may be the other reason. It well might be that Intel tried to repeat their trick with DX-compensative-drivers on Linux...
Don't know.

Thanks for your time.