WinterLicht / Chaos-Projectile

Run ‘n’ Gun meets RPG
60 stars 17 forks source link

Controller config #11

Closed bitcraft closed 7 years ago

bitcraft commented 8 years ago

Great work! Just wanted to report that on windows, Chaos Projectile runs great, but the controls on an xbox one controller are...not optimal. Just reporting that joystick controllers should have some sort of configuration. Looking forward to seeing the game progress. I like the Price of Persia styled levels and nice sprites.

Funatiker commented 8 years ago

@bitcraft That's true. The current controller config is hard-coded for a PSX-controller with ID 0. If the controller has a different ID or a pseudo-controller happens to get ID 0 (e.g. a wacom tablet), then the game will be unusable. See #10

Thanks for the Prince of Persia comparison. We get that more often than expected.

Since you are the mastermind behind pyscroll: We are currently recommending older versions of pyscroll since we have some trouble with animation.py. See https://github.com/WinterLicht/Chaos-Projectile/issues/5#issuecomment-192286147 Any idea how to make the game compatible with both the older and the newer versions of pyscroll?

bitcraft commented 8 years ago

Sorry that I broke it! There are only a few people here and there that give me feedback about pyscroll, so sometimes I will implement breaking changes and not realize it. I'll comment about that in #5.

WinterLicht commented 8 years ago

Hi, New pyscroll+PyTMX works with the game!

@bitcraft Thank you for kind words! PyTMX and pyscroll libs are great. Are easy to use & contain easy to understand tutorial. They have good performance. Tested quest.py (the example-file of pyscroll) on Raspberry Pi (~1 year ago). It ran smooth. Even with a large/complex map. I'm glad that there is a support for animated tiles now. One thing I couldn't understand: how to render sprites/images underneath all the tiled-layers. The question came up, because of an idea to add a parallax layer for ChaosProjectile.

About the controller issue: Yes. XBox-controller might not work properly. A Sony-controller should work as expected. It is because game pad axis are indexed different for both.

More precisely: I have in controller.py (line 69 - 70), where "self.joystick" is the pygame Joystick, following:

horiz_axis_pos = self.joystick.get_axis(3)
vert_axis_pos = self.joystick.get_axis(2)

For a XBox-controller the "2" should be replaced with "4". I don't know how to recognize which controller is connected. Testing if the name (of "joystick.get_name()") contains "Sony" or "XBox"? But there are also game pads of other manufacturers.

bitcraft commented 8 years ago

It would be nice if there was a general-purpose library to detect and reconfigure joysticks for pygame. I can reconfigure manually and play for now.

As for rendering. Thank you for reporting testing on the rpi. I haven't gotten around to it, and its great to hear that it works. I have been doing some changes so that I can test on the rpi and hopefully get 60 fps. Pyscroll is capable of rendering arbitrarily sized maps, limited only by screen resolution and memory.

So far, I've not made a parallax layers API for pyscroll because I'm waiting for it to be implemented into Tiled. If you want to experiment, here's a general outline to do it:

FYI, using the alpha is about 35% slower and doesn't work with the zoomed camera.

MCMic commented 8 years ago

Same problem here, using a Logitech F710, aiming is really weird, in Xinput mode I have to use right stick and shoulder button and it seems I can’t fire, in DirectInput mode I can aim with right stick but everything is rotated, like right is up or something like that, and I can fire with shoulder button (why not button 0 by default?)

Also, why is jumping mapped on up, is that a gameplay decision? feels really weird and hard to control, I would have mapped jump to a button like in other run n gun’s I know of.

WinterLicht commented 7 years ago

Controller issue is fixed now by custom input-settings screen. Use default controls or configure them as you like.

@bitcraft Thanks for information! Now the game has a parallax starry sky.

@MCMic yes, it was a gameplay decision to map jump on axis-up. Like: one axis for movement and the other for aiming. Now you can assign jump to a game pad button. The strange behavior or switched axis depend on game pad driver. Experienced the same as I tested Windows vs. Linux and a Sony gamepad vs. Xbox controller. Pygame may index same axis differently.