SpaceDim is a school project based on the real game SpaceTeam.
A server push event to the app using websocket. Each event represent a state of the game. A game of SpaceDim is composed by multiple event :
WAITING_FOR_PLAYER, users are in a waiting room until there are unless 2 ready users.GAME_STARTED, beginning of the game with UI elements list to generate (buttons, switch, shake).NEXT_ACTIONrepresent the action that the user must accomplished until the end of countdown clicking the correct UI element.NEXT_LEVELa new UI elements to generateGAME_OVERend of the game (win or loose) with score and reached level
3 activities
HomeActivity: the home page with sign in and sign upGameActivitysplitted into 3 fragmentsWaitingRoomFragmentthe waiting room with user list and button to be readyPlayFragmentwhere UI elements are generatedFinishFragmentwith score and level reached at the end of game
ScoreActivity: top 5 users
Websocket connexion is handled in WebSocketManager.
GameActivity uses a ViewModel which hold the LiveData (event)
- OkHttp for websocket and HTTP requests
- Moshi as content negociator
- Sensey lib for ShakeListener
- Timber for easy logging