The "Ruby(game) or Python (pygame) devs?" thread inspired me to actually try making a game for once. I'm an okay programmer and a terrible artist, but we'll see.
yp is going to be platformer where you slice the enemies in your path with a cool sword, or something equally great. But for now you are just a Mario sprite in space.I'm making this in Ruby using
the gosu library. I'm developing on OS X and I have no idea about Windows compatibility yet (and I'm not even sure if I have a Windows install anywhere right now), but I'm pretty sure all the libraries I'm using are
supposed to be cross-platform.
I'm imagining I won't get many playtesters for anything that doesn't run on Windows, if not a browser.
I have a bunch of sketches of various levels and things, but first I'm interested in getting some good controls. In anticipation of some of the mechanics I'd like to use later, I'm mapping keyboard presses to forces applied to the player in a
Chipmunk physics sim.
I associate physics simulations with really floaty/disconnected controls, but since I'd like something pretty fast-paced, I've spent a lot of time trying to make sure this game isn't like that. That's pretty much meant having a bunch of physics constants that are really high.
I didn't think that'd work, and several iterations ago I was convinced it wouldn't, but I seem to have layered enough hacks that it actually feels pretty nice (walk/run speeds, less air control in the direction opposite your initial direction, fine control of jump height, etc). And thankfully, it seems that none of the hacks so far prevent Chipmunk from letting the player interact with movable objects in a reasonable manner.
Video 1:
Video 2:
Just some notes for other people who want to try mapping controls this way:
- For running it boils down to applying massive acceleration to the player but capping horizontal velocity to their current run/walk state. I just change from "walking" to "running" after they hold a run key for long enough.
- After holding jump for ~0.4 seconds I stop applying any upward force. If they let go before then, I immediately cut their velocity by 60%; otherwise I don't alter their natural trajectory at all.
- I dampen the player's horizontal velocity whenever they're not pressing any movement controls. (Manually, by just scaling their velocity in-between physics steps.) For some reason this felt more natural and I blame video games.
- When I'm trying to land on a platform in most games, I typically overshoot, then briefly tap the opposite direction to slow my speed to zero while I'm directly above. With the ridiculously high forces I have mapped to the arrow keys, I would immediately reverse direction instead of slowing down. So now I remember which direction you were moving when you jumped and if you move the other way, I use a much weaker force.
That's it for now.