Download

Wanting to do something a bit different with the Physics Simulation.

I’ve been looking through the source lately wondering if I’d be able to use the engine to implement a game idea I had a few years back that relies on special handling of physics. I tried implementing the idea in Cryengine a few years back to moderate success, but wasn’t able to finish and consolidate everything I had done due to the closed source nature of that engine’s physics library.

The game I’d like to make is space-inspired. Existing code in various engines treat that idea as mostly all or nothing relying on sci-fi aspects like artificial gravity zones amongst a microgravity area as a way to design a game. What I’m looking to do is treat a blank Unreal level as a microgravity physics set where entities within that level create or interact with unique physics subsets. Gameplay is derived from actions within those subsets and moving from one subset to another.

From what I found trying this out with Cryengine, the easiest way to program this was to let an individual game object keep track of what it should be doing according to the rules of the physics subset it thought it should belong to. On that object’s update each frame, I tested to see if it should remain in that subset or transition to another. Depending on that test’s results some generic physics calculations determined where that object should be during the current frame and used whatever workaround I had (generally teleportation just to visualize the mechanic and ensure it was being calculated the way I expected) to update the object’s position.

In a pure simulation sense, it doesn’t make much sense to allow a game object to figure out where it should physically be, but I also needed this information for the game object to perform its function as part of the game. For instance, if an actor suddenly found itself under gravity on a planetoid of some sorts, the actor could start playing a [tumble] animation while orienting its skeleton to the newly perceived up vector. I’m sure that with enough thought and experimentation that a faster engineering design could be worked out, but that’s not really the bit I’m interested in at the moment.

The thing that kept me from finishing the design was that Cryengine’s physics library was closed source and I was only able to control simulated objects in a way that Crytek assumed a game would need. Looking at Unreal’s source and reading up on some answer hub questions suggest that I would run into the same kind of problem with PhysX. However, even though Unreal 4 uses the PhysX library to crunch numbers, I see that there’s source code I could possibly override or hook into. Is anyone familiar enough with the physics code to know if what I’m wanting to do is possible or is the implementation essentially just wrapper code translating typedefs?