Commit Graph
52 Commits
Author SHA1 Message Date
Tyler YoungandGitHub d776476542 Virtualize all NetIDs to reduce network traffic (#1116) 2020-06-08 13:38:08 +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
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 Briers 964afc523f Fix map entities not being added to their parent's children list. 2020-04-17 23:46:43 +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 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
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 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
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 Briers 9d4dec2ea7 Fix SnapGridComponent not correctly cleaning up when moved between grids. 2019-10-14 17:09:28 +02: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
Acruid 4d30d5af78 TransformComponent now properly rebuilds its matrices on startup. This resolves https://github.com/space-wizards/space-station-14/issues/224.
Fixed bug with ParentChangedMessage using the wrong entity in its OldEntity argument.
2019-09-05 16:00:41 -07:00
Acruid dba0815585 When an entity is deleted, its children are now implicitly deleted as well. Previously, the children were orphaned onto the map. This resolves space-wizards/RobustToolbox/#855. 2019-09-04 11:44:27 -07:00
Acruid 096b7f6bca Removed TransformComponent.VisibleWhileParented.
Removed `TransformComponent.ParentChangedEventArgs`, this was dead code from the removed `TransformComponent.OnParentChanged` event.
2019-08-05 13:21:55 -07:00
Pieter-Jan Briers fdfbf92223 Remove a ton of lighting system cruft.
Basically just kills the light manager.
Clyde was already using the ECS anyways.
2019-07-30 13:31:05 +02:00
Acruid 51bbc7e565 Removed obsolete TransformComponent.OnParentChanged event. Use the component or entity system message for this event. 2019-07-29 16:16:55 -07:00
Pieter-Jan Briers a4f2441153 Adds SnapGridComponent.GetLocal() 2019-07-26 13:49:09 +02:00
Acruid ed97cbb42d The *World functions on TransformComponent now properly account for the grid world location. This fixes entities being drawn around the world origin when they touch a grid that isn't at 0,0 in the world. 2019-07-24 10:29:40 -07:00
Acruid 8c46c06497 Setting the world position of a Transform now properly sets the grid index. 2019-07-20 12:37:46 -07:00
Pieter-Jan BriersandGitHub bb4a1eda8e Project file refactor (#819)
* Project file refactor

Move all the .csproj files to the new .NET Core style.
This doesn't make any difference for compiling for Framework,
but it does reduce a ton of useless boilerplate.

As an extension of this, killed a bunch of uncompiled & unmaintained .cs files.

Compiling for release (to profile) works now.
Removed AnyCPU targets from the solution file.

* Fix compiler warnings.
2019-05-28 00:16:01 +02:00
Pieter-Jan BriersandGitHub e7a8e9b1aa Fix client side entity positions. (#811)
They were being interpolated to the origin.
2019-05-16 20:15:20 +02:00
AcruidandPieter-Jan Briers c4fb96b5e8 Tile Placement Improvements (#808)
* Tile Placement box actually uses the mouse snapgrid, not the players.

* Placement box only snaps to grids if cursor is over grid.
First tile of new grid is centered on cursor, instead of bottom left on cursor.

* Place square now sticks to the edge of a grid.
Cannot place tiles that would touch two grid Bounds.
2019-05-11 15:58:28 +02:00
Pieter-Jan Briers 3889066e9c Make parenting a transform to its current parent a no-op. 2019-05-05 13:05:31 +02:00
AcruidandPieter-Jan Briers 7053fb15f8 Map System Code Refactor (#796)
* Removed unused method TileRef.GetStep().
Removed unused property TileRef.TileSize.
Removed unused property TileRef.Tile, made the field public with the same name.
Made the TileRef struct readonly.
Removed property TileRef.TileDef.
Removed property TileRef.LocalPos.
Renamed GridTile to GridIndices.
Implemented IEquatable on TileRef.
Implemented Equality operators on TileRef.
Added PublicAPI attribute to TileRef.
Added doc comments to TileRef.

* Modified Tile:
Added the PublicApi annotation.
Made struct readonly.
Filled out doc comments.
Changed auto properties to readonly fields.
Renamed TileId to TypeId.
Added a static Empty tile to the struct.
Implemented IEquatable.

* Modified MapCoordinates:
Added PublicApi attribute.
Implemented IEquatable.
Filled out doc comments.
Removed Map property.

* Modified ScreenCoordinates:
Filled out doc comments.
Added the PublicApi attribute.
Implemented IEquatable.

* Modified GridCoordinates:
Removed method IsValidLocation.

* Removed property GridCoordinates.Grid.

* Removed GridCoordinates.Map.

* Removed GridCoordinates.MapId.

* Removed property GridCoordinates.IsWorld.
Removed constructors taking a MapId.

* Removed static IoCManager calls from GridCoordinates.

* Modified GridCoordinates:
Added attribute PublicApi.
Filled out doc comments.

* Filled out doc comments for MapGrid.
Filled out doc comments for MapIndices.
Misc refactors for both.

* added command to teleport grids.

* Added method Box2.Intersect.
Added method Box2.Union.
Placement manager now spawns new grids to place tiles not connected to an existing grid.
2019-04-20 20:37:37 +02:00