Not logged inOpenClonk Forum
Up Topic Development / Developer's Corner / PlayerControls
- - By Newton [es] Date 2009-06-11 15:19 Edited 2009-06-11 15:49
Sven2 (almost) finished the freely configurable controls! Let me say: Awesome!

I am reading your German docs and got some questions:


  1. Why is it possible to redefine the controls in each System.c4g? How does one choose his favourite control then?

  2. How are joystick commandos (e.g. from these things on the PS2 controller) handled? (Suggestion: the parameters x and y stand for the strength and direction of the movement of the joystick, not for an absolute position like with the mouse. But then, this need to be handled differently than the mouse, resulting imo in the need of being able to ask if this command came from a joystick or a mouse)

  3. As best preactice, what do you suggest: Should the handling of vehicle control, object control and structure control move to the global PlayerControl function or to the (base script of a) clonk? What about more specific stuff like Control to horse, control to ladder etc?

  4. The shovel example: Why do you prefer that handling to something like PlayerControl calls ControlEquipped in the Clonk and the Clonk looks if he has a shovel, then digs

  5. Assignment: One assigmnent might be Key=W. But whats with keys like Page up, Mouse button one, Scroll wheel (1,2), Joystick left etc?

  6. How is the keyboard layout handled? I have a German keyboard and play Clonk in English on a Spanish system. Sometimes even with a DVORAK-DE.

  7. Are modifiers like Shift+W, Alt+W or Control+W handled? How?

Parent - By Sven2 [us] Date 2009-06-11 16:00
1. The keys defined in the control files are meant to be default control sets. In the future, the player should pick a default control set (Keyboard, Gamepad, etc.) and then customize it.

2. Joystick commands are routed via the same Keyboard interface. Iirc, they have names like Joy*Button* and Joy*Axis*. I do not know whether this works at the moment. I planned to pass partial axis movements to the strength parameter. But the current axis position could be passed in x/y for convenience.

3. For generic vehicle functions (move/interact/stop interact?) it might make sense to have the global PlayerControl function be a forward to the current cursor only. However, then every object that wants to be controllable (say, e.g., a monster) would need to include the Clonk or copy that script. So maybe it would be better to have that in a global function as well (say, global func PlayerControl calls global func ObjectControl). Object-specific functions should go directly to the object, imo, because the Clonk cannot know anything about the nature of the control being passed. If we use Timi's control design, object specific functions would be shortcuts only anyway. Those would be enabled/disabled by the vehicle as the Clonk grabs/ungrabs it.

4. The example wasn't meant to reflect the final design. I don't really care whether digging scripts are put into the shovel or into the Clonk. Anyway, I don't get your question.

5. There's a large list of keys in the engine. I haven't documented them yet. In addition, I planned to add mouse controls: Mouse*Move, Mouse*Button*, Mouse*WheelUp/Down for GUI coordinates; and if that isn't handled MouseLandscape*Move, MouseLandscape*Button*, MouseLandscape*WheelUp/Down. Naturally, anything bound to the Mouse*Move-command (e.g., the cannon aim may want to follow mouse movement) should be enabled on demand only, as it would generate a lot of control traffic.
It is also possible to do use a different control name as a key. For example, you could set the key for Drop to "Down,Throw". This would look up the keys assigned to the down and to the throw control and use them for the Drop control. That way, if the user reconfigures the throw control, he will automatically reconfigure drop as well.

6. I wanted to allow the definition of additional keysets in language packs. I guess we could also have an automatic detection based on the selected keyboard layout.

7. You can define a key such as "Shift+W".
Parent - - By Zapper [de] Date 2009-06-11 18:22 Edited 2009-06-11 18:27
Cool
PS: What when a scenario wants to overload the control? Like Hazard could put "Duck"/"Aim" on CTRL. Is that possible? And how would that be supposed to work for more than one player per keyboard? ("Duck=CTRL" "DuckPlr2=.."?)
Parent - By Sven2 [us] Date 2009-06-11 18:51
A scenario cannot override user preferences for existing controls (that would be weird, because the user could no longer remap the key). But it could simply define a new control with another default key. Multiple keyboard sets should not be a problem (Keyboard1, Keyboard2).
Up Topic Development / Developer's Corner / PlayerControls

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill