Page 1 of 1

Character/creature config files

Posted: Fri Aug 07, 2015 10:01 am
by Regalis
Currently the only way to edit creatures or add new ones is by editing the .xml files in "Content/Characters". There will be a proper in-game character editor at some point, but in case someone wants to give a shot at editing the files manually, here's a description of the format of the config files and a list of elements/attributes that can be used in them:

Code: Select all

New creatures can be added by creating a new folder in the Content\Characters\ 
folder and adding an .xml file inside the folder to configure the creature.

The .xml file should be formatted in the following way:
<character name="something">
	<ragdoll attribute1="something" attribute2="something">
	
		<limb id = 0>
			<sprite texture="texturepath" sourcerect="0,0,width,height"/>
		</limb>
		
		<limb id = 1>
			<sprite texture="texturepath" sourcerect="0,0,width,height"/>
		</limb>
		
		<joint limb1="0" limb1anchor="x,y" limb2="1" limb2anchor="x,y"/>		
	</ragdoll>
	
	<ai attribute1="something" attribute2="something"/>
</character>

-----------------------------------------------------------------

Elements:

Character:
	- has to be the root element of the file

	Attributes:
		name: the name of the creature
		humanoid: true/false, if set to true the character is animated using 
			a bipedal animator (like humans)
		needsair: true/false, does the character drown/suffocate without 
			oxygen (false by default)
		drowningtime: how fast the character drowns (in seconds)
		health: self explanatory (100.0 by default)		
		
Ragdoll:
	- has to be a child element of the character element
	
	Attributes:
		headposition: how high from the ground the head of the character should 
			be when the character is standing (50.0 by default)
		headangle: an angle which the head is rotated to when the character is walking
			(0.0 by default, meaning that the head will face straight forward)
		torsoposition: same as headposition but for torso (50.0 by default)
		torsoangle: an angle which the torso is rotated to when the character is walking
			(0.0 by default, meaning that it will face straight forward)
		waveamplitude, wavelength: if the character is not a humanoid, it will 
			do a "wave-like" swimming movement with the selected amplitude and 
			wavelength. To put it simply, amplitude affects how large up-and-down 
			movement the character will do and wavelength affects how fast the 
			character does the movement (both 0.0 by default)
		flip: should the entire character be "mirrored" over the y-axis when it
			switches its movement direction from left to right or vice versa, 
			or should it just rotate 180 degrees along the z-axis (false by default)
		walkspeed, swimspeed: how fast the character should move on land and 
			in water, (the actual speeds are also affected by the weight, shape 
			and steerforces of individual limbs) (both 1.0 by default)
		swimspeed: how fast the character should move in water
	
Limb:
	- an individual part of the ragdoll
	- has to be a child element of the ragdoll element
	
	Attributes:
		id: an integer that is used to distinguish between limbs when connecting them
			with joints. The first limb should have the id "0", the second "1" and so on.
		radius, width, height: used for setting the dimensions of the physics body 
			of the limb. If only radius is set, the limb will be a circle with 
			the selected radius. If width and height are set, it will be a rectangle. 
			If radius and height are set, it will be a capsule.
		density: the mass of the limb will be area_of_the_limb * density (default 10.0)
		friction: the friction coefficient of the limb (0.3 by default)
		flip: true/false, if set to true the limb will be "flipped" from one side 
			to another when the character turns around (as in, if a character is 
			facing left and has an arm extended left, the arm will be extended 
			to the right when the character faces to the right) (false by default)
		ignorecollisions: true/false, should the limb collide with walls (true by default)
		impacttolerance: if the limb receives an impact larger than this value, it takes 
			damage (20.0 by default)
		type: determines how the limb should be animated and what kind of items can be 
			equipped on the limb. Can be set to None, LeftHand, RightHand, LeftArm, 
			RightArm, LeftLeg, RightLeg, LeftFoot, RightFoot, Head, Torso, Waist, Tail, 
			Legs, RightThigh or LeftThigh
		pullpos: when animating the character, forces will be applied to this 
			point of the physics body of the limb. Defaults to "0.0, 0.0" which 
			is the center of the limb.
		refjoint: index of the joint that is used as the "center point" along 
			the x-axis when doing a walking animation. For example, if the joint 
			between a characters thigh and  waist is set as refjoint, the feet of the 
			character will be moved directly under said joint when the character is 
			standing still.
		steerforce: how much force is applied to the limb when the character moves (0.0 by default)
		armorsector: an armored sector between two angles (in degrees). For example,
			-90,90 would make the front sector of the limb armored (0.0,0.0 by default)
		armor: how effective the armor is: damage is divided by this value if an attack hits the
			armored sector (1.0 by default)
		
Sprite:
	- a child element of a limb element
	
	Attributes:
		texture: file path of the texture
		sourcerect: which part of the texture should be used. If either width or 
			height are 0, they will be set to the width or height of the texture. 
			(0,0,0,0 by default)
		origin: what point in the sprite is considered the "middle point". "0,0" 
			is the upper left corner of the sprite and "1,1" the lower right 
			corner. ("0.5, 0.5" by default)
		depth: Affects the order which sprites are drawn in. Sprites with a 
			depth of 1.0 will be drawn under sprites that have the depth set 
			to 0.9 for example. Note that setting several limbs to the same 
			depth value may cause them to "flicker" on top of each other, so 
			it's recommended that every sprite has a slightly different depth.

Attack:
	- a child element of a limb element
	
	Attributes:
		type: affects the logic for moving the attacking limb. At the moment the only
			types are None, PinchCW and PinchCW

			PinchCW: the limb rotates clockwise when attacking (or counter-clockwise 
				if the character is facing left). Useful for attacks like biting 
				or slashing
			PinchCCW: the same as PinchCW, but in the limb is rotated in the 
				opposite direction

		damage: damage done to other characters (0.0 by default)
		bleedingdamage: how much the attack affects the bleeding rate (0.0 by default)
		structuredamage: damage done to structures (0.0 by default)
		stun: how long the target is stunned (in seconds, 0.0 by default)
		range: how close the limb doing the attack has to be to the target to do damage
			(0.0 by default, but should be set to a higher value or otherwise it
			will only do damage if the limb is exactly at the position of the target,
			so practically never)
		duration: how long the attack lasts - if set to zero, it will be a "one-hit"
			attack, otherwise it will be active for a while and the damage values
			will be damage per second
		priority: can be used for adjusting how likely the character is to use specific
			attacks. For example, if a character has two attacks, first one
			having the priority 2.0 and the second 1.0, the character is twice as
			likely to use the first one.
		
Joint:
	- a revolute joint connecting two limbs to each other
	- a child element of the ragdoll element
	
	Attributes:
		limb1, limb2: thes id of the limbs that should be connected
		limb1anchor, limb2anchor: the points where the joint is attached to on 
			the limbs (0.0, 0.0 being the center)
		lowerlimit, upperlimit: how much the joint can turn. If both are 0.0,
			the joint can rotate freely.



Re: Character/creature config files

Posted: Fri Aug 07, 2015 10:04 pm
by AgentParadox
Regalis wrote:Currently the only way to edit creatures or add new ones is by editing the .xml files in "Content/Characters". There will be a proper in-game character editor at some point, but in case someone wants to give a shot at editing the files manually, here's a description of the format of the config files and a list of elements/attributes that can be used in them:
Spoiler

Code: Select all

New creatures can be added by creating a new folder in the Content\Characters\ 
folder and adding an .xml file inside the folder to configure the creature.

The .xml file should be formatted in the following way:
<character name="something">
	<ragdoll attribute1="something" attribute2="something">
	
		<limb id = 0>
			<sprite texture="texturepath" sourcerect="0,0,width,height"/>
		</limb>
		
		<limb id = 1>
			<sprite texture="texturepath" sourcerect="0,0,width,height"/>
		</limb>
		
		<joint limb1="0" limb1anchor="x,y" limb2="1" limb2anchor="x,y"/>		
	</ragdoll>
	
	<ai attribute1="something" attribute2="something"/>
</character>

-----------------------------------------------------------------

Elements:

Character:
	- has to be the root element of the file

	Attributes:
		name: the name of the creature
		humanoid: true/false, if set to true the character is animated using 
			a bipedal animator (like humans)
		needsair: true/false, does the character drown/suffocate without 
			oxygen (false by default)
		drowningtime: how fast the character drowns (in seconds)
		health: self explanatory (100.0 by default)		
		
Ragdoll:
	- has to be a child element of the character element
	
	Attributes:
		headposition: how high from the ground the head of the character should 
			be when the character is standing (50.0 by default)
		headangle: an angle which the head is rotated to when the character is walking
			(0.0 by default, meaning that the head will face straight forward)
		torsoposition: same as headposition but for torso (50.0 by default)
		torsoangle: an angle which the torso is rotated to when the character is walking
			(0.0 by default, meaning that it will face straight forward)
		waveamplitude, wavelength: if the character is not a humanoid, it will 
			do a "wave-like" swimming movement with the selected amplitude and 
			wavelength. To put it simply, amplitude affects how large up-and-down 
			movement the character will do and wavelength affects how fast the 
			character does the movement (both 0.0 by default)
		flip: should the entire character be "mirrored" over the y-axis when it
			switches its movement direction from left to right or vice versa, 
			or should it just rotate 180 degrees along the z-axis (false by default)
		walkspeed, swimspeed: how fast the character should move on land and 
			in water, (the actual speeds are also affected by the weight, shape 
			and steerforces of individual limbs) (both 1.0 by default)
		swimspeed: how fast the character should move in water
	
Limb:
	- an individual part of the ragdoll
	- has to be a child element of the ragdoll element
	
	Attributes:
		id: an integer that is used to distinguish between limbs when connecting them
			with joints. The first limb should have the id "0", the second "1" and so on.
		radius, width, height: used for setting the dimensions of the physics body 
			of the limb. If only radius is set, the limb will be a circle with 
			the selected radius. If width and height are set, it will be a rectangle. 
			If radius and height are set, it will be a capsule.
		density: the mass of the limb will be area_of_the_limb * density (default 10.0)
		friction: the friction coefficient of the limb (0.3 by default)
		flip: true/false, if set to true the limb will be "flipped" from one side 
			to another when the character turns around (as in, if a character is 
			facing left and has an arm extended left, the arm will be extended 
			to the right when the character faces to the right) (false by default)
		ignorecollisions: true/false, should the limb collide with walls (true by default)
		impacttolerance: if the limb receives an impact larger than this value, it takes 
			damage (20.0 by default)
		type: determines how the limb should be animated and what kind of items can be 
			equipped on the limb. Can be set to None, LeftHand, RightHand, LeftArm, 
			RightArm, LeftLeg, RightLeg, LeftFoot, RightFoot, Head, Torso, Waist, Tail, 
			Legs, RightThigh or LeftThigh
		pullpos: when animating the character, forces will be applied to this 
			point of the physics body of the limb. Defaults to "0.0, 0.0" which 
			is the center of the limb.
		refjoint: index of the joint that is used as the "center point" along 
			the x-axis when doing a walking animation. For example, if the joint 
			between a characters thigh and  waist is set as refjoint, the feet of the 
			character will be moved directly under said joint when the character is 
			standing still.
		steerforce: how much force is applied to the limb when the character moves (0.0 by default)
		armorsector: an armored sector between two angles (in degrees). For example,
			-90,90 would make the front sector of the limb armored (0.0,0.0 by default)
		armor: how effective the armor is: damage is divided by this value if an attack hits the
			armored sector (1.0 by default)
		
Sprite:
	- a child element of a limb element
	
	Attributes:
		texture: file path of the texture
		sourcerect: which part of the texture should be used. If either width or 
			height are 0, they will be set to the width or height of the texture. 
			(0,0,0,0 by default)
		origin: what point in the sprite is considered the "middle point". "0,0" 
			is the upper left corner of the sprite and "1,1" the lower right 
			corner. ("0.5, 0.5" by default)
		depth: Affects the order which sprites are drawn in. Sprites with a 
			depth of 1.0 will be drawn under sprites that have the depth set 
			to 0.9 for example. Note that setting several limbs to the same 
			depth value may cause them to "flicker" on top of each other, so 
			it's recommended that every sprite has a slightly different depth.

Attack:
	- a child element of a limb element
	
	Attributes:
		type: affects the logic for moving the attacking limb. At the moment the only
			types are None, PinchCW and PinchCW

			PinchCW: the limb rotates clockwise when attacking (or counter-clockwise 
				if the character is facing left). Useful for attacks like biting 
				or slashing
			PinchCCW: the same as PinchCW, but in the limb is rotated in the 
				opposite direction

		damage: damage done to other characters (0.0 by default)
		bleedingdamage: how much the attack affects the bleeding rate (0.0 by default)
		structuredamage: damage done to structures (0.0 by default)
		stun: how long the target is stunned (in seconds, 0.0 by default)
		range: how close the limb doing the attack has to be to the target to do damage
			(0.0 by default, but should be set to a higher value or otherwise it
			will only do damage if the limb is exactly at the position of the target,
			so practically never)
		duration: how long the attack lasts - if set to zero, it will be a "one-hit"
			attack, otherwise it will be active for a while and the damage values
			will be damage per second
		priority: can be used for adjusting how likely the character is to use specific
			attacks. For example, if a character has two attacks, first one
			having the priority 2.0 and the second 1.0, the character is twice as
			likely to use the first one.
		
Joint:
	- a revolute joint connecting two limbs to each other
	- a child element of the ragdoll element
	
	Attributes:
		limb1, limb2: thes id of the limbs that should be connected
		limb1anchor, limb2anchor: the points where the joint is attached to on 
			the limbs (0.0, 0.0 being the center)
		lowerlimit, upperlimit: how much the joint can turn. If both are 0.0,
			the joint can rotate freely.


Cool! So if I were to edit the headposition attribute to 100, would the character's head float above their body?

Re: Character/creature config files

Posted: Sat Aug 08, 2015 10:07 am
by Regalis
KirbyMario12345 wrote:Cool! So if I were to edit the headposition attribute to 100, would the character's head float above their body?
Nope, headposition doesn't affect the position of the head relative to the body, just how high from the ground the head should be (in pixels). The headposition for the human characters is set to 156.0, and if you set it to 100.0 this will happen:
Image
Changing the position of the head relative to the body would be done by changing the anchor positions of the joint between the head and torso.

Re: Character/creature config files

Posted: Sat Aug 08, 2015 12:58 pm
by AgentParadox
Regalis wrote:
Nope, headposition doesn't affect the position of the head relative to the body, just how high from the ground the head should be (in pixels). The headposition for the human characters is set to 156.0, and if you set it to 100.0 this will happen:

-snip-

Changing the position of the head relative to the body would be done by changing the anchor positions of the joint between the head and torso.
Alright. But if I were to set the width of the arms and legs to 0, would I get a character that's literally Rayman?

Re: Character/creature config files

Posted: Mon Aug 10, 2015 7:04 am
by Regalis
KirbyMario12345 wrote:Alright. But if I were to set the width of the arms and legs to 0, would I get a character that's literally Rayman?
Width only affects the invisible physics bodies that are used for collisions, and I think the physics engine would throw an error if you tried to set the width to 0. You could use a transparent sprite though if you wanted the arms and legs to be invisible.

Re: Character/creature config files

Posted: Mon Aug 10, 2015 9:26 pm
by AgentParadox
Regalis wrote: Width only affects the invisible physics bodies that are used for collisions, and I think the physics engine would throw an error if you tried to set the width to 0. You could use a transparent sprite though if you wanted the arms and legs to be invisible.
Ah, okay. I could try that :)

Re: Character/creature config files

Posted: Thu Aug 20, 2015 1:51 am
by yonzo_rikuo
thanks for tellling me regalis

Re: Character/creature config files

Posted: Mon May 09, 2016 11:44 pm
by Rick
Image
Mantis is CUTE! CUTE!!

Re: Character/creature config files

Posted: Wed Nov 29, 2017 6:54 pm
by Husky Husk
Rick wrote:
Image
Mantis is CUTE! CUTE!!
Pass The Texture Please :duck:

Re: Character/creature config files

Posted: Sat Dec 09, 2017 1:47 pm
by chikoeduardo
I have a question regarding these files... is there a way to add more than one sound to an attack other than creating more than one attack in different limbs?

I tried this piece of code:

Code: Select all

<attack range="100" damagerange="100" duration="1" damage="0.1" structuredamage="0.1"
			  targetforce="1" force="10" damagetype="burn" applyforceonlimbs="0,2,3,4,5" torque="-20">
		<StatusEffect type="OnUse" target="This" Health="0.1" disabledeltatime="true">
		  <Sound file="Mods/Chiko/Characters/Teleglitch/TeleHit1.ogg" type="OnUse" range="3000"/>
		  <Sound file="Mods/Chiko/Characters/Teleglitch/TeleHit2.ogg" type="OnUse" range="3000"/>
		  <Sound file="Mods/Chiko/Characters/Teleglitch/TeleHit3.ogg" type="OnUse" range="3000"/>
		  <Explosion range="250" stun="5" force="150" shockwave="false" flames="false" smoke="false" sparks="false" camerashake="1"/>
		</StatusEffect>
      </attack>
It works on items but it only plays the last sound file on creatures.