Commit Graph

298 Commits

Author SHA1 Message Date
David Négrier
ee612f6585 Adding event support to items 2020-07-27 22:36:58 +02:00
David Négrier
d48d5b0285 Fix CS 2020-07-23 18:47:28 +02:00
David Négrier
2484e4f1df Moving maps to their own container 2020-07-23 18:43:51 +02:00
David Négrier
ed146226cf Adding Outline capabilities and a ActionableItem notion. 2020-07-23 18:09:24 +02:00
David Négrier
82c57810a2 Removing host label from Prometheus because it is redundant 2020-06-29 23:01:52 +02:00
David Négrier
6412c56fcd Adding finally clause to make sure Prometheus indicators are ok 2020-06-29 22:56:41 +02:00
David Négrier
31846d1640 Using a Set for groups 2020-06-29 22:21:11 +02:00
David Négrier
4fee1ac206 Refactoring World and Group to use Map and Set instead of arrays 2020-06-29 22:10:23 +02:00
David Négrier
981fa84aa7 Mitigating problem when there is a synchronization issue between World and sockets list. 2020-06-29 19:16:15 +02:00
David Négrier
9bdcc9da98 Deleting world when empty. 2020-06-29 19:14:54 +02:00
David Négrier
d736673169 Adding an entry point in first floor 2020-06-17 16:35:47 +02:00
David Négrier
e1954c7ff9 Removing overlapping tiles between start and exit 2020-06-17 16:31:42 +02:00
David Négrier
928e486de5 Fixing token management 2020-06-10 12:32:39 +02:00
David Négrier
a373626e24 Removing all "any" from back.
To do this, I used generic-type-guard package which generates both an interface AND a valid type guard from code.
With this, we are 100% sure that the messages we receive are validated at runtime!
The client cannot pass us an object that is invalid! \o/
2020-06-09 23:07:19 +02:00
David Négrier
ac0b7a7361 Turning let into const where applicable 2020-06-09 15:54:54 +02:00
David Négrier
68dfed5fba Fixing Prometheus indicator 2020-06-09 13:53:33 +02:00
David Négrier
af6924a27c Adding Prometheus metrics
This commit adds a '/metrics' endpoint in the API that can be exploited by Prometheus.

This endpoint returns:

- the number of connected sockets
- the number of users per room
- common NodeJS and system metrics

WARNING: this endpoint is public right now and should be protected
2020-06-09 11:49:23 +02:00
David Négrier
69cfac290d Improving logs (adding date) 2020-06-09 09:30:12 +02:00
David Négrier
db3ef81842 Adding the ability to add several entry points
We can now have several start layers and choose an entry point using a # in the URL
2020-06-07 13:23:32 +02:00
David Négrier
96c5d92c46 Fixing disconnection taking ~15 seconds
Most of the time, sending a disconnect event to one of the players is enough (the player will close the connection
which will be shut for the other player).
However! In the rare case where the WebRTC connection is not yet established, if we close the connection on one of the player,
the other player will try connecting until a timeout happens (during this time, the circle with the name is displayed for nothing).

So now, we send disconnection event to every body (not only the people in the group, but also to the person leaving the group)
2020-06-05 13:07:18 +02:00
David Négrier
66ec11176b Tracking nb users connected and server load
When a user connects or disconnects on the server, we log this (along the current server load).
This is only temporary, in order to assess the number of users a server can safely handle before crashing.
2020-05-28 22:00:56 +02:00
NIP
5066e5ad4c Fix issue on start point 2020-05-28 12:19:46 +02:00
NIP
c90994574a Add a coders exit to https://npeguin.github.io/coders-map/map.json 2020-05-28 11:56:47 +02:00
David Négrier
cd586a9e0c Renaming /maps to /start-map
Closes #90
2020-05-24 22:53:10 +02:00
David Négrier
2448fef53a Adding a notion of instances per mapAdding a notion of instances to room
The URL signature becomes:

https://workadventu.re/_/[instance]/[path_to_map.json]

This allows us to create many instances of the same map (and therefore to create several different worlds for different people)

An exit on a map can target another "instance" by passing the "exitInstance" property.
2020-05-23 17:45:49 +02:00
Gregoire Parant
0c9cbca765 Use userId generated by back end in all message 2020-05-23 15:04:25 +02:00
Gregoire Parant
ab32021fc0 Fix mediam stream manage and server back down 2020-05-23 14:00:36 +02:00
David Négrier
ab798b1c09 Changing the "Point" notion to add a notion of "moving" in addition to the notion of direction.
Also, refactoring JOIN_ROOM event to add complete position.
2020-05-22 23:04:45 +02:00
David Négrier
fb8d7b5d59 Removing dead code 2020-05-19 19:53:26 +02:00
David Négrier
125a4d11af Refactored and optimized messages
Now, when a user moves, only his/her position is sent back to the other users. The position of all users is not sent each time.

The messages sent to the browser are now:

- the list of all users as a return to the join_room event (you can send responses to events in socket.io)
- a "join_room" event sent when a new user joins the room
- a "user_moved" event when a user moved
- a "user_left" event when a user left the room

The GameScene tracks all these events and reacts accordingly.

Also, I made a number of refactoring in the classes and removed the GameSceneInterface that was useless (it was implemented by the LogincScene for no reason at all)
2020-05-19 19:11:12 +02:00
David Négrier
e934015d87 Refactoring searchClientById
searchClientById was scanning through all open sockets to find the right one (which is inefficient if we have many).
Instead, I created a new Map that directly maps ids to sockets.
Furthermore, this solves a long-standing issue (when a socket is disconnected, we cannot find it anymore in the sockets list but it is still available in the disconnect callback from the map)
As a result, we should not have any remaining circles any more.
2020-05-18 18:33:04 +02:00
David Négrier
1bbd0866cb Code cleaning 2020-05-16 16:07:57 +02:00
David Négrier
87707bc814 Removing broken import 2020-05-16 15:51:00 +02:00
David Négrier
b20357c1ee Removing the Message class and merging it with MessageUserPosition (since it is only ever used it in MessageUserPosition)
Taking advantage of the TypeScript Constructor Assignment too to reduce the amount of code!
2020-05-16 15:44:45 +02:00
David Négrier
3b6ace03fa Getting rid of roomId in Message class (this is not needed since all messages sent are for the room we are currently in) 2020-05-16 00:19:27 +02:00
David Négrier
4d1c3517ec When sharing user position, only position is sent now! 2020-05-15 23:47:00 +02:00
David Négrier
cdfa9acf01 JoinRoom now ONLY sends the roomId. 2020-05-15 23:24:04 +02:00
David Négrier
b80e3e07d8 Sending player details (name + character selected) on connection 2020-05-15 22:49:50 +02:00
David Négrier
fff0e13a2e More code removal 2020-05-15 22:09:21 +02:00
David Négrier
4e745f20f7 More code removal 2020-05-15 22:08:53 +02:00
David Négrier
5a3668a12e Refactoring messages
Socket.io can stringify JSON messages itself, so there is no need to pass a string to "emit". You can pass a serializable object!

This commit removes all the useless toJson() methods, JSON.serialize and JSON.parse!

Woot!
2020-05-15 22:04:49 +02:00
David Négrier
4de552437d Completely getting rid of "userid"
Previously, userid was generated by the "/login" route and passed along.
This commit completely removes the uuid "userid" (and disables the LoginController too and any Jwt check).

"userid" is replaced by the "socket id" of the connection.
So a user is now identified using a socket id, which is unique for a given connection.
2020-05-14 23:20:43 +02:00
David Négrier
76b43245c5
Merge pull request #113 from thecodingmachine/display_circle_on_startup
Displaying circle on join
2020-05-14 22:02:41 +02:00
gparant
b467adece9 Minor update floor0 and floor1 2020-05-14 21:00:52 +02:00
gparant
787e1c463c Media webrtcA
- Update peerConnexion manage
 - Add muted microphone logo
 - Add icon user
 - Sound when user enter in room webrtc
2020-05-14 20:39:30 +02:00
David Négrier
4cca1c1e58 Displaying circle on join
So far, someone joining a map would not see the circles of groups already formed until someone moves in the group (because the "circle_moved_or_updated" event was not fired when someone arrives)

This commit fixes this behaviour. Someone entering a room will receive an event for each and every group currently formed.
2020-05-13 23:11:10 +02:00
gparant
517d3981d1 Minor changes map floor 0 2020-05-13 22:36:34 +02:00
David Négrier
2e34b76a77
Merge pull request #111 from thecodingmachine/new-floor0
New map floor0
2020-05-13 22:28:17 +02:00
David Négrier
11972555ee More detailed error log to debug disconnect issue 2020-05-13 22:11:05 +02:00
gparant
b4e720b00a New map floor0 2020-05-13 22:09:02 +02:00
gparant
ec297e3912 Auto-reconnect 2020-05-13 20:22:42 +02:00
David Négrier
23a12ea652
Merge pull request #99 from thecodingmachine/map_history
Adding support for history API
2020-05-13 11:03:49 +02:00
David Négrier
59ee78275e Removing limitation to allow up to 4 players in a group 2020-05-13 09:39:48 +02:00
David Négrier
faadacddb6 Redirecting to the correct map after login screen based on URL provided 2020-05-13 00:06:58 +02:00
David Négrier
256fa51e24 Catching errors in socket callbacks
Catching errors in socket callbacks to avoid having the server crashing when an error occurs.
2020-05-12 11:49:55 +02:00
gparant
b50f28176e Minor update layer position in map floor0 and floor1 2020-05-12 02:01:18 +02:00
David Négrier
872fa8c750 Fixing exit points 2020-05-12 00:38:24 +02:00
David Négrier
cf49f7de00 Merge branch 'master' of github.com:thecodingmachine/workadventure into map-v1
# Conflicts:
#	back/src/Assets/Maps/Floor0/floor0.json
2020-05-12 00:24:05 +02:00
NIP
98e73582c8 Add KEN office to the map 2020-05-11 23:42:10 +02:00
David Négrier
0daddb3669
Merge pull request #93 from thecodingmachine/fix-recette-grp
Fix recette GRP
2020-05-11 22:59:22 +02:00
gparant
7ccd84d941 Fix depth error in the first floor 2020-05-11 21:16:14 +02:00
gparant
bd2ffde4c4 Fix CI lint 2020-05-11 20:55:17 +02:00
gparant
c41e88370d Fix position layer in map lyon 2020-05-11 20:53:23 +02:00
David Négrier
98628957a4 Refactoring "exit" to allow multiple maps
Adding several layers named "exit" causes issues with Phaser 3.
This PR makes any possible layer being an exit layer (it only depends on the exitUrl property)

Also, fixing start position (it takes into account the layer width now)
2020-05-11 18:49:20 +02:00
William
e9d3a7d169 use start and exit layers on map 2020-05-11 14:00:15 +02:00
gparant
099961b818 Delete params not used 2020-05-11 13:19:48 +02:00
gparant
e35c188854 Fix update world back end and deleting group in front end 2020-05-11 13:17:02 +02:00
gparant
45370e6391 Fix exit tile map of floot1 2020-05-11 00:32:37 +02:00
gparant
f4af824cf9 Fix error mapping refresh in back & the end of this feature development 2020-05-10 23:49:08 +02:00
gparant
8b9c36e3be Refactor leave and join room 2020-05-10 19:54:41 +02:00
gparant
8a91190d8c Change to update world by scene and room id 2020-05-10 19:45:17 +02:00
gparant
58b65030bd Fix feedback @moufmouf strategy of maps managing by back. 2020-05-10 18:34:55 +02:00
gparant
69777ad1cb Remove middleware to secure access API. 2020-05-10 17:31:27 +02:00
grégoire parant
bdea7e49d1
Update back/src/Controller/MapController.ts
Co-authored-by: David Négrier <d.negrier@thecodingmachine.com>
2020-05-10 14:48:58 +02:00
grégoire parant
929bb37728
Update back/src/Controller/MapController.ts
Co-authored-by: David Négrier <d.negrier@thecodingmachine.com>
2020-05-10 14:48:34 +02:00
gparant
5f11b065e1 Permit to dissociate data by room
- Update share room id.
 - Join room when a scene is loaded.
 - Add a room in constant variable.
2020-05-10 13:58:32 +02:00
gparant
27c6034661 Manage multi scene
- Create position and check if user is in position to switch in the next scene.
 - When scene is load, we load all scene in the layer of name "exit".
 - Layer "exit" of map.json have a parametter "exitSceneKey" to identify next scene.
 - Add layer "start", the player could start in the scene on the object present in the layer of name "start".
2020-05-09 21:28:50 +02:00
gparant
fb8d9bf9a8 Multi Scene in back end
- Change maps url to get maps
 - Change GameScene to create scene with file since back end
 - Change LoginScene to upload scene and start game
2020-05-09 19:41:21 +02:00
gparant
7f989cfd23 Add maps in back
- Add all map json in back
 - Create middleware to check authentification user
 - Create controllers to get map
 - Create access to get all files in folder Assets/Maps
2020-05-09 17:50:47 +02:00
gparant
6dc309db34 Fix manage webrtc room id 2020-05-08 21:17:52 +02:00
David Négrier
c59d693f6e
Merge pull request #83 from thecodingmachine/cleanup_rename_frame
Cleanup: renaming "frame" to "character"
2020-05-08 16:21:16 +02:00
David Négrier
e4824fe34d
Merge pull request #81 from thecodingmachine/display_groups
Adding the display of a circle around the group
2020-05-08 16:20:56 +02:00
David Négrier
492196b333 Cleanup: renaming "frame" to "character"
The "frame" variable actually contains a string pointing to the character selected.
It has nothing to do with a frame which is usually a particular image in an animation.

I'm renaming the variable accross the application to avoid confusion.
2020-05-08 15:18:22 +02:00
gparant
802d710006 Fix lint tsc 2020-05-08 11:58:09 +02:00
gparant
41f5b5a1f6 Fix shares information to enter into Webrtc room.
- Refactor share position in world class.
- Update selects a client to send information about connecting WebRtc room.
2020-05-08 11:54:47 +02:00
gparant
16cf33755c Fix webrtc back
- Add refuse to join if webrtc room have 4 players.
2020-05-08 11:16:49 +02:00
David Négrier
02e6b50b16 Adding the display of a circle around the group
This PR adds the display of a circle around groups. This is useful to view where you need to go to speak to someone but also to debug.

Note: implementation is suboptimal, relying on a "graphics" object that is known to be slow. In the future, we need to use a circle as a sprite instead.
2020-05-08 00:35:36 +02:00
gparant
5a6415607d Send event and play animation with user frame 2020-05-06 01:50:01 +02:00
gparant
b65e37c468 Name of map users
- Add name on user
 - Delete NonPlayer class not used
2020-05-03 22:24:14 +02:00
David Négrier
9c32c930a0 Merge 2020-05-03 17:47:54 +02:00
David Négrier
bf723b2e30 Reducing connection distance and group radius 2020-05-03 17:46:26 +02:00
David Négrier
3b27f8b000 Making the group radius distinct from the minimum distance to connect 2 players
Also, changed default settings from 160px for Group Radius to 120px
(minimum distance to connect 2 players remains 160px)
2020-05-03 16:57:17 +02:00
gparant
c48073b908 Fix update callback 2020-05-03 16:30:22 +02:00
gparant
372f938bbb Connect and Disconnect event. 2020-05-03 16:28:18 +02:00
gparant
8357f9b8c2 Merge branch 'event_group' into webrtc
# Conflicts:
#	back/src/Model/Group.ts
#	back/src/Model/World.ts
2020-05-03 16:18:05 +02:00
David Négrier
58565a7f45 Refactoring events to connect/disconnect a user to a group 2020-05-03 16:08:04 +02:00
gparant
bae03fb1cf Fix CI 2020-05-02 23:48:33 +02:00
gparant
fdb40ec3e2 Fix webrtc multi 2020-05-02 20:46:02 +02:00
gparant
aff77fe074 Merge remote-tracking branch 'github.com/master' into webrtc
# Conflicts:
#	back/src/Model/Group.ts
#	back/src/Model/World.ts
2020-05-02 00:36:04 +02:00
gparant
c7f8f92e85 Fix webrtc 2020-05-02 00:31:44 +02:00
gparant
e06b20fe96 Update video style and start peer connexion 2020-05-01 21:15:00 +02:00
David Négrier
c778afcbca Adding support for leaving the group if the socket is closed 2020-04-29 23:18:42 +02:00
David Négrier
bf0fa516d4 First working version with disconnection 2020-04-29 23:12:55 +02:00
David Négrier
2a8e3ea323 Switching connection to a barycenter approach 2020-04-29 22:41:48 +02:00
David Négrier
5ffc5a420e Merge branch 'feature/back-players-proximity' into barycenter_based_groups 2020-04-29 22:06:37 +02:00
gparant
2bfa57b0ba Merge world and webrtc conexion 2020-04-29 01:40:32 +02:00
gparant
3151113db3 Merge branch 'master' into webrtc
# Conflicts:
#	back/src/Model/Websocket/MessageUserPosition.ts
2020-04-29 00:05:16 +02:00
David Négrier
abeac558fd Adding TODO comment 2020-04-28 23:23:50 +02:00
David Négrier
9d2f96b348 Manually fixing a weird lint bug in eslint 2020-04-28 22:40:54 +02:00
David Négrier
7dc3d9d836 Merge 2020-04-28 22:31:54 +02:00
gparant
881bb04eb0 Implement Distance Merge Request 2020-04-27 00:44:25 +02:00
gparant
c907048c12 Merge branch 'feature/back-players-proximity' into webrtc 2020-04-26 23:34:35 +02:00
gparant
9730df2295 Merge branch 'master' into feature/back-players-proximity
# Conflicts:
#	back/src/Model/Websocket/MessageUserPosition.ts
2020-04-26 23:31:40 +02:00
gparant
d396ad2f41 Fix CI CD 2020-04-26 22:35:16 +02:00
gparant
d7d7be9ed0 Web visio, add and remove video element 2020-04-26 19:12:01 +02:00
gparant
89db8558f6 Add multi SimplePear connection 2020-04-25 17:14:05 +02:00
gparant
c28108f6c9 Use WebRtc with SimplePeer 2020-04-25 16:05:33 +02:00
gparant
a5b5072de1 Fix webrtc 2020-04-20 01:10:47 +02:00
gparant
5b62ac39fb Create webrtc connexion between two player 2020-04-19 19:32:38 +02:00
gparant
d257b2b944 Multi players on the map
- Fix share user position
 - Fix initialise map
 - Create function to add user on the map with back end data
2020-04-10 12:54:05 +02:00
David MAECHLER
4bc23ede90 unit test on connect is working, lets start the worst .... 2020-04-09 23:26:19 +02:00
David MAECHLER
e3b0f99f04 blocked on some logic...WIP commit 2020-04-08 20:40:44 +02:00
gparant
77780bd27b Change comment with new message strategy 2020-04-07 21:03:33 +02:00
gparant
67c3eaa7f4 Fix Message send to add direction 2020-04-07 21:02:23 +02:00
David MAECHLER
fbfc208129 BIG WIP of refactoring my work in TS 2020-04-07 10:08:04 +02:00
David MAECHLER
af5d2a5a97 Merge branch 'master' of https://github.com/thecodingmachine/workadventure into feature/back-players-proximity 2020-04-06 23:02:01 +02:00
David MAECHLER
60c0188e9e Merge branch 'master' of https://github.com/thecodingmachine/workadventure into feature/back-players-proximity 2020-04-06 17:35:58 +02:00
kharhamel
ded19549c7 added jasmine in the back 2020-04-06 15:48:19 +02:00
David MAECHLER
3bcb12b3ef add stub method for recheck on group members proximity 2020-04-06 02:00:21 +02:00
David MAECHLER
886477cddf fix stupid error in for loop 2020-04-06 01:45:51 +02:00
David MAECHLER
21d7fb733a Fix logic in group creation since i only checked the distance between the two first users and not rechecked the distance between a new memember with the ones already present in the group. Also sort the array of distances to group the ones closer first. 2020-04-06 01:27:20 +02:00
David MAECHLER
bb2315e7ac Merge branch 'master' of https://github.com/thecodingmachine/workadventure into feature/back-players-proximity 2020-04-06 00:47:20 +02:00
David MAECHLER
88f231bd1f fix conditions logic and make the script work. Needs to implement it in node/TS now. 2020-04-06 00:39:36 +02:00
gparant
7e08e7f133 Front : create class to connect, send and receive message
- Create environment class
 - Create Connexion class to connect and save data
 - Refactor back api
2020-04-05 20:57:14 +02:00
gparant
b4f77ba51a Refactor to create interface rooms.
The ExtRooms permit to refresh position of all users in the map and create data to share.
2020-04-05 15:51:47 +02:00
gparant
72730a0abe Refactor & Typo 2020-04-05 14:31:49 +02:00
gparant
5bfedb04fd Merge branch 'master' into Share-players-position-using-Socket.IO
# Conflicts:
#	back/src/Controller/IoSocketController.ts
2020-04-04 22:46:42 +02:00
gparant
1100edecb7 Add readme of features and communication in back 2020-04-04 22:43:07 +02:00
David Négrier
d064aca525
Fixing typo in comment 2020-04-04 22:35:20 +02:00
David MAECHLER
98be16708b fix a little error in logic of createGroups() method 2020-04-04 21:06:34 +02:00
David MAECHLER
0434e141e7 WIP : created a position.js file with all util methods, now needs to implement it in typescript 2020-04-04 21:00:59 +02:00
gparant
fbcb48f9ad Share players position using Socket.IO
- I stocked information user (id, room and position) in socket client.
 - I created function to send all information every few 10 milliseconds.

Note : when the front will be available, we must check the performance of back server.
2020-04-04 19:25:08 +02:00
gparant
f04d1342b5 Refactor error message 2020-04-04 17:56:43 +02:00
gparant
53e1600e67 Add authenticate
- Create new controller authenticate with login root..
 - Update and manage error message socket io.
 - Create enum for environment variables
2020-04-04 17:22:02 +02:00
gparant
e8da727cae Refactor and fix error hydration message socket io
- Position message send will be on format :
message :
                    userId : user identification
                    roomId: room identification
                    position: position of user in map
                        x: user x position on map
                        y: user y position on map
 - Create Point object and interface to have position x and y of user in map.
2020-04-04 16:25:03 +02:00
gparant
ba47d8b1d4 Setup web-socket connection
- Add authentification socket.io with jwt token
2020-04-04 14:05:18 +02:00
gparant
4e1115725b Add io socket message to share user position.
- Add message 'user-position' to share position in a room.
 - Change JoinRoomMessage to MessageUserPosition to have all data to share position and user information
 - Fix error alias to build
2020-04-04 12:42:02 +02:00
gparant
ba335aa33d Create backend
- NodeJs
 - Express
 - Socket.io
 - Eslint
 - TypeScript
2020-04-04 04:08:12 +02:00