Commit Graph
71 Commits
Author SHA1 Message Date
Tyler YoungandGitHub d776476542 Virtualize all NetIDs to reduce network traffic (#1116) 2020-06-08 13:38:08 +02:00
865c04b264 Add collidable events back in (#1115)
Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
2020-06-08 13:29:16 +02:00
Pieter-Jan BriersandGitHub ec0f4b35f7 Enable nullable reference types on Robust.Shared and fix all warnings. (#1109) 2020-06-08 01:13:01 +02:00
ComicIronicandGitHub 486fd670e2 Change DrawDepth to int, add content constant hook (#1090)
This allows DrawDepth to be defined in the content layer.
2020-05-31 00:40:48 +02:00
Jackson LewisandGitHub 274334c926 Rewrite the physics engine (#1037) 2020-05-23 01:21:02 +02:00
Pieter-Jan Briers 3f73aebb52 Fix MapId assignment bug. 2020-05-03 00:03:12 +02:00
Pieter-Jan Briers 703c404f11 Fix moving things between maps not updating physics trees correctly. 2020-04-30 00:32:30 +02:00
Pieter-Jan Briers a380cd9e40 Fix some incorrect naming in TransformComponent 2020-04-20 17:54:33 +02:00
Pieter-Jan Briers ec5e4e6c8a Cache MapID on TransformComponent. 2020-04-20 16:10:48 +02:00
Pieter-Jan BriersandGitHub 0c8f869cb4 Prediction (#1027) 2020-04-18 17:35:54 +02:00
Pieter-Jan Briers 964afc523f Fix map entities not being added to their parent's children list. 2020-04-17 23:46:43 +02:00
1cdb279319 Add collision change event (#1024)
Used for the pathfinder to keep track of the graph.

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
2020-04-09 16:52:16 +02:00
Acruid 8f968760cb Replace IMapManager.FindGridAt with IMapManager.TryFindGridAt.
Grid spatial queries do not return the default grid anymore.
2020-02-27 02:10:18 -08:00
Pieter-Jan Briers d5872ce66d Make transform move messages use EventBus to improve perf. 2020-02-27 01:23:25 +01:00
metalgearslothandGitHub 209b94a6f1 Add SnapGrid method to get neighbor GridCoordinates (#1002)
Just saves using a bunch of variables on content-side.
At this stage it's just used for puddles.
2020-02-25 22:38:39 -08:00
Tyler YoungandGitHub a8f615d64b Fix lockers making items uninteractable (#1004)
* remove setter for MapPosition

change DetachParent to set WorldPosition after re-parenting to correct Map entity or MapGrid entity

* workaround until default grid not needed due to items can't be picked up if map ent parent
2020-02-25 22:31:46 -08:00
Pieter-Jan BriersandGitHub 0b1f088f8c Better entity exception tolerance (#996)
* Use separate define constants for exception tolerance stuff.

* Improve handling of exceptions during entity creation.

The entity in question now gets marked as deleted immediately.

* Glorious.

* Testing components, tests, wrapper exception type.
2020-02-24 03:56:50 +01:00
Pieter-Jan BriersandGitHub 32bafb66a8 Shadows & FOV. (#992)
* Work on shadow casting.

* Shadowcasting depth works, code cleanup

* Adds #include support to SWSL parser.

* Move lighting shader to swsl.

Also more shader parser fixes.

* Move PI constant to correct file.

* Got functional FOV, working on wall bleed.

* Hey, it kinda works.

* Occluder component now lives in shared.

* Optimizations.

* Fix light map color format.

I set it to something else while testing perf.

* Front face cull final FOV pass.

* Fix holes in occlusion geometry due to disabled occluders.

* Starting work on better wall handling.

* Some comments.

* Improve font-face-culled FOV pass.

* Improve various light biasing things.

* VSM, smooth shadows.

Also unused VSM blurring because it didn't work but committing it like this will forever keep it in Git somewhere.

* FOV smoothing, looks kinda awful.

* Base wall bleed blur strength on camera size.

* The part where I give up.

* Comments. Many comments.

* Allow eyes to disable FOV.

* Improve OccluderComponent on the client.

* Update for occluder component changes.

* Maybe do this properly...
2020-02-23 17:18:58 +01:00
Pieter-Jan Briers 5f4cd8f98a Fix crash on map deletion. 2020-02-23 17:05:53 +01:00
Tyler YoungandGitHub 214f9f0323 Implement client bubble PVS. (#983)
* bubble implementation

include contained entities

fix line edit crash when clipboard contents are null somehow

use CVar for update bubble range

remove seenMovers that get NaN'd out of MaxUpdateRange - huge reduction in network traffic from bullets

cut default of MaxUpdateRange down to 12.5 for now

maybe handle teleported things

handle removing player state on disconnect

fixed positional audio errors

make UpdateEntityTree also update player's last seen ents

make net.maxupdaterange cvar tunable at runtime w/o impacting performance

back to position nan as means to hide from client

revert work pooling as the wrong player was getting the wrong game state

ffs needed to think less about *if* something is *seen* and more about *when* it must be *unseen*

clean up usings

handle parenting and sequencing issues that arise on the client

gather needed ents to update recursively

applied suggestions from code review

fix missing recursively contained ents

make assumption that client last saw things on first tick instead of tick zero, as zero would be the "from tick" and first would be he "to tick"

add First tick as constant to GameTick due to relevance above

renamed includedEnts to checkedEnts to make usage more clear

added comments

inverted some conditions to flatten parts of the pvs logic

fixed sending states when already seen (lastChange < lastSeen to lastChange <= lastSeen)

fix sending states when no actual changes (other bugs?)

local caching of currentTick, remove priorTick

* make TransformComponent's Parent setter call Dirty() to handle replicating network state if AttachParent isn't invoked

* fixed parent changed by setting Parent on Transform not updating parent's Children collection and other stuff

rotating parent entities now are visible with their orbiting children if one of their children moves into view

* break out duplicated code as GetLastSeen

* remove unused net.parallelstates

introduce net.pvs to configure enabling/disabling PVS
2020-02-23 14:42:54 +01:00
Acruid 2cacf00d1a The VV system now has a PropertyEditor for EntityUid.
The Parent EntityUid property is now exposed on ITransformComponent.
2020-02-22 14:36:45 -08:00
AcruidandGitHub 728f58465d EntitySystem Event Refactor (#989)
* Removed the EntitySystem event implementation, it now uses the more advanced EventBus.
Removed EntitySystem.RegisterMessageTypes() function.
Removed EntitySystem.SubscribeEvents() function.
Added EntitySystemMessage.NetChannel field. This holds the remote net channel the event originated from.

* Removed the Sender object from events. If you needed this field, add it to the event class.

* Removed unused event proxy methods from Entity.
SubscribeEvent() has been split into SubscribeNetworkEvent() and SubscribeLocalEvent() methods on EntitySystem.
Most methods on EntityEventBus now require callers to specify the source (Local or Network) of the events.
2020-02-22 17:59:43 +01:00
Pieter-Jan Briers eae2a9283d Fix compiler warnings 2020-02-17 13:57:18 +01:00
Pieter-Jan BriersandGitHub 115795c38e Game state netcode improvements (#978)
* Fix server sending ALL game states reliably.

Now only large enough game states get sent reliably. This means that when a single client stops ACKing the server isn't spamming a bunch of massive game states into Lidgren to reliably deliver.

* Do not send prototype-duplicated data in game  states.

This cuts out component states and ComponentChanged data if this can already be inferred by deserialization of the prototype on the client.

* More comments.

* Remove debugging code.

* Use GetNetComponents instead of GetAllComponents.

Nice little optimization.
2020-02-15 13:45:52 +01:00
Acruid f5c4012408 Fixes issues with certain components that prevented network interpolation from working.
Added try/catch around call to IComponent.HandleComponentState().
Prevent interpolating entities with large changes in position (teleporting).
2020-02-09 02:24:07 -08:00
Tyler YoungandGitHub 42c22c1041 Physics fixes (#963)
DynamicTree now no longer uses a ConcurrentDictionary for proxy look ups
2020-02-08 20:07:13 +01:00
Tyler YoungandGitHub 755675eaab Introduce DynamicTree, Separate Ray from CollisionRay (#951)
* separates Rays from CollisionRays, removing collision masking from Ray

* Entity, ClientEntityManager and EntityManager classes occasionally need to UpdateEntityTree

Entity intersection queries now use a DynamicTree

DynamicTree now correctly reports Count and separately NodeCount

DynamicTree now has optionally precise queries

DynamicTree no longer incorrectly Adds on AddOrUpdate if Update is not necessary

Entity startup now starts Transform, then Collidable, then remaining components

EntityManger's Entity dictionary is now a ConcurrentDictionary to support iteration under modification

DynamicTree freeing root leaf no longer results in invalid tree

SnapGridComponent has been extended to support additional area and directional queries

* added lots of calls to UpdateEntityTree, will need to scale back during review

fixed moved/changed AABB updates to DynamicTree, missed a ref

converted other methods in EntityManager to use the tree for spatial queries

* add unit tests for DynamicTree

make Capacity and EnsureCapacity public, setting Capacity will call EnsureCapacity

* fix brace style

* Box2 Grow -> Enlarged, Combine -> Union
2020-02-06 14:13:15 +01:00
Tad HardestyandGitHub f8037df56a Replace TransformComponent.OnMove with component message (#946) 2020-02-03 18:05:55 +01:00
Acruid 4eb29a9e80 Removed GridCoordinates.ConvertToGrid because it is completely pointless.
Removed GridCoordinates.ToWorld in preparation for removing Map Default Grids.
2020-01-25 01:37:37 -08:00
Acruid df9be436c4 Removed the StateType property from every component. This field was completely unused except for a debug assertion. 2020-01-24 14:07:46 -08:00
Pieter-Jan Briers 132f15b32d Rendering optimizations. 2020-01-20 17:45:33 +01:00
Acruid 30db86fae8 Collidable Components are now added to grids when they are created. 2020-01-11 15:13:15 -08:00
Acruid 78a33076f9 Merged client and server CollidableComponent into a shared version. Now shared code can add collidable components to entities. 2020-01-11 14:10:25 -08:00
Acruid 8d30bcb041 Added a ShowContents flag to containers so that the contents can be rendered.
Added `bool TryGetContainer(IEntity, out IContainer)` to containers.
Changed the API of ContainerHelpers.
2020-01-03 15:16:07 -08:00
Acruid 4a900cbd7f Removed IoCManager.Resolve calls from IMapGrid. 2019-12-29 23:20:36 -08:00
Acruid 37aee07596 Rename GridId.Nullspace to GridId.Invalid, because it has nothing to do with Nullspace anymore. 2019-12-29 18:02:02 -08:00
Acruid 58d0a771e8 TransformComponent.GridID now returns GridID.Nullspace instead of throwing when the entity in question is not on a grid.
Added MapManager.Restart().
Added MapManager.CreateNewMapEntity() and MapManager.SetMapEntity() for manipulating the map root entity.
You can now spawn entities directly into Nullspace, after setting up the Nullspace map entity.
2019-12-29 16:08:46 -08:00
Pieter-Jan Briers 3f979ef7f2 Fix crash on server shutdown.
This also fixes integration tests.
2019-12-28 12:45:29 +01:00
Pieter-Jan Briers cb563c75fd Update map loader to work with grid entities. 2019-12-28 03:22:09 +01:00
Pieter-Jan Briers 472bd67ace Fix edge sliding.
The "too close" threshold on Transform WorldPosition set was way too high, so the low movement speed when edge sliding was seen as not moving at all.
2019-12-24 15:26:23 +01:00
Pieter-Jan Briers 2b037c3bf2 Synchronize containers to the client. 2019-12-22 21:43:03 +01:00
AcruidandPieter-Jan Briers f5c0dba194 Map & Grid Entities (#916)
* Adds Map components to the ECS system.

* Grid entities are now created along with map grids.
Grid components are now properly reused from map deserialization when a grid is created through the MapManager.

* Make MapGridComponent shared.
Don't send Nullspace default grid to client, they have their own.
Properly link the new grid with the entity sent from the server.

* Fixes nullRefException when ToString() is called on an Entity with no Prototype.

* Adds logging debug info about binding a map/grid to an entity.
Nightly Commit.

* Client map networking now properly pivots a grid from the client entity to the shared entity.
Added IMapGridComponent.ClearGridId() to properly dissociate the component from a grid before deleting it.
WorldPosition of a default grid is always 0,0 regardless of the entity transform (if any).
Nullspace map and default grid are not bound to an entity.
Nullspace map and default grid cannot be deleted.

* Map Entities are now created along with new maps.

* Client & Server load with new scene hierarchy.

* Fix rebase damage.

* Added ContainerHelpers helper class.

* Fix Container checks.

* Fixed clothes.

* Fixing unit tests.

* Removed disabled code.

* Actually initialize and startup the Map and Grid entities.
2019-12-21 22:11:17 +01:00
Acruid df34ce025a Entities now require a location when being spawned. 2019-12-16 21:43:24 -08:00
AcruidandGitHub ea8e5e9fe7 EventBus Refactor (#909)
* Extracts the ECS event system out of EntityManager, and into a new class called EventBus.
XML Docs and full test coverage for EventBus.
2019-12-08 19:36:52 -08:00
AcruidandPieter-Jan Briers d9a411b260 Shared IMap/Map class removal (#904)
* Moved IMap from Shared/Interfaces/Map to Shared/Map namespace.

* Extracted Map class out of the MapManager class.

* Removed the Map class and interface.

* Fully removed the Map and IMap class.
2019-11-26 20:47:04 +01:00
Pieter-Jan BriersandGitHub e519b6b53d Delete some dead code. (#876)
Mostly utility classes and ancient legacy.
2019-10-17 01:52:58 +02:00
Pieter-Jan Briers 9d4dec2ea7 Fix SnapGridComponent not correctly cleaning up when moved between grids. 2019-10-14 17:09:28 +02:00
Acruid 72f7310890 Entities without a prototype were causing an exception in the MetaDataComponent networking. 2019-09-20 13:15:59 -07:00
Acruid 55a50ff7ba Setting the Component.Running property now calls the Startup/Shutdown methods automatically. Startup/Shutdown are now protected. This makes the system more foolproof, previously if the component did not call the base method inside Startup/Shutdown, everything would break. This also allows a component to be started/stopped from the VV system by simply setting the property. 2019-09-18 11:24:15 -07:00
Pieter-Jan BriersandGitHub 5d5b897a9b Property animations track (#867)
* WiP property animations system

* Use better lerp for Angle property animations.

* Fix handling of offset in sprite component.

* Allow animating some sprite layer properties.

* Allow animating some Transform properties.

Obviously not advisable for server entities, but great for client side entities!

* Improve animation property interpolation handling.

Added a "previous" mode.
Made values that cannot be sanely interpolated fall back to this mode.

* Improve some animation docs.
2019-09-17 22:57:12 +02:00