Originally Posted by
iSpeed
Are you staff? or were you staff?
Ninja, have been since the latter part of 08. I could go through it all, but there's a thread about who's been in which position that already has my info in it.
Originally Posted by
8OJ4N
Anyway, Skull, have you ever make anything with precise pixel masking for sprite collision states? Can you share some wisdom about it?
I have indeed, the shitty shooter I did for the 24h game compo a few years ago was 100% pixel collision - and it suffered badly for it. Time was short & making something register collisions that way was quicker than making hitboxes.
Fap-Race was also pixel perfect, but the game was only like 40px by 60px or summit daft like that, and the only collisions were when the winner spunked on the loser *cough* so yeah. ¬_¬
If I was to go over everything I've made since I started making stuff I could pull out a stack of games without hitboxes, it's been a lot of years after all.
These days it depends on the situation, what I'm making it for & a lot of other things... Plus I had more than enough years to realize hitboxing is the better solution in the majority of cases.
Pixel based collisions also a fair bit of overhead in comparison to boxes, around 20~% which can result in a large performance hit if there's a lot of things going on using it. Having
objects checking each pixel every game tick is inefficient as fuck, and if running at 60fps it hits hard (you only have 16ms for the machine to do everything including draw the frame). Even box collisions can cause slowdown if there's enough of it needing to be checked at a given time, the SNES especially was bad for it due to the slowass CPU.
You'll be hard pushed to find a game made since the 80's that only uses pixel based collisions rather than a series of hitboxes, and they'd be shooters or old platformers with the weird ' both feet always on the floor, arms stuck in one position' walk animations.
Hmm, easier to explain if I do it via images.
Say for example you're making a platformer, pixel collisions are your enemy. Why? Because of shit like this:
Imagine what happens to things that have blank space under an animation frame. To combat the various problems it causes you'd use a series of boxes, each for a specific purpose.
I'll pick on Megaman again because I can. (note - this isn't how the hitboxing in MM games work cos Capcom suck at hitboxing platformers)
You'd then run though them all each frame:
1. Bottom overlapping a solid tile or platform? Push them up until it doesn't overlap.
2. Top overlapping a solid tile? Stop any jump loops and push them down until it no long overlaps.
(Capcom don't actually check overhead correctly, so you can get inside tiles & abuse the left/right detection to launch yourself across the screen amongst the many other glitches their engines have)
3a. If it facing left? If it is then check for a collision & pushout.
3b. If it facing right? If it is then check for a collision & pushout.
4. Is the big box overlapping something that hurts?
TAADAAA, you've got working collision detection.
It's a lot faster to check multiple boxes like that than having to check for a pixel collision & work out which direction it's coming from & how things should react to it. It's important to check them all because it stops players being able to get out of bounds or stuck in tiles.
Anyways, that's pretty much why we use a series of hitboxes. Platformers need them to stop animations making everything go spazzy. Fighters use them to designate areas that can be hit & areas that are hitting (they're probably the worst offender for box spamming), shmups rely on hitboxing these days so you can dodge bullet spam.
I'm going to assume you're looking more for box2d sorta info though because ChibiBash etc. Hitboxes and more hitboxes lol. That's pretty much what it is. Boxes, various joints and more boxes. Clue's in the name. ;)
Well, boxes is a bit of a loose term since it can be any non-convex shape (physics engines hate convex shapes, and the majority refuse to work with them full stop), and the more complex it is then the slower it'll make everything.
So long as you match up the boxes to the art it'll give the illusion of being pixel perfect. That's why physics based games typically have primitives as a base for everything.
If you're after specifics on other game stuff then let me know, and I can give a brief run down on it.