Would it be possible to do this with an animation?

Started by Circusbrain, May 07, 2014, 10:05:18 AM

Previous topic - Next topic

Circusbrain

I was wondering if a model in the source engine could have essentially 2 textures, 1 on top of the other and based on animation you show/hide the appropriate "skin" as a result. The goal was to have a decapitation animation with actual head removal while playing with the custom model as your default. I've gone so far as to replace a dead ragdoll on death with a headless ragdoll body and it's head but the ragdoll itself takes up a lot of network overhead. If the player were playing with the model and it's "custom" death animation played out for specific weapon deaths that would take out the need for killing the entity and replacing it with a prop_ragdoll. I just don't know that the source engine is robust enough to have a model that can detach a piece and maintain physics, etc. Or, if you'd have to play with a head that is already detached, but set to the body as a parent entity, then detach on specific death.

Just really spit-balling this at the moment.

wallworm

Welcome to WW. I'm sorry I didn't respond to the email you sent earlier... I am not always as fast at going through my email as the forums... as often I get a lot of the same questions over and over and over...

Regarding the textures on top of the other... this is dependent on the shader. I believe that I've seen $basetexture2 mentioned in places regarding models, but it's not something I've had experience with and have certainly not added that into WW. It might require a custom shader, which is not really possible to insert into an existing game on the fly (to my knowledge). If that is what you are asking, then I'd say it isn't generally feasible unless you are in control of the mod.

If you are talking about simply changing the skin texture, this is very simple. You just have two texture skins which you can make easily with WW. This can be controlled with entity I/O.

Regarding the prop part swapping, this is a question better answered by others who probably have more experience playing with player models. I think your best bet is for K@rt or Joris to jump in. They've probably tried more of these kinds of things via scripting entities. I'm certain this is possible and a viable option, I just haven't done it.

Joris Ceoen

Quote from: Circusbrain on May 07, 2014, 10:05:18 AM
I was wondering if a model in the source engine could have essentially 2 textures, 1 on top of the other and based on animation you show/hide the appropriate "skin" as a result. The goal was to have a decapitation animation with actual head removal while playing with the custom model as your default. I've gone so far as to replace a dead ragdoll on death with a headless ragdoll body and it's head but the ragdoll itself takes up a lot of network overhead. If the player were playing with the model and it's "custom" death animation played out for specific weapon deaths that would take out the need for killing the entity and replacing it with a prop_ragdoll. I just don't know that the source engine is robust enough to have a model that can detach a piece and maintain physics, etc. Or, if you'd have to play with a head that is already detached, but set to the body as a parent entity, then detach on specific death.

Just really spit-balling this at the moment.

Hello Circusbrain,

There are 2 main options for you to look at depending if it's in Singe Player or Multiplayer:


  • If you are doing this in Multiplayer, as you said there's gicantic network overhead. Now this depends on how the server will handle the physics. The server I usually play on, which is called PlagueFest for zombie escape has written a plugin that nearly eliminates the overhead, however as a result the movements of the ragdoll are in packets like as if it is having lagg without causing the network overhead (the coder is a genius and has written tons of plugins. In fact he is working on a complete standalone Zombie Reloaded that won't use the initial SourceMOD so he writes it entirely from scratch for plenty of amazing effects and improvements!). The best solution in this case would be using an animated prop_dynamic and completely eliminate the physical simulation if your intention is for the map to be played on any server. That being said, there has to be a considerable amount of players playing before the network actually starts interfering, though nowadays most server do have a lot of players.
  • In single player you should be able to achieve this with gibs. TF2 has loads of gibs on each of the playermodels so in any case Source is built to support this very well. The problem is that this is linked to playermodels so I don't know to which extent you can use this on a normal custom model. I know that prop_physics can have as many gibs as you want (you can in fact add the breakable model as a gib and endlessly spawn news gibs that will spawn that same gib again over and over again, until your computer crashes. It's fun to do but don't add something like this in the map!). If you could find somewhere if you can also use prop_ragdolls with gibs, then there should be your answer. https://developer.valvesoftware.com/wiki/Gibs has a description of how to code this but I don't think this is what you need (especially when half of it is in Russian).

So, when looking at this page: https://developer.valvesoftware.com/wiki/Creating_custom_gibs it says that "By default, a model whose propdata allows it to break when its health reaches zero, will spawn a bunch of generic gibs according to its base_type material."

So far I only have experience with prop_physics that have $collisionmodel and as such move with one collision block inside the world when being shot (such as a barrel or a crate, or a window breaking in multiple parts). I don't know if you can actually use $collisionjoints (used for a ragdoll or prop_dynamic) on a model for a prop_physics with custom gibs, but I don't see why it couldn't. It's something that I'm going to have to test with a rather basic model. I'll let you know how it fares.

It's actually an interesting situation to look at as this could achieve even more interesting results in terms of ragdolls, but I'm sure there isn't a clear explanation on this subject for games like CS:S or multiplayers except TF2 so we're gonna have to find out!

Lastly, regarding your texture issue, this is no problem with gibs as any spawned gib that should appear after breaking the initial model can contain any texture they'd like (so no $basetexture2 necessary). So if you wanted the head to contain blood spots after being decapitated, you could do this with a new texture on what would be the headgib.

Useful links:

https://developer.valvesoftware.com/wiki/Creating_custom_gibs
https://developer.valvesoftware.com/wiki/Prop_ragdoll
https://developer.valvesoftware.com/wiki/Prop_physics
https://developer.valvesoftware.com/wiki/Propdata

Let me know if you can find something out of this!

K@rt

Jori seems to know more about this suject than I do certainlly. When reading your post my first thought was of the progressively breakable door models you see in L4D2 and CSGO. Each time the door breaks the model falls back to a more damaged version of itself and spawns one or multiple gibs. If you could adapt the system to apply to characters, the main charcater model could fall back to character-model-minus-head which would still be fully dynamic model capable of playing one of a number of death animations, and the head could simply be spawned as a prop_physics gib to roll off and interact with the world however it wants to. As Jori said, these fall back models can have completely different skins to the original model, which eliminates any problem there. However achieving this may require the creation of new prop_data parameters as I don't know if the existing ones would allow for this setup.

In qucik answer to your question, I have no doubt that what you want to do CAN be done in Source, however whether current official versions of the engine/game are setup to make it practical, I am not sure.

Circusbrain

Right, so... this is for multiplayer, for CS:S. I think the original fella that built the models recognized the model issues since you cannot spawn a death ragdoll, you can only eliminate the entity and spawn a prop_ragdoll, OR, you can, at some point "re-skin" a model based on an event, he was doing it upon a certain amount of damage, and simple re-skinning the clients body, and spawning a head.

Regardless, his models seem to have some kind of conflict with the existing version of CS:S or with being a ragdoll as they have an extra attachment point and some issue with dumping an error that locks up/crashes the server "CRagdollProp::CreateObjects: Couldn't Lookup Bone phymodel_head
Bad vphysics swap for prop_ragdoll"

Original mod/models (https://forums.alliedmods.net/showthread.php?p=712666)

That physics piece is ONLY mentioned in the heads, meanwhile I was only spawning the bodies, so, who knows why that's happening, I don't but, I agree that this should be possible, and, using the gibs "system" should work in taking damage X and updating the model accordingly. The idea was on a knife kill, the head comes off the shoulders as it's own entity with it's own physics. On a headshot, the head is completely obliterated. So, either way the body that is left after either of these 2 kills is the same, but 1 gets a head. Seemed simple enough and using my code with his models worked, but, eventually crashes the server with that error. Completely sporadically too, can run for 5 hours or 5 minutes but it WILL crash.

It's more an issue with the models than anything I suppose as that's what's seemingly causing the crash. But, because I really wanted the death to be seamless ideally the player is playing with the model that will have these added death animations/options so no swapping is required and no overhead is added. Heck, even have the model put it's hands up to it's neck as the head comes off.

Circusbrain

I got the models working but am still curious if I could make an animation where a model loses a body part?

wallworm

I don't have the answer directly because I have done very little with player characters... and they likely have more rules regarding what you can/can't do depending on the mod.

If I were to experiment, I'd look into binding an Activity to a sequence if one is relevant.

You might also experiment with the logic_playerproxy and see if you can trigger a specific animation or change bodygroups.

I'm just throwing these out there... as they may be dead ends.

SMF spam blocked by CleanTalk