Commit Graph

37 Commits

Author SHA1 Message Date
Regalis
e3b595b9e0 Cleanup (removing unused variables & other redundancies, rethrowing exceptions instead of wrapping them in a new exception instance) 2017-05-20 15:35:13 +03:00
Regalis
e94a50a29a The server keeps track of which ID a client is going to switch to when midround syncing is done, and switches the ID immediately when the client is in sync (instead of waiting for the client to report the new ID).
Fixes clients occasionally getting kicked out the moment they're in sync, because their latest received ID is still set to the ID of the last unique event and the server thinks they're requesting some old event that doesn't necessarily exist anymore.

+ added a debug command that creates a ton of entity events
2017-04-08 20:10:15 +03:00
Regalis
1a3c18c727 EntitySpawner sends spawn/removal messages to clients using EntityEvents.
EntityEvents and EntitySpawner used to work independently of each other, with separate IDs, and there was no guarantee that spawning and events would happen in the correct order. For example, a client could fail to read events during midround syncing because the entity has been removed, or read an event for an incorrect entity because the entity has been removed and the ID taken by some other entity.
2017-03-27 21:05:32 +03:00
Regalis
5bdb57b98a Merge branch 'master' into new-netcode
Conflicts:
	Subsurface/Properties/AssemblyInfo.cs
	Subsurface/Source/Characters/AICharacter.cs
	Subsurface/Source/Characters/Animation/HumanoidAnimController.cs
	Subsurface/Source/Characters/Character.cs
	Subsurface/Source/GameMain.cs
	Subsurface/Source/Items/Components/Signal/Connection.cs
	Subsurface/Source/Items/Item.cs
	Subsurface/Source/Networking/GameServer.cs
	Subsurface/Source/Networking/GameServerLogin.cs
	Subsurface/Source/Physics/PhysicsBody.cs
2017-03-11 13:24:09 +02:00
Regalis
6a31d56175 Fixed mid-round joining clients automatically getting kicked out because they're missing old events
Now they're kicked out if they're not in sync within 10 seconds of joining, TODO: calculate a reasonable timeout based on the amount of events and/or give the client more time if they keep receiving events
2017-03-09 21:40:58 +02:00
juanjp600
ecb7500df9 Converted UInt32 ID's to UInt16
TODO: test everything, make sure nothing broke
2017-03-06 16:25:12 -03:00
juanjp600
ba026a8f88 Added list of homoglyphs for name comparison
Unicode is now allowed in player names, but it can't be easily exploited anymore
2017-03-02 12:09:08 -03:00
Regalis
6c8f5b8999 The server maintains a list of unique EntityEvents created during the round and sends them to clients who join mid-round 2017-02-18 15:09:13 +02:00
Regalis
4b8d1054b1 Changed lobby & chatMsg IDs to from uint to ushort, added a utility class that handles the wrap around of IDs 2017-02-05 22:55:19 +02:00
Regalis
9b03b2bcc1 Server ignores UPDATE_INGAME messages if the game isn't running, server doesn't set any of the clients' lastRecvIDs above the ID of the latest chatMsg/event/etc (clients can't have received something the server hasn't sent yet) 2017-01-13 18:07:00 +02:00
Regalis
ed675dc75e Lobby update ID isn't included in ingame update messages, resetting lastRecvGeneralUpdate in InitClientSync 2017-01-11 23:37:30 +02:00
Regalis
402c745fc3 Reimplemented chat range & radio messages. Each client now has their own chatMsgQueue, so all chat messages don't have to be sent to all clients. 2017-01-07 19:22:48 +02:00
Regalis
adde3461ea Merge branch 'master' into new-netcode
Conflicts:
	Subsurface/Properties/AssemblyInfo.cs
	Subsurface/Source/Characters/Animation/HumanoidAnimController.cs
	Subsurface/Source/Characters/Character.cs
	Subsurface/Source/Items/Components/Door.cs
	Subsurface/Source/Items/Components/Power/PowerContainer.cs
	Subsurface/Source/Items/Components/Signal/Wire.cs
	Subsurface/Source/Items/Item.cs
	Subsurface/Source/Networking/ChatMessage.cs
	Subsurface/Source/Networking/GameClient.cs
	Subsurface/Source/Networking/GameServer.cs
	Subsurface/Source/Networking/GameServerLogin.cs
	Subsurface/Source/Networking/GameServerSettings.cs
	Subsurface/Source/Networking/NetworkMember.cs
2016-11-24 19:52:40 +02:00
Regalis
c3b84ca835 Re-enabled client permission settings in NetLobbyScreen, fixed clients not setting their permissions when receiving PacketTypes.Permissions 2016-11-21 17:46:03 +02:00
juanjp600
ba7fcad8f2 Readded special client permissions
Also added a command that requires a password to gain the permissions.
I think they were never vulnerable in the first place, gamerfood was just trying to intimidate us.
2016-11-20 22:01:37 -03:00
juanjp600
2d6196b5f0 Trim spaces from name
Some troll exploited this on Landon's public server, so here's a fix.
2016-11-19 22:15:58 -03:00
Regalis
724172fe7c Server doesn't attempt to resend unacked EntityEvents until Connection.AverageRoundTripTime has passed 2016-11-13 14:45:00 +02:00
Regalis
498c72c64a Server sends ServerEntityEvents to clients, NetEntityEvents can contain an object array which will be passed to the serializable entity (now only used for ItemComponent indices) 2016-11-13 13:56:48 +02:00
Regalis
c314b37029 Some classes for syncing entity state changes. Similar to the NetworkEvents in the old netcode, but the logic is split into separate classes which prevent the server from reading updates for entities that aren't IClientSerializable.
todo: add NetEntityEventManagers to server & client, some logic to prevent sending events that don't need to be sent (e.g. duplicate event state updates)
2016-11-12 20:56:06 +02:00
Regalis
6f9160e4a7 Removing & spawning entities in the same order as the server, EntitySpawner does both removing and spawning 2016-10-26 16:44:59 +03:00
Regalis
170e1a0da8 ItemRemover -> EntityRemover, clients reset spawner & remover when starting a new round 2016-10-12 20:46:47 +03:00
Regalis
60b36e020c Changed ItemSpawner to EntitySpawner, used for syncing both item and character spawning 2016-10-12 19:25:01 +03:00
Regalis
ac3539da63 Item spawn syncing 2016-10-12 18:29:44 +03:00
juanjp600
72033a581e Merge remote-tracking branch 'refs/remotes/barotrauma/master'
Conflicts:
	Subsurface/Properties/AssemblyInfo.cs
	Subsurface/Source/Characters/Character.cs
	Subsurface/Source/GUI/GUI.cs
	Subsurface/Source/GameMain.cs
	Subsurface/Source/GameSettings.cs
	Subsurface/Source/Items/CharacterInventory.cs
	Subsurface/Source/Items/Components/ItemComponent.cs
	Subsurface/Source/Items/Components/Machines/Pump.cs
	Subsurface/Source/Items/Components/Machines/Radar.cs
	Subsurface/Source/Items/Components/Machines/Steering.cs
	Subsurface/Source/Items/Components/Power/PowerContainer.cs
	Subsurface/Source/Items/Inventory.cs
	Subsurface/Source/Items/Item.cs
	Subsurface/Source/Items/ItemSpawner.cs
	Subsurface/Source/Map/Levels/WaterRenderer.cs
	Subsurface/Source/Map/LinkedSubmarine.cs
	Subsurface/Source/Map/Map/Map.cs
	Subsurface/Source/Map/Structure.cs
	Subsurface/Source/Map/Submarine.cs
	Subsurface/Source/Map/WayPoint.cs
	Subsurface/Source/Networking/GameClient.cs
	Subsurface/Source/Networking/GameServer.cs
	Subsurface/Source/Physics/PhysicsBody.cs
	Subsurface/Source/Screens/GameScreen.cs
2016-10-11 20:19:25 -03:00
juanjp600
344947c3c4 Search and destroy mission
Featuring ugly code
2016-09-26 22:09:06 -03:00
juanjp600
44e12ffed2 Basic player input syncing
There's currently a bug where the inputs might be read out of order or more than once, which leads to desync. I'll feel really dumb when I find what's going on here.

Also, I'm using placeholder player spawning because CharacterInfo doesn't seem to be fully functional yet.
2016-09-22 21:20:46 -03:00
juanjp600
bfd8bc6b35 Server serialization functions require client 2016-09-07 17:32:20 -03:00
juanjp600
e3433c725e Server name, message and submarine list syncing 2016-09-02 22:24:14 -03:00
juanjp600
028c3a8bc1 Added lobby chat syncing 2016-09-01 20:45:43 -03:00
juanjp600
9416eb64d7 Completely destroyed game
Looks like a lot more than just netcode is getting rewritten. Removing coroutines because there are better ways of handling asynchronous tasks, removing filestream because that's to be reimplemented later
2016-08-30 19:59:14 -03:00
juanjp600
6e83ef7626 Merge remote-tracking branch 'refs/remotes/origin/master'
Conflicts:
	Subsurface/Barotrauma.csproj
	Subsurface/Source/Characters/AI/EnemyAIController.cs
	Subsurface/Source/Characters/AICharacter.cs
	Subsurface/Source/Characters/Character.cs
	Subsurface/Source/Items/Components/DockingPort.cs
	Subsurface/Source/Items/Components/Door.cs
	Subsurface/Source/Items/Item.cs
	Subsurface/Source/Networking/GameClient.cs
	Subsurface/Source/Networking/GameServer.cs
	Subsurface/Source/Physics/PhysicsBody.cs
2016-08-30 18:04:49 -03:00
juanjp600
52270e3a35 Hacked clients can't send chat messages from other characters anymore
Also added sendername as userdata in chat messages, for now it's not used for anything but we'll probably find something where this is useful
2016-08-30 17:35:58 -03:00
Regalis
a0a5e2df33 v0.5.0.1 + re-enabled the black wall damage indicators, client permissions disabled 2016-08-29 23:43:08 +03:00
juanjp600
d909a8d9b6 Filter out Unicode and non-printable ASCII
+ return when authentication fails because of null client
2016-08-28 16:01:23 -03:00
Regalis
fe8cce1723 Using Levenshtein distance to measure the similarity of chat messages, (float)0.0 -> 0.0f 2016-08-28 16:53:24 +03:00
juanjp600
12f849be01 Removed references to reliable sender
Now the game is broken, progress is being made :)
2016-08-25 18:55:32 -03:00
Regalis
712953cc9e WIP client special permissions (kick, ban, end round) 2016-08-24 11:47:46 +03:00