Commit Graph
73 Commits
Author SHA1 Message Date
Pieter-Jan Briers 62b60fc426 Add GetOffset() helper to SnapGridComponent. 2020-10-20 12:04:46 +02:00
DrSmugleafandGitHub 6eb3301904 Add debug assert for transform self parenting (#1340) 2020-10-19 22:20:42 +02:00
DrSmugleafandGitHub 3176d4c06e Rename last usages of Collidable to Physics (#1333) 2020-10-14 22:42:01 +02:00
DrSmugleafandGitHub f8d5fa5319 Rename CollidableComponent to PhysicsComponent (#1320) 2020-10-11 15:32:50 +02:00
DrSmugleafandGitHub da76788751 Replace MapIndices to Vector2i (#1318) 2020-10-11 14:33:09 +02:00
5f1251a813 LocalPosition value check (#1312)
Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
2020-10-10 12:05:06 +02:00
00fbefa4e5 Physics caching go brrt (#1307)
* Physics caching go brrt

* Minor optimisation

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
2020-10-09 11:40:02 +02:00
Víctor Aguilera Puerto 1181464829 Add RotateEvent raised when a Transform's LocalRotation changes. 2020-09-07 13:56:34 +02:00
0a67cecfa5 Replace every usage of GridCoordinates with EntityCoordinates (#1280)
* Added struct skeleton for EntityCoordinates.

* Polish EntityCoordinates, add tests, add EntityCoordinates to Transforms

* Doc cleanup

* Remove useless code

* Return offset 0 when you don't have a parent

* Test for making sure EntityCoordinates for entities without parents have offset 0

* Use parent transform's GridId for GetGridId.

* Adds various methods, checks and tests

* Replace GridCoordinates with EntityCoordinates

* EyeManager.WorldToScreen fix

* Address reviews

* Fix za buildo

* Fix one transform test

* Fix the remaining tests

* Remove duplicate

* Remove another merge duplicate

* Fix property

* Rename most usages of GridCoordinates to EntityCoordinates.

* Add WithEntityId method to EntityCoordinates.

* Fix EntityCoordinates usage in GetEntitiesInRange

* Remove cursed IMapGrid method, change naming.

* Makes GridTileLookupSystem use EntityCoordinates

Co-authored-by: Acruid <shatter66@gmail.com>
Co-authored-by: Víctor Aguilera Puerto <zddm@outlook.es>
2020-09-06 16:09:19 +02:00
0701b040ee EntityCoordinates (#1277)
* Added struct skeleton for EntityCoordinates.

* Polish EntityCoordinates, add tests, add EntityCoordinates to Transforms

* Doc cleanup

* Remove useless code

* Return offset 0 when you don't have a parent

* Test for making sure EntityCoordinates for entities without parents have offset 0

* Use parent transform's GridId for GetGridId.

* Adds various methods, checks and tests

* Adds new constructor to EntityCoordinates and add WithPosition method

Co-authored-by: Acruid <shatter66@gmail.com>
2020-09-04 23:08:18 +02:00
Pieter-Jan Briers d4fc0517c4 Fix IEntity.TryGetComponent nullability signatures.
This means all invocations of TryGetComponent now need a nullable parameter because, well, the result can be null. that's the point.
2020-08-20 15:31:18 +02:00
ShadowCommanderandGitHub 30108cf992 Refactor DetachParent (#1188) 2020-07-25 17:04:14 +02:00
Pieter-Jan Briers 0297464af5 Fix MapID assignment in transform init. 2020-07-22 01:51:17 +02:00
ShadowCommanderandGitHub 8e39de77f1 Fix GridPosition set breaking when value.GridID == GridId.Invalid (#1178) 2020-07-11 02:38:36 -07:00
Pieter-Jan Briers af4c920606 Don't lerp transforms on teleports/parent changes. 2020-07-04 00:35:40 +02:00
Pieter-Jan Briers b72b0e5984 Use a DynamicTree for sprite finding.
Significantly improves client CPU usage.
2020-06-29 16:18:11 +02:00
Pieter-Jan Briers a40d89dd3e Optimize TransformSystem.
Now keeps a list of actively lerping transforms instead of iterating every transform every tick.

Yeah it doesn't even show up in profiles anymore instead of taking like 8% of CPU time.
2020-06-28 00:41:48 +02:00
Pieter-Jan Briers 1a7cc344e2 Optimize TransformComponent component state handling:
1. Don't resolve Parent in GetComponentState
2. Don't try to AttachParent unless parent actually changed.
2020-06-25 18:17:25 +02:00
Pieter-Jan BriersandGitHub 31fb65bcb9 Movement prediction work. (#1144)
* Fix client-side input system not sending sequence numbers for input messages.

This caused message ordering issues and keys getting stuck down.

* Make sure EyeUpdateSystem runs after physics.

* IGameTiming.TickFraction helper.

* Subtick data for input commands.

* Literally a unit test to verify that I wasn't going insane while debugging input message ordering issues.

* More prediction logs behind net.predict.

* Move physics to shared and run it on the client.

* Synchronize grid gravity.

* Fix ResetPredictedEntities crash when entities get deleted server-side.

* Fix CollidableComponent setters not calling Dirty()

* Fix going into space while predicting.

* Watch window uses history line edit.

* Fix unpredicted objects stuck-jittering.

* VV tags for interp vars on transform.

* Fix 0 mass objects on client.

* Fix friction calculations being TPS dependent.

* Reset predict flag on handelComponentState
2020-06-24 20:47:20 +02:00
Pieter-Jan Briers 77b7d4f683 Move transform interp to an entity system. 2020-06-19 00:18:59 +02:00
Tyler YoungandGitHub 5c8545c396 Revert "Virtualize all NetIDs to reduce network traffic" (#1119)
This reverts commit d776476542.
2020-06-09 00:34:37 +02:00
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