Commit Graph

37 Commits

Author SHA1 Message Date
Pieter-Jan Briers
d134f31d66 Re-implement DynamicTree<T> on top of B2DynamicTree<T>. 2020-09-24 11:51:50 +02:00
DrSmugleaf
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
Acruid
6245b2223b Improve performance when initially settling the map at load time.
Clients now simulate all awake bodies when predicting, not just predicted ones.
2020-08-18 10:59:49 -07:00
Acruid
5d2e3a4c61 Minor API improvements. 2020-08-06 22:00:20 -07:00
Acruid
876d528578 Had to optimize the physics so that the client runs on my laptop. 2020-07-29 00:47:47 -07:00
Acruid
8475c1ae4b Moves all of the PhysicsComponent data to the CollidableComponent, and marks the PhysicsComponent as obsolete. 2020-07-21 23:36:42 -07:00
Acruid
64bb519bce Adds PhysBody sleep visualization to the Collidable overlay. 2020-07-19 02:34:19 -07:00
Jackson Lewis
2d7192d79d Add Hard property to collidables and fix airlock issues (#1078)
Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
2020-07-02 13:35:58 +02:00
Pieter-Jan Briers
2af0d9df55 Optimizations to physics system.
Nothing major, just picking low hanging fruit and improving code quality around the place.
2020-06-30 15:13:51 +02:00
Tyler Young
4650dc2c49 ComponentManager Rework (#1143)
* rework ComponentManager

create indexing solution, UniqueIndex

split out ComponentEventArgs, add sealed variants

fix up documentation

fix terrible crap

make benchmark work

* woops, ordered enumerables are already a copy

* naming

* clean up comments

* nullable enable

* add some doc comments to unique index

* perf tweaks

add UniqueIndexHkm for high key mutability

extract internal interface mostly for documentation

add nullability support and constraints

* fix doc comment for UniqueIndexHkm

* make PVS threaded

* remove redundant member declarations in interface

* fix grid loss crap on client shutdown

* fix nullability warning when retrieving from always constructed threadlocal

* add comment explaining chan == null check

remove inParallel parameter
2020-06-24 11:59:56 +02:00
Pieter-Jan Briers
0d3cd41382 Enable NRTs on Robust.Server (#1118) 2020-06-09 14:18:29 +02:00
Pieter-Jan Briers
ec0f4b35f7 Enable nullable reference types on Robust.Shared and fix all warnings. (#1109) 2020-06-08 01:13:01 +02:00
Clyybber
6060a2ff4f Improve occlusion performance and fix a crash (#1107) 2020-06-06 19:45:38 +02:00
Clyybber
c32f21bea3 Better sound occlusion (#1102)
* Better occlusion; introduce IntersectRayPenetration

* Use ToArray instead of casting

* Better doc

* Use Debug.Assert
2020-06-05 12:53:43 +02:00
Clyybber
9d75c3a1c8 Implement audio occlusion and upgrade to OpenTK 4 (#1068) 2020-05-27 17:50:01 +02:00
Jackson Lewis
274334c926 Rewrite the physics engine (#1037) 2020-05-23 01:21:02 +02:00
Pieter-Jan Briers
a46704507a Remove accidental public modifier. 2020-04-30 01:55:55 +02:00
Pieter-Jan Briers
703c404f11 Fix moving things between maps not updating physics trees correctly. 2020-04-30 00:32:30 +02:00
Víctor Aguilera Puerto
bd20511ace Add predicate to Raycast (#1035) 2020-04-24 23:45:19 +02:00
Jackson Lewis
db8d9bd228 Gravity (#1031) 2020-04-23 16:49:19 +02:00
PrPleGoo
5c461a8500 Added unit tests for some collision code and a small rename (#1014)
* Changed how collision checks work

* Undid asym collision

* Push to switch machines

* Added UnitTest to clarify the logic in CollidesOnMask

* moved test into testcase
2020-03-15 07:27:25 +01:00
Víctor Aguilera Puerto
0a306514a2 IntersectRay can now ignore bodies that aren't hard collidables. (#1008) 2020-02-28 06:35:06 +01:00
Pieter-Jan Briers
eae2a9283d Fix compiler warnings 2020-02-17 13:57:18 +01:00
Tyler Young
42c22c1041 Physics fixes (#963)
DynamicTree now no longer uses a ConcurrentDictionary for proxy look ups
2020-02-08 20:07:13 +01:00
Tyler Young
b6e0359b06 Correct ray casting (#957)
fix weird merge artifacts

fix aabb extraction happening too early on ray casting
2020-02-08 11:05:18 +01:00
Tyler Young
5d37780f4e Have PhysicsManager use DynamicTree (#955)
* have PhysicsManager use DynamicTree

* remove BroadPhaseNative

add BroadPhase wrapping DynamicTree

replace IBroadPhase with regards to DynamicTree

* add collision enumeration capability for proper BroadPhase

* fix slow app exit due to MapId being unavailable at various stages of shutdown

reduce code footprint of alternate query in AnyEntitiesIntersecting by using existing query (only used rarely)
2020-02-07 15:15:33 -08:00
Tyler Young
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
Acruid
f33f9a7b52 Move raycasting into the broadphase algorithm.
Raycasts now require a MapID so that the ray is restricted to a single map.
2020-01-25 12:14:09 -08:00
Acruid
6817969c8b Adds a helper class that can partition a map grid chunk into a set of rectangles. 2020-01-13 11:23:35 -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
7a77fa59e2 Switched physics collision broadphase from spatial partition to Naive.
Grid->Grid collision works.
2020-01-10 15:39:34 -08:00
Pieter-Jan Briers
259f6c8ea4 Fix bullets crashing the server.
This is not a proper fix. A proper fix would be a better physics engine.

But as it stands I really wanna get a progress report out and having to refactor physics to do it would just suck.
2019-12-29 01:06:57 +01:00
Pieter-Jan Briers
1899544500 Server optimizations.
1. NetManager.IsConnected no longer uses LINQ.
2. creating net messages for sending/receiving now uses cached DynamicMethods to improve speed (bypasses Activator.CreateInstance and params allocations)
3. Entity.GetComponentStates uses GetNetComponents now.
4. PhysicsManager allocates significantly less now.
2019-12-11 17:08:46 +01:00
Pieter-Jan Briers
36822462ba Improve ray debug drawing.
Fixes unit tests.
Made ray color change if successful hit.
Made ray length based on actual ray results.
2019-11-24 00:44:47 +01:00
Ephememory
519c28cad2 Add a DebugDrawingManager for drawing server side events like Ra… (#892)
* add basis for debug drawing raycasts

* rays

* this was too much work

* i assumed you could do string object stuff. you cant.

* fixed a crash

* Greatly improved DebugDrawingManager code with a struct and list as opposed to dictionary

* change default ray debug color from green to magenta

* reviewed changes

* reviewed changes and adds network message to physicsmanager so it works without much user config
2019-11-23 13:09:48 +01:00
Acruid
f2eb035ed8 Physics Shapes (#847)
* Adds a new IPhysicsShape object where you can define what collisions shape a PhysBody has.
AABB is now accessed through the PhysicsShape, so the BoundingBoxComponent is not required.

* Default PhysShape now copies the AABB of the BoundingBoxComponent.

* Fixed issue with serialization of PhysShapeAabbComp.

* Spatial queries now use ICollidableComponent instead of BoundingBoxComponent.
showbb now draws entities using the obsolete BoundingBoxComponent in Aqua.

* Renamed PhysShapeAabbComp to PhysShapeAabb.
Removed BoundingBoxComponent.

* Default CollidableComponent does not collide with anything now.

* Renamed ICollidable to IPhysBody.
Moved ICollidable to the Robust.Shared/Physics namespace.

* PhysShapes are now a collection of primitive shapes that contribute to the whole PhysBody.
ObjectSerializer.DataField can now deal with abstract types using YAML tags.

* Added LocalBounds property to ClickableComponent.
Added state to ClickableComponent.

* Added a Rectangle physics shape.

* ClickableComponent now actually checks that a click is inside its bounds.

* Reverted the addition of a try/catch around map loading. Any errors can propagate to the code trying to load the map again.
2019-09-03 22:06:50 +02:00
Silver
25926a17b7 Renames SS14.* to Robust.* (#793)
RobustToolbox projects should be named Robust.* 

This PR changes the RobustToolbox projects from SS14.* to Robust.*

Updates SS14.* prefixes/namespaces to Robust.*
Updates SpaceStation14.sln to RobustToolbox.sln
Updates MSBUILD/SS14.* to MSBUILD/Robust.*
Updates CSProject and MSBuild references for the above
Updates git_helper.py
Removes Runserver and Runclient as they are unusable
2019-04-15 20:24:59 -06:00