TechnoCat wrote: I'm glad you like my Noah's Ark game!
However, I strongly encourage you not to use any of Noah's Ark code and to merely look at it. I wrote that code and created all the graphics during a 48 hour gamejam. It is really messy and really hardcoded! Like you said, take out one thing and it all falls apart.
There are 4 paths to collision detection and resolution for sidescrollers that I will recommend.I hope this helps you get started.
- Use Fizz (or similar, of which I am aware of no others)
- This library was written specifically to be a drop-in solution to making a sidescroller.
- Lightweight
- Very easy
- Might not have all functionality (It tries to be a single solution)
- Use Hardon Collider (My personal favorite path)
- This library is written to purely be a collision detection library, not a collision resolution library. However, detection is the hard part.
- Lightweight
- A little bit of difficulty. (requires you read the HC API)
- Very robust (this library makes almost no assumptions)
- Implement a versatile collision detection library (such as Metanet's)
- To do this you are going to need a really good understanding of Linear Algebra
- You'll still have to resolve collisions after you implement this.
- Use Box2D
- Box2D is often considered unsuitable for sidescrollers. But, Kurosuke and some others get away with it.
- love.physics is actually Box2D
Simple, lightweight, general purpose collision detection
- TechnoCat
- Inner party member
- Posts: 1611
- Joined: Thu Jul 30, 2009 12:31 am
- Location: Milwaukee, WI
- Contact:
Re: Simple, lightweight, general purpose collision detection
I responded to a PM about using Noah's Ark to learn about sidescrolling and I thought my response could help the general public.
- tentus
- Inner party member
- Posts: 1060
- Joined: Sun Oct 31, 2010 7:56 pm
- Location: Appalachia
- Contact:
Re: Simple, lightweight, general purpose collision detection
A little tweaking and that would be a very helpful wiki entry, we see the topic brought up enough for it to be worth it IMHO. Also, thanks for mentioning Kurosuke!TechnoCat wrote:I responded to a PM about using Noah's Ark to learn about sidescrolling and I thought my response could help the general public.TechnoCat wrote: I'm glad you like my Noah's Ark game!
However, I strongly encourage you not to use any of Noah's Ark code and to merely look at it. I wrote that code and created all the graphics during a 48 hour gamejam. It is really messy and really hardcoded! Like you said, take out one thing and it all falls apart.
There are 4 paths to collision detection and resolution for sidescrollers that I will recommend.I hope this helps you get started.
- Use Fizz (or similar, of which I am aware of no others)
- This library was written specifically to be a drop-in solution to making a sidescroller.
- Lightweight
- Very easy
- Might not have all functionality (It tries to be a single solution)
- Use Hardon Collider (My personal favorite path)
- This library is written to purely be a collision detection library, not a collision resolution library. However, detection is the hard part.
- Lightweight
- A little bit of difficulty. (requires you read the HC API)
- Very robust (this library makes almost no assumptions)
- Implement a versatile collision detection library (such as Metanet's)
- To do this you are going to need a really good understanding of Linear Algebra
- You'll still have to resolve collisions after you implement this.
- Use Box2D
- Box2D is often considered unsuitable for sidescrollers. But, Kurosuke and some others get away with it.
- love.physics is actually Box2D
Kurosuke needs beta testers
- lots_of_birds
- Prole
- Posts: 13
- Joined: Sun Dec 11, 2011 12:09 pm
Re: Simple, lightweight, general purpose collision detection
Hi there,
I've followed the HC tutorial, and I've found several bugs on it.
Too bad it's not a wiki. I'm not sure where to contribute, so, I gess here is better than not doing it.
On the rebound part only: (on the whole picture the code is right on this part)
should be instead:
---
In the function on collide, when introduced and on the whole picture, undefined variables are used instead of the right and left goals
This:
should be this:
----
----
By the way, I'm pretty impressed with the work done. Is there still work to be done ? Is there some kind of bug index ?
I've followed the HC tutorial, and I've found several bugs on it.
Too bad it's not a wiki. I'm not sure where to contribute, so, I gess here is better than not doing it.
On the rebound part only: (on the whole picture the code is right on this part)
Code: Select all
ball.velocity.y = bx - py
Code: Select all
ball.velocity.y = by - py
In the function on collide, when introduced and on the whole picture, undefined variables are used instead of the right and left goals
This:
Code: Select all
if other == goalLeft then
ball.velocity = {x = 100, y = 0}
ball:moveTo(400,300)
elseif other == goalRight then
Code: Select all
if other == borderLeft then
ball.velocity = {x = 100, y = 0}
ball:moveTo(400,300)
elseif other == borderRight then
----
By the way, I'm pretty impressed with the work done. Is there still work to be done ? Is there some kind of bug index ?
- lots_of_birds
- Prole
- Posts: 13
- Joined: Sun Dec 11, 2011 12:09 pm
Re: Simple, lightweight, general purpose collision detection
I have a question about this library.
I can't figure why it print messages on the output of my program.
I've checked the source code, I've found the corresponding lines, but I still don't understand what it means.
The messages are "collide?" and "sat"
Anyone knows what I am doing wrong, or what does it means?
I can't figure why it print messages on the output of my program.
I've checked the source code, I've found the corresponding lines, but I still don't understand what it means.
The messages are "collide?" and "sat"
Anyone knows what I am doing wrong, or what does it means?
Re: Simple, lightweight, general purpose collision detection
One question please, I'm seeing a lot here in several posts talking about detection done with boxes, hardon collisions, minimal detection and so on but seems that in LOVE mask detection technique (with slower pixel full mask point to point detection or more faster selected pixel points detection) a bit forgot and unused around. There is any reason or inconveniences for using such techniques? Is an obsolete concept/technique?
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Simple, lightweight, general purpose collision detection
Mostly because you need to keep the ImageData of everything around, if you've got a single (or few) level images, it sure is an option. Come to think of it, you can probably all draw it to a FrameBuffer and go from there.
Re: Simple, lightweight, general purpose collision detection
Thank you bartbes, I have somewhere in an old pc a small game done in some Basic engine using Mask Collision. Perhaps after current project gonna try speedily convert it to LOVE.bartbes wrote:Mostly because you need to keep the ImageData of everything around, if you've got a single (or few) level images, it sure is an option. Come to think of it, you can probably all draw it to a FrameBuffer and go from there.
Re: Simple, lightweight, general purpose collision detection
I must have checked in a "debug" version. Simply remove the prints in line 182 and 184 of shapes.lua.lots_of_birds wrote:The messages are "collide?" and "sat"
SAT stands for Separating Axis Theorem and is what HC uses for fine collision detecion.
The messages will be removed in the next version of HC (which will also use Class Commons for good measure).
- lots_of_birds
- Prole
- Posts: 13
- Joined: Sun Dec 11, 2011 12:09 pm
Re: Simple, lightweight, general purpose collision detection
I feel relieved, thanks !
Re: Simple, lightweight, general purpose collision detection
HardonCollider Update!
- Fixed polygon triangulation bug.
- Added Spatialhash:draw()
- Use class-commons for all the things
Code: Select all
class_commons = true
require 'slither'
Collider = require 'hardoncollider'
-- rest as usual
- Attachments
-
- demo.love
- (17.22 KiB) Downloaded 236 times
Who is online
Users browsing this forum: Google [Bot] and 2 guests