|
1 | 1 | # pymlgame
|
2 | 2 |
|
3 |
| -pymlgame is an abstraction layer to easily build games for Mate Light inspired |
4 |
| -by pygame. |
| 3 | +pymlgame is an abstraction layer to easily build games for Mate Light inspired by pygame. |
5 | 4 |
|
6 | 5 | You need 3 parts to actually have a running game on Mate Light.
|
7 | 6 |
|
8 | 7 | ## The game
|
9 | 8 |
|
10 |
| -You can build a game using the pymlgame library. If you know the pygame |
11 |
| -library this should meen nothing new to you. Use the game_example.py to find |
12 |
| -out how to to so. |
| 9 | +You can build a game using the pymlgame library. If you know the pygame library this should mean nothing new to you. |
| 10 | +Use the game_example.py to find out how to do it. |
13 | 11 |
|
14 | 12 | ## A controller
|
15 | 13 |
|
16 |
| -If you want players, your game needs a controller to have some inputs. You |
17 |
| -can use anything as a controller that can trigger the JSONRPC calls in your |
18 |
| -game. As an example you can use the controller_example.py and adapt it to |
19 |
| -your controller. |
| 14 | +If you want players, your game needs a controller to have some inputs. You can use anything as a controller that can |
| 15 | +speak the pymlgame controller protocol. As an example you can use the controller_example.py and adapt it to your |
| 16 | +controller. |
| 17 | + |
| 18 | +Here are the commands a controller can send to a pymlgame: |
| 19 | + |
| 20 | + - /cotroller/new |
| 21 | + Tell pymlgame that you want to play also known as "anpymln". It will send you a UID which should be used in |
| 22 | + future communication. |
| 23 | + - /controller/<int:uid>/ping |
| 24 | + Just tell pymlgame that you're still their. Also this updates your IP address so use this after a reconnect. |
| 25 | + - /controller/<int:uid>/kthxbye |
| 26 | + Be so nice and tell pymlgame that you are closing the controller on your device. That helps to avoid alot of |
| 27 | + garbage to go through. |
| 28 | + - /controller/<int:uid>/states/00000000000000 |
| 29 | + Send the states of the 14 possible buttons. These are Up, Down, Left, Right, A, B, X, Y, Start, Select, L1, L2, |
| 30 | + R1, R2 |
| 31 | + - /controller/<int:uid>/text/<str:text> |
| 32 | + Send a message to pymlgame. this can be used to enter player names. |
| 33 | + |
| 34 | +These are the commands that a controller could receive: |
| 35 | + |
| 36 | + - /uid/<int:uid> |
| 37 | + Use this UID in future communication. |
| 38 | + - /rumble/<int:duration> |
| 39 | + The game wants your controller to rumble for n seconds. |
| 40 | + - /message/<str:text> |
| 41 | + The game wants your controller to display some text. |
20 | 42 |
|
21 | 43 | ## Mate Light
|
22 | 44 |
|
23 |
| -Last but not least you need Mate Light as your display. If you are not at |
24 |
| -c-base space station but still want to tinker around with this you can use |
25 |
| -the emulator.py to do so. |
| 45 | +Last but not least you need Mate Light as your display. If you are not at c-base space station but still want to |
| 46 | +tinker around with this you can use the emulator.py to do so. |
26 | 47 |
|
27 | 48 | ---
|
28 | 49 |
|
|
0 commit comments