Jump to content

Future of 3D model / animation modding


lemmy101

Recommended Posts

Hey all. Just cause it's all current news with the Mondoid, and cause it excites me, here's a bit of info on the new animation system.

 

First here is the video from the Mondoid again:

 

 

Here is an XML file that is (minus the new anim system and anims themselves) responsible for 99% of what was in the video, to show how easily such stuff can now be set up.
 

<AnimStates>	<ZombieToOnFloor>		<Commands>					<PlayAnim Anim="Zombie_Death" Repeat="0" SpeedDelta="0.8" CanCancel="false" BlendTime="0.0" />		</Commands>		<Out>			<ZombieToCrawl/>		</Out>	</ZombieToOnFloor>		<ZombieToCrawl>		<Commands>					<PlayAnim Anim="Zombie_DeadToCrawl" Repeat="0" SpeedDelta="0.4" CanCancel="false" BlendTime="0.0" />		</Commands>		<Out>			<ZombieOnFloor/>		</Out>	</ZombieToCrawl>		<ZombieOnFloor>		<Commands>					<PlayAnim Anim="Zombie_Crawl" Repeat="-1"  SpeedDelta="0.4"  BlendTime="0.0"/>		</Commands>	</ZombieOnFloor>		<ZombieWalk>		<Commands>					<Blend1D Var="MoveDelta" Min="0" Max="1" Repeat="-1" CanCancel="true">				<Entry Anim="Zombie_Idle" Val="0.0" SpeedDelta="0.4" />				<Entry Anim="Zombie_Walk2" Val="0.25" SpeedDelta="0.8" />				<Entry Anim="Zombie_Walk3" Val="0.5" SpeedDelta="0.8" />				<Entry Anim="Zombie_Walk4" Val="1.0" SpeedDelta="0.8" />			</Blend1D> 		</Commands>		<Out>			<NormalMovement IsZombie="false"/>		</Out>			</ZombieWalk>	<NormalMovement>		<Commands>					<Blend1D Var="MoveDelta" Min="0" Max="1" Repeat="-1" CanCancel="true">				<Entry Anim="Bob_Idle" Val="0.0" SpeedDelta="1.0" />				<Entry Anim="Bob_Walk" Val="0.5" SpeedDelta="1.0" />				<Entry Anim="Bob_Run" Val="1.0" SpeedDelta="1.0" />			</Blend1D> 		</Commands>		<Out>			<Aiming IsAiming="true"/>			<ZombieWalk IsZombie="true"/>			<ZombieToOnFloor IsZombieOnFloor="true"/>		</Out>	</NormalMovement>	<Aiming>		<Commands>					<Blend2D VarX="DeltaX" VarY="DeltaY" GridWidth="5" GridHeight="5" CanCancel="true">				<Entry X="2" Y="2" Anim="Bob_IdleAimHandgun" />				<Entry X="1" Y="2" Anim="Bob_StrafeAimHandgun_Left" />				<Entry X="3" Y="2" Anim="Bob_StrafeAimHandgun_Right" />								<Entry X="2" Y="1" Anim="Bob_WalkAimHandgun" />				<Entry X="1" Y="1" Anim="Bob_WalkAimHandgun_DiagL" />				<Entry X="3" Y="1" Anim="Bob_WalkAimHandgun_DiagR" />				<Entry X="1" Y="3" Anim="Bob_WalkBwdAimHandgun_DiagL" />				<Entry X="2" Y="3" Anim="Bob_WalkBwdAimHandgun" />				<Entry X="3" Y="3" Anim="Bob_WalkBwdAimHandgun_DiagR" />						</Blend2D>		</Commands>		<Out>			<NormalMovement IsAiming="false" IsMoving="true"/>			<ZombieWalk IsZombie="true"/>		</Out>	</Aiming>	</AnimStates>

So the new system basically takes care of itself. Instead of the game needing to tell the 3D model what animation its supposed to be playing, we have animation states which can branch into each other using logic defined in the XML.

 

instead the game sets parameters in the animation player in lua/java like:

character:getAdvancedAnimator():set("IsAiming", true);

By doing this, if there are any Out tags for the current state the character is in, where the variable states in the animator match the required states specified by the out tag, it will make the animator switch to that state. 

 

Blend1D and Blend2D are two ways to allow numerous animations to blend between eachother based on float variables passed into the state. For example the Blend1D  for ZombieWalk will set up various animations that will all play simultaneously, and by feeding in the amount the player is pushing forward on joypad or with the mouse, will pass in a number between 0 and 1. It will then calculate a blend between the animations specified in the Blend1D, so if the player is holding left thumbstick 75% of the way forward, that will translate to 0.75 and tell the character to play a blend halfway between Zombie_Walk3 and Zombie_Walk4. This is why the characters can smoothly blend between two anims and provide the appearance of an intermediate animation half way between them.

 

Blend2D works in a similar way with a 2D grid, where anims can be placed in any grid point of the grid, and say 8 directional anims and an idle anim can be blended together based on the position of two axis (this is how the aiming works for e.g. sending in a DeltaX / DeltaY that corresponds to left thumbstick, rotated by the right thumb stick's aim direction, where 2-2 is the centre of the grid corresponding to the idle)

 

I just hooked in a few joypad buttons to set IsZombie and IsZombieOnFloor to true while they are pressed, and that is responsible for switching to the zombie anims toward the end.

 

Finally, all the movement of the characters is specified directly in the animation now, so just by playing an animation the character will move. And if you blend 50% between an idle stationary anim and a walk, the character will automatically move half the speed they would if the walk was playing completely. This is why foot slip is a thing of the past, since the character speed is always correct no matter how many anims are blended together or how fast said anims are playing.

 

 

Models / Anims

 

We are currently exploring new file formats, based on Jab's suggestion, that will make exporting new character models and anims a lot easier. There are complications in the sense that the old 2D sprites will not exist for any new models or animations, and that is something we will need to figure out. 

 

So yeah, basically a whole bunch of stuff coming, and once we get the tools out there hopefully people can start adding anims, even models, to their mods. Still some way off yet though, lots to do. This system took a whole bunch of time and there's more to come.

 

Hope someone finds this interesting :)

 

(Also you notice this all being joypad heavy - still work to do to get all this working with key/mouse controls. Joypad just quicker for me to get it all in but don't worry key/mouse is not forgotten :D)

Link to comment
Share on other sites

lemmy101

 

 

Will there crawling animations for players? and while there be an inured look if the players state is in bad shape? :D

 

Yup :) Anims already exist. When they go in is another matter.

 

 

Lemmy101, is it possible for you to list the animations that are changing? I was hoping to dig through the list to see if there were things like sitting, laying down, visible backpacks, etc. Only if it doesn't take much effort for you to do so though!

Link to comment
Share on other sites

This is great news! (And more of a reason to complete my Blender import / export.) 

 

One thing I might mention though:

It isn't a bad thing to make your own format. The best thing is to have a format that has all the data you need, and is optimized for size and distribution. I've seen multiple custom formats that fare quite well in the designed engines they run in.

 

The problem that Project Zomboid has (that you specified dealing with sprites and custom animation setup) is just growing pains for unexpected needs that the current format does not really help with. If the Quake MD5 format, or other formats do not suit your current needs, It wouldn't be bad to consider writing your own format. (documentation or example code or explanation would help.) 

Link to comment
Share on other sites

Any hint on how you guys are going to solve the movement speed control with keyboard\mouse? Is it going to be more Static speed values tied to pressing\holding certain keys or something to the effect of the further the mouse cursor is away the faster you go (or both as options) or do you have something completely different in mind?

Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...