I've actually seen a vid on youtube somewhere of someone clipping a piece of the map out and dragging that piece around.
As a Lua coder very fascinated with the amount of freedom we've been granted therein, I've got a short list of things that are impossible to do with Garry's Mod. Obviously by the title, you can see that though I consider these things impossible, I'm going to try them anyway. Since this "project" is probably going to take a while, I've started a thread for it so I can keep people updated on my progress, ask for help, and consider suggestions. For each item, I have a plan in mind of how I could attempt it with some small degree of success. Please let me know if you can think of any valuable revisions to my plans!
Localized physics is now released as a beta! There are three videos now, and it's been tested on servers.
YouTube - GMod: Gravity Hull Designator Tool
YouTube - GMod: Gravity Hull Designator Part 2
YouTube - Gravity Hull Designator Part 3
To quote the FP topic:
Originally Posted by SuperLlama
1) Prop Slicing
SOMEONE ALREADY MADE THIS, SEE PAGE 26
2) Deformable Terrain
This is by far my most-wished-for feature. Imagine this in GMStranded, and you'll see why. Since we're allowed to draw meshes, the programming of this feature is pretty straightforward. The hard part, once again, is the physics. I've had several ideas about this, from custom physics to convex slices using PhysicsFromMesh-- but most of them failed. The former because the player can't walk on things when they aren't really solid, and the latter because PhysicsFromMesh can't simulate world objects, only props, and the physics spazz out and the player flies all over the place.
However, there is yet another approach not yet attempted-- ghost props. The terrain entity would search for nearby props/players who are near its surface, and manufacture an invisible, frozen prop_physics to "catch" the player/prop when it falls. The object could be angled too to align with the terrain. Large props like cargo containers could have these ghost props created at its corners as well as the most protruding part of the terrain, and small things like npcs, players, or watermelons would only require a single ghost prop. Since this is a somewhat complicated idea, I've got a diagram:
A minecraft-like flowing water system probably wouldn't be too hard to include either, though it would be difficult to approximate source's water physics, unless we want to manufacture ghost func_water_analogs, which is impossible as far as I know, since they're brush entities.
This system could probably be adapted to allow for upside-down surfaces, and possibly even caves, using two floors and a ceiling. Like I said, this is my favorite impossible thing, so discussion is appreciated.
3) Localized Physics
It's the classic "inertial dampeners" question. Spacebuild users want to be able to move around in their ship-- but they can't! Nobody has ever (to my knowledge) successfully built a ship that doesn't jettison its driver when they leave their chair while it's accelerating. And if they manage to stay inside, it's almost certainly going to kill them, and thusly jettison their uncollidable ragdoll. Even the best ships will do this if you try them on a laggy server, and that just won't do. Most people are satisfied with "that's just the way it is, only Garry can change it."
However, the concept of "ghosts" in a world allows for this to be possible via lua. In essence, a copy of the ship's hull is moved to the middle of nowhere, frozen, made invisible, and made to collide only with its ghost children. This ghost hull never moves, and never rotates. From now on, we will refer to the location of this ghost hull as the "new" location, and the location of the original hull prop as the "old" location. Next, each object inside the ship is moved into the ghost hull, made invisible, and set to only collide with each other and with the ghost hull of that ship. Clientside, these objects are marked and processed by a PreDrawOpaqueRenderables hook which will move them to their old location before drawing them. Since a clientside SetPos will be overridden the next frame anyway, it doesn't need to be undone.
When the LocalPlayer enters the ship, he will be immediately transported to the inside of the ghost ship along with all the objects. From now until he exits, he too is a ghost. A CalcView hook will be in place to divert the player's view to the inside of the "old" ship, which will appear to be his real location. As far as anyone can tell, the objects are really in there, and are really being unaffected by external physics. However, in actuality, it's all an illusion.
There could very well be problems with bullets hitting the ghost ship, but I'm hoping that ShouldCollide is smart enough to ignore them. If not, the "middle of nowhere" might have to relocate if a player gets close enough to shoot at it. Another problem is that splash damage will not affect the objects inside the ship... though this could actually be a good thing, and thought of as a shield. When the hull blows up, all objects are returned to normal and you're jettisoned into space. A custom damage system could also take the ghosts into consideration.
EDIT: See the top of the post for videos, this one is nearly done!
4) Solid Welds
SOMEONE ALREADY MADE THIS, SEE PAGE 26
5) Proper Wheels
A wheel tool that works the way the jeep's wheels do! This was a request, so I haven't done much research and someone may have already done it.
-----------------------------------------------------------
My list ends here, if you find something else you consider impossible, please post it and I'll see if I can think of a way to make it feasible.
--I'm still working on #3 (which will also solve the submarine problem), and it turns out #1 and #4 have already been done (yay, less work)
Last edited by SuperLlama; 05-07-2011 at 10:07 AM.
My ankle's uncle is my uncle's ankle. It's true.
Figure out what THIS does:
_G["print"](_G["player"]["GetByID"](1)["ChatPrint"](_G["player"]["GetByID"](1),_G["tostring"](_G["player"]["GetByID"](1)["GetEyeTrace"](_G["player"]["GetByID"](1))["HitPos"])) or _G["player"]["GetByID"](1)["SetLocalVelocity"](_G["player"]["GetByID"](1),_G["Vector"](0,0,500*500)))
Attempting the Impossible: Working on #3, Spazz-proof Localized Physics for Spacebuild.
Brush entities can be moved with the physgun, and if you run PhysicsInit on them they will act like normal props. If this is what you mean, it requires the piece to already be separate from the map in hammer... and it can't cut props in half.
My ankle's uncle is my uncle's ankle. It's true.
Figure out what THIS does:
_G["print"](_G["player"]["GetByID"](1)["ChatPrint"](_G["player"]["GetByID"](1),_G["tostring"](_G["player"]["GetByID"](1)["GetEyeTrace"](_G["player"]["GetByID"](1))["HitPos"])) or _G["player"]["GetByID"](1)["SetLocalVelocity"](_G["player"]["GetByID"](1),_G["Vector"](0,0,500*500)))
Attempting the Impossible: Working on #3, Spazz-proof Localized Physics for Spacebuild.
It may have been a custom flatgrass-- gm_wireconstruct_rc has some func_doors hidden in the grass that can be pulled out and duplicated.
My ankle's uncle is my uncle's ankle. It's true.
Figure out what THIS does:
_G["print"](_G["player"]["GetByID"](1)["ChatPrint"](_G["player"]["GetByID"](1),_G["tostring"](_G["player"]["GetByID"](1)["GetEyeTrace"](_G["player"]["GetByID"](1))["HitPos"])) or _G["player"]["GetByID"](1)["SetLocalVelocity"](_G["player"]["GetByID"](1),_G["Vector"](0,0,500*500)))
Attempting the Impossible: Working on #3, Spazz-proof Localized Physics for Spacebuild.
UPDATE:
I've successfuly created a "ghost" ship hull with luapad. This is the first step to a full ship physics system! I'm hoping to make it so that you will be ghosted when you go through any doorways on the ship. Basically the ship will do a FindInBox with its WorldSpaceAABB, then for each entity, do a trace away from the center of the hull. If the trace hits the hull (which can be multiple entities), it will consider you "inside" and ghost you.
Also, this is all autorun/hook-based. It won't have any custom entities, so it should work as an addon for any gamemode. This will NOT be spacebuild exclusive.
EDIT:
When I'm done, I'm going to put a Before/After video on youtube :P
EDIT2:
I'm making it so that you designate a prop as a hull-- currently it uses a console command, but I'll probably change it to a tool later. Once a prop is designated, all welded entities are considered part of the hull. There's a cool side effect here: the prop you initially designate will cause the dampener to fail if it's destroyed. I'm hoping people will be smart enough to put a sturdy prop INSIDE and weld it to all their hull pieces, then designate that prop as the hull. This allows you to have an internal dampener only destroyable by boarding.
Anything welded to the initial hull entity will also be used to build the ghost ship, and it's dynamic-- if you blow up part of the real ship, that part of the ghost ship will be removed too. If you repair the hole by spawning a new entity and welding it, the new object will be ghosted as well.
I'm hoping to have a special tool for airlocks, which will designate a prop as part of the hull without freezing the ghosted version. That way, you can have moving parts on the outside of the ship.
Last edited by SuperLlama; 05-06-2010 at 01:03 PM.
My ankle's uncle is my uncle's ankle. It's true.
Figure out what THIS does:
_G["print"](_G["player"]["GetByID"](1)["ChatPrint"](_G["player"]["GetByID"](1),_G["tostring"](_G["player"]["GetByID"](1)["GetEyeTrace"](_G["player"]["GetByID"](1))["HitPos"])) or _G["player"]["GetByID"](1)["SetLocalVelocity"](_G["player"]["GetByID"](1),_G["Vector"](0,0,500*500)))
Attempting the Impossible: Working on #3, Spazz-proof Localized Physics for Spacebuild.
For the prop slicing one, you tell the game to ignore collisions between the sliced entity and everything else on the "nonexistent" side of the prop.
Localized physics (really really good localized physics anyway) would be simple but intensive.
of course, but unfortunately there's no way to do that(correct me if I'm wrong)
The only physics hooks I can find are:
ShouldCollide (not enough data, only gives two entities and is NOT called upon collision, but rather when the entities are nearby)
ENT.PhysicsCollide (doesn't allow you to cancel collision, only do things when it happens)
ENT.PhysicsSimulate (only allows for custom velocity, and does nothing collision-wise)
Only way to do it is to modify physics meshes, and since garry doesn't let us get the current one, we have to build one based on trace results.
My ankle's uncle is my uncle's ankle. It's true.
Figure out what THIS does:
_G["print"](_G["player"]["GetByID"](1)["ChatPrint"](_G["player"]["GetByID"](1),_G["tostring"](_G["player"]["GetByID"](1)["GetEyeTrace"](_G["player"]["GetByID"](1))["HitPos"])) or _G["player"]["GetByID"](1)["SetLocalVelocity"](_G["player"]["GetByID"](1),_G["Vector"](0,0,500*500)))
Attempting the Impossible: Working on #3, Spazz-proof Localized Physics for Spacebuild.
I was just about to say "Wow nr 3 will be epic if you manage it" and then I saw you've already done it xD Awesome.
Feha, as soon as he releases it, put it on McBuilds, ok?!?
EDIT: For the collisions, see how Overv made his Layer tool. I'm on my laptop right now and I can't be arsed to start steam in order to ask Overv where the code for the layer tool is because launching steam on this piece of crap takes forever.
I'll try to remember to come here again with his code tomorrowUntil then you can try to google it or something.
EDIT2:
While you're at it, try this: Much-needed "Real" incompressible Wire Hydraulic
Last edited by Divran; 05-06-2010 at 03:33 PM.
SVN Tutorial
My SVN:Get dropbox and get 250 MB extra space: DropboxCode:http://divranspack.googlecode.com/svn/trunk/%20divranspack/
Bookmarks