Skip to content

Commit eb7d221

Browse files
author
XenGi
committed
wow. many docs. much explanation.
1 parent 26e06d9 commit eb7d221

File tree

1 file changed

+33
-12
lines changed

1 file changed

+33
-12
lines changed

README.md

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,49 @@
11
# pymlgame
22

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.
54

65
You need 3 parts to actually have a running game on Mate Light.
76

87
## The game
98

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.
1311

1412
## A controller
1513

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.
2042

2143
## Mate Light
2244

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.
2647

2748
---
2849

0 commit comments

Comments
 (0)