Pixel-Based walking with dwimmercrafty (etheldreme!)

Make games! Discuss those games here.

Moderators: Bob the Hamster, marionline, SDHawk

User avatar
kylekrack
Liquid Metal Slime
Posts: 1240
Joined: Mon Jun 16, 2014 8:58 am
Location: USA
Contact:

Post by kylekrack »

Alright, so I've got some NPC interaction coming along. It's far from perfect, but it's almost even usable. NPCs are technically usable, but they don't have anything to say at the moment so I didn't show that off in this gif. What I did manage to do is get NPC collisions.

Every NPC and the player have a weight value that will affect the speed of one another when they collide. If an object is heavier than you, you can't push it. If an object is half your weight, it'll slow your speed by half. If you're pushing two an object 50% your weight into an object 20% your weight, their combined weight will slow you 70%.

It's still a little jittery and chaotic, but I reigned it down significantly from what it was like before. Things don't jump around quite as much, but it still happens when a lot of collisions are happening in one spot. I'll keep working on it, but I'm going to upload this version so you can actually feel how the "physics" apply.

EDIT: link for convenience: https://www.slimesalad.com/forum/viewgame.php?p=130697
Attachments
It's a party
It's a party
pixel-walker0008.gif (2.42 MiB) Viewed 1338 times
Last edited by kylekrack on Sun Dec 17, 2017 5:56 am, edited 1 time in total.
My pronouns are they/them
Ps. I love my wife
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

This is really cool! I'm impressed you can even push multiple npcs at once.

Later on when I have more time, I'll play around with the scripts and try to fix the jittering, if it's still a problem then. This is definitely getting into physics simulation territory now, which is my idea of fun. I was surprised that "move object" is called recursively to handle the pushing. That could be part of the problem.

I'm concerned that "push apart" could get stuck in an infinite loop if walls prevent two objects from moving away from each other, though it would probably be hard to set up the right conditions for that. In complicated collision checking systems, it's generally impossible to ensure that nothing ever overlaps. The fix is to add a safety check to exit the while loop after too many iterations (say, 40).

I hate to think about what's needed to support collision detection on wrapping maps. It's going to be tricky to make all the script commands work in that case. And after that, the scripts will need a lot of changes too; that's probably the worse part.
User avatar
SwordPlay
Chemical Slime
Posts: 966
Joined: Sun Jan 22, 2017 9:32 am
Location: London, England
Contact:

Post by SwordPlay »

Really impressive! Much better than my efforts ;_;
Hitboxes are neat-o and its feels very solid and tight (and it's animated really smoothly too).
I can see this being used for action games, such as side-scrollers and it would be really awesome for low-resolution games


Momentum doesn't have to be a 'simulation', more like a 'simulacrum'
(see attached image which I found on the internet. It's an interesting concept and there's a lot of ways one could approach it. wish I knew more about it. It's really interesting to study, amongst other things)
Attachments
1513473844078.png
1513473844078.png (94.93 KiB) Viewed 1315 times
Last edited by SwordPlay on Mon Dec 18, 2017 1:44 am, edited 4 times in total.
"Imagination. Life is your creation."
Post Reply