Commit Graph

42 Commits

Author SHA1 Message Date
David Négrier
0492dfdf3a Fixing import 2020-05-26 17:37:26 +02:00
David Négrier
04a1f90ed5 Adding communication between LoginScene and SelectCharacterScene 2020-05-26 17:25:29 +02:00
David Négrier
1fa39b0781 Fixing typos.
Replaced connexion with connection and LogincScene with LoginScene
2020-05-24 23:14:12 +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
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
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
4d1c3517ec When sharing user position, only position is sent now! 2020-05-15 23:47:00 +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
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
59127534ac Fix User depth
- Update strategy layers depth
 - Add depth to manager layers positions between all users
2020-05-08 17:35:40 +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
b12d762ffe Fix to add frame of player user 2020-05-06 02:12:37 +02:00
gparant
4e04357b71 Merge branch 'refactoring_messages' into feature/login-page
# Conflicts:
#	front/src/Phaser/Player/Player.ts
2020-05-06 01:58:04 +02:00
gparant
5a6415607d Send event and play animation with user frame 2020-05-06 01:50:01 +02:00
David Négrier
86abdfe30b Only sending move events if the player actually moved
If the player did not move a pixel (and if it did not change direction), then do not send an event to save bandwidth and processing.
2020-05-04 23:11:59 +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
b260dc32b5 Merge from master 2020-05-03 18:04:01 +02:00
David Négrier
df5b183cba Merge 2020-05-03 15:51:16 +02:00
gparant
0d6ce5e6e9 Merge branch 'master' into webrtc
# Conflicts:
#	front/src/Phaser/Player/Player.ts
2020-05-02 20:51:49 +02:00
kharhamel
ad65de75fd used the vent system to remove the dependency of Player on Connexion 2020-05-02 16:56:36 +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
David Négrier
0c04d4305b Displaying the name of a player above its head (names are not passed through the network yet) 2020-05-01 23:38:09 +02:00
gparant
e06b20fe96 Update video style and start peer connexion 2020-05-01 21:15:00 +02:00
kharhamel
dd0744387f reenabled diagonal movement 2020-04-30 19:36:28 +02:00
kharhamel
ee4a59578a first step in simplification: remove the concept of room in the front end 2020-04-27 15:03:05 +02:00
David Négrier
46fcb86b28 Computing movement amount from framerate
Depending on the amount of power a computer has, the framerate will not be the same.
Hence, the amount of movement of a user should be constant on each frame.
If a frame was slow to print, the movement should be higher to keep a constant speed.

This PR takes the framerate into account when moving the players.
2020-04-18 17:16:39 +02:00
kharhamel
1774594e76 deleted cameraManager, use camera follow code instead 2020-04-13 19:57:14 +02:00
gparant
ba3f0e07f8 Refactor sizing hitbox charactere 2020-04-13 16:53:19 +02:00
gparant
b391ee271a Fix move & stop player 2020-04-13 15:41:11 +02:00
gparant
2afe6b4b6e Fix feadback @Kharhamel 2020-04-13 15:34:09 +02:00
gparant
01dbff7aee Merge branch 'interaction' into kharhamel-interaction
# Conflicts:
#	front/src/Phaser/Game/CameraManager.ts
#	front/src/Phaser/Game/GameScene.ts
#	front/src/Phaser/Game/MapManager.ts
#	front/src/Phaser/Player/Player.ts
2020-04-13 13:42:21 +02:00
kharhamel
05379c8001 the other playes now run away from the player on contact 2020-04-12 19:06:31 +02:00
kharhamel
97a55ab66c fixed the player animations 2020-04-12 18:28:05 +02:00
kharhamel
d1106d757d made the player pushable by other models 2020-04-12 17:13:33 +02:00
kharhamel
2b2b615e7b added other players models and fixed collision with other entities 2020-04-12 17:08:28 +02:00
kharhamel
6e27377b07 rewrote the app code to more easily allow for collisions 2020-04-12 16:12:08 +02:00
gparant
bbc3935d60 Fix feedback @kharhamel 2020-04-12 13:57:00 +02:00
kharhamel
793e5318f7 created a class to centralize all user inputs catching and expose user events 2020-04-11 16:46:28 +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
gparant
25895e51f7 Fix and refactor with comments of @moumoug 2020-04-07 22:38:53 +02:00
gparant
67c3eaa7f4 Fix Message send to add direction 2020-04-07 21:02:23 +02:00
gparant
bac1e804ad Refactor to include connexion 2020-04-07 20:41:35 +02:00