Coder Social home page Coder Social logo

drchat / gmod-vphysics Goto Github PK

View Code? Open in Web Editor NEW
91.0 18.0 15.0 21.12 MB

Replacement vphysics module for the Source engine (originally meant for Garry's Mod)

License: Other

C++ 94.88% C 4.02% Lua 0.16% Shell 0.02% Makefile 0.12% Objective-C 0.80% Batchfile 0.01%

gmod-vphysics's Introduction

Gmod-vphysics

Replacement vphysics module for the source engine (formerly just garry's mod)

Users

Download

You can download vphysics here (courtesy of Gran PC)

Installation

  1. Copy vphysics.dll to the engine bin directory (parent folder is the one that contains hl2.exe, e.g. <username>/garrysmod/bin)
  2. Run the game.

You may have to repeat these steps if the game updates!

Developers

Libraries Required

  • Absolutely nothing! Everything needed included in ./thirdparty

Git Submodules

This library uses git submodules. In order to set those up, after cloning the repository, issue these commands:

git submodule init

# And to update submodules:
git submodule update

Alternatively, you can also clone the repository with the --recursive switch, as so:

git clone --recursive <url>

Submodules will need to be compiled separately from vphysics if required (atleast until a script is setup)

Windows Setup

  • Visual studio 2012 projects provided
    • You must configure the library paths manually (sorry!)
  • Optionally, premake scripts are provided in the proj folder

Linux Setup

  • You need to have the game you're building for installed, as vphysics needs to dynamically link to some modules. Configure the path in ./src/Makefile
  • You can use the build.sh provided in the root directory to compile vphysics. Optional arguments are -numthreads <count> and -clean (make clean before make)

Automatic Copying

On Windows, you can set the environmental variable "VPHYSICS_GAME_PATH" to the directory that contains hl2.exe and vphysics will automatically be copied over.

Pull Requests

Please make the code in your pull requests look neat, and have the commits be granular (handle one thing at a time). They will only be pulled if they're in the same coding style as the surrounding code (don't make your code stand out!)

gmod-vphysics's People

Contributors

andrewmcwatters avatar drchat avatar jcw87 avatar kcoen avatar tobba avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gmod-vphysics's Issues

Add new callback classes

Add new classes which vphysics can implement.
We need ones such as

  • Pre collision (really only need velocities from the objects)
  • Post collision
  • Friction
  • Object start touch
  • Object end touch
  • And maybe extras which may be useful elsewhere.

Props don't collide with map if they're spawned with the map.

Observed on d1_trainstation_02, could be other levels.

If you wake any props, they fall straight through the level. Could be a symptom of a missing collision manifold between the world and the prop. The only place that could do this would be CPhysicsObject::RecheckCollisionFilter()

Underlying issue with the game's collision solver returning false on world vs. prop collisions (appears to be in that order only). If our collision solver returns false, bullet won't delete any existing overlapping pairs between the two objects but it won't create any new ones.

Rewrite the parallel constraint solver

Use btThreadPool class to rewrite it, avoid using temp objects like on the sequential constraint solver

May be harder to write and I don't know about performance benefit. The way to go right now is solving islands in threads, not individual objects.

Sticky collisions with player vs. props, bullets put too small of a force on props.

I'm not sure if it's because I'm using Linux or not (the makefile has a common not-relative linker error, a bunch of posix defines are missing), however I'm having significant difficulty using this. From my brief testing, prop_static's have a coarse collision (near sticky). prop_physics_multiplayer doesn't seem to be impacted by gun fire (nor +use).

It may also be that I'm using this in CS:S (which isn't supported?), any insight would be appreciated.

Sliders sometimes get created 90 degrees from what they should be

I cant really nail this down, but a good way to make it happen yourself is to shoot down a thruster on a sloped surface and then try to slider it to said sloped surface.

both points of the slider are created in the same spot, instead of the second spot you clicked., and slide 90 degrees out from what they should.

Physics Objects sometimes snag on large convex diagonals

Objects appear to snag on the diagonals of rectangular objects, such as world geometry. Turn on vphysics_overlay_wireframe to find the cross-sections.
Also appear to happen on the edges, near the corners.

This REALLY happens with cylinders!

Happens in btGjkPairDetector.cpp in the last part. It appears to be flipping already correct contact normals!

Implement proper buoyancy

Implement buoyancy that is applied equally across any props in water, instead of just on their centers.

Manwhore Syndrome

Some of the male ragdolls have internal collisions between their legs, and the only way to solve them is if their legs are open! (Except for Eli, I guess he's the only decent male)
Try Kleiner, Barney, etc.

Why aren't the collisions between their upper legs disabled in the collision set? Do I need to look into error tolerance for bullet constraints?

Change player controllers to kinematic objects

Pros:

  • More precise control over all movements
  • Can actually use the push mass and push speed limit variables
    Cons:
  • Harder to implement, we'll have to simulate any reactions from another object colliding with us ourselves.

Player collisions with brushes/other physics ents are partially broken!

Origin of problem: CPhysicsCollision::TraceBox

Happens when the ray is a box, the trace from the game goes into the engine with a -2 z offset on the delta, and the engine calls TraceBox with a zero trace delta. This means the trace will NEVER hit anything in vphysics.

Old vphysics apparently has a check for zero ray delta, but I don't entirely understand how the code works. (trace.cpp line 597)

Implement ConvexVolume/ConvexSurfaceArea

Garry's Mod kills any collision meshes that have a volume of 0, so we need to return a real volume! I was going to use QHull for this, but need to look at other libraries too.

Objects collide with internal edges of other objects

Contact normals are generated with internal edges in a direction against the direction of velocity.

(Blue=velocity, Red=contact normal)
internaledge
(Picture credit: Erwin Coumans GDC10)

btInternalEdgeUtility was added to bullet to deal with this problem, I need to incorporate this into the collision detection pipeline.

Custom PhysicsInit & CollisionBounds Ents Fall Through World

Setting a custom PhysicsInit and CollisionBounds on and entity will cause the entity, once touched with the physgun, to fall through the world, as it touches the world it voilently "spazzes out" as it slowly falls through the world geometry

LUA to replicate:
function ENT:Initialize()
self:PhysicsInit( SOLID_VPHYSICS )
self:SetMoveType( MOVETYPE_VPHYSICS )
self:SetSolid( SOLID_VPHYSICS )
local min = self:OBBMins()
local max = self:OBBMaxs()
self:PhysicsInitBox(min,max)
self:SetCollisionBounds(min,max)
end

RecheckCollisionFilter should delete any manifolds that are now between objects that can't collide

Should "fix" nocollide stool and possibly other things. Manifolds between objects exist as long as their AABBs overlap, and they contain all of the collision points between the objects. CCollisionSolver is ONLY queried when creating manifolds, not new contact points!

However, the fix is not easy. Collision algorithms like to hold on to their manifolds and try to release manifolds that are no longer being tracked by the dispatcher.

Workaround is to separate their objects so their AABBs no longer overlap for the changes to take effect.

Undoing nocollide is broken however, the game's collision solver returns false. Apparently the game never removes the object pair from CPhysicsObjectPairHash? Confirmed to be broken in normal vphysics too.

Spring damping not set up

Spring damping is completely broken, does not do anything. Dont understand why as nothing looked changed in Physics_Constraint. Must be something changed on the backend of things?

Player Controller Movement Issues

When the player is on a physics object that isn't seen as "rideable physics" (object with a mass > player controller mass * 2) the player will slide around on the object and off of it!

  • Appears to be some sort of circular inclusion of velocity. VPhysics reports back a velocity to the game, the game amplifies this velocity and it goes back into VPhysics.

Also the player can't jump off of physics objects.

Random crashes on object deletion

Creating many objects until the linux server lags and removing them one by one may not actually remove them from the active object list in CObjectTracker. Appears to be a bug with CUtlVector, but there is no code that allows it to abort deletion! In addition, FindAndRemove returns true, as if the object was found and deleted. But a subsequent call to Find says that the object was found in the vector.

Creating a constraint and then deleting it may cause a crash - unknown when it happens.
Usually happens after a while of playing (maybe 5 min) and I have been deleting/creating many constraints before the crash trying to reproduce it.

According to linux build, crash happens in PhysFrame, after getting the active object list and calling a function on a deleted object.

6DOF +/- 90 degree limit on y-axis

Due to the fact that the 6dof constraint uses euler angles internally, this imposes an arbitrary limit on the y-axis to +/- 90 degrees. Need to change the internal math to use other methods such as quaternions.

Ray traces of length 0 are currently unsupported

These are used by the game to determine if you're stuck inside of an object, also probably causes the skybox to not be rendered if you're inside of an object.

Will have to look at this inside of bullet's continuous convex collision class as well, as this isn't supported there either.

Constraints are too strong in HL2 maps

Testing with HL2 Single Player, the turnstile on d1_trainstation_01 cannot be walked through, Also, cans cannot be picked up.

I propose using the HL2 SP campaign as a feature test against Havok.

Collision mesh utilities (creation/exporting)

In order to become a full replacement, VPhysics needs to support collision mesh creation, manipulation, and mesh exportation.

  • To achieve mesh manipulation, qhull must be used (bullet doesn't support this stuff I don't believe)
  • New file format must be created for mesh exportation. Will allow for new features such as directly supporting raw convex shapes such as cylinders, spheres, etc.

Able To Physgun Objects Through Anything Immobile

You are able to take any object that can be picked up with the physgun and move it through another object that is currently frozen as well as the world geometry itself, the object is constantly being 'pushed' out of the other object instead of blocking the held object from entering the other, this leads to the inability to effectively build in a variety of ways.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.