Pikifen/Creating object types
This page will instruct you on how to create new object types in Pikifen. This includes a new type of enemy, new type of Pikmin, etc.
- 1 General idea
- 2 Creating a new object type
- 3 Creating an Onion type
- 4 Creating a treasure type
- 5 Extra features
In order for the engine to detect a type of object, it will check the "Game_data/Types" folder. Inside are several folders, one for each category of object (enemies, gates, etc.). Inside each category are folders for the different types of objects (the different types of enemies, different types of leaders, etc.). Finally, inside those are two text files: one is written manually and contains all the data about how the object works, while the other contains the object's animations, created by the animation editor.
Creating a new object type
To create a new object type, make a folder for it on the right category, and create two empty text files inside: one called "Data.txt", the other "Animations.txt". Inside Data.txt, you will write all of the object's attribute, like the name, its movement speed, etc. These take on the form of
attribute = value, and there is one attribute per line. So for instance, to name Louie's object type, you'd have the line
name = Louie on the file. Some attributes are mandatory, some are optional, some apply to all object types, and some only apply to certain categories of object type. Feel free to read the rest of this section and then jump straight to the section of the object category you want.
Naturally, instead of creating your own files from scratch, you may copy and paste an existing object's files and simply edit those. After you're done setting the attributes, you must create the animations for the object type. Use the animation tutorial for this.
The following attributes must exist, regardless of category. Some object types might work just fine without you filling in some of these attributes, but it is very encouraged that you do fill them.
name: Name of the object type. e.g. Olimar, Red Pikmin, Cloaking Burrow-nit.
height: Object's height. This doesn't need to be very specific. For reference, leaders are usually 32, Pikmin are usually 24.
max_carriers: Maximum number of Pikmin that can carry this object, when it is made carriable.
max_health: The object's top health. For reference, leaders have 10, and something like a Red Bulborb has 750.
move_speed: Movement speed (in pixels per second). For reference, leaders move at 100.
trueif this object can be pushed out of the way by other objects.
trueif this object can push "pushable" objects out of the way.
radius: The object's size, represented by the circle's radius (in pixels). Leaders are 32 pixels wide, so their radius is 16. Pikmin have a radius of 10.
rotation_speed: How fast the object turns when moving, in degrees per second. For reference, leaders use around 6, Pikmin use around 8, and a Red Bulborb uses around 2.
weight: How much Pikmin strength does it take to carry the object.
For all categories of object type, you may set these attributes, but they will still work if you don't.
blocks_carrier_pikmin: If set to
true, the object being alive in the way of carrier Pikmin will block their carrying, like a gate or an unbuilt bridge.
can_free_move: If true, this object can move in any direction freely, without having to first turn there. It will also not face towards the direction it is going.
casts_shadow: If set to
false, the object won't cast a shadow on the ground. Default is
health_regen: Passive health regeneration rate, in HP per second. Default is
is_obstacle: If set to
true, the object will be considered an obstacle. This only impacts whether enemies and such can harm it or not.
is_projectile: If set to
true, this object will be able to damage almost all damageable objects. Objects with
falseare immune. Useful for instance, for a boulder to take down a fire geyser.
main_color: A color to represent the object by. The format is
R G B(values range from 0 to 255). Default is black.
projectiles_can_damage: If set to
false, this object cannot be damaged by objects with the
is_projectileproperty. Useful for obstacles that you don't (or do) want to be destroyed without Pikmin.
pushes_with_hitboxes: If true, this object pushes with its (normal or attack) hitboxes, instead of pushing using its object's center and radius.
rectangular_dimensions: If this object is meant to have rectangular collision, specify the rectangle's dimensions here, in the format
<width> <height>. This is useful for objects like gates, but shouldn't be used by objects that can move (among other things, the engine is not ready to handle rectangular object vs rectangular object collisions).
show_health: If set to
false, the object's health wheel will not appear on top of it. Default is
spike_damage: If this object is meant to cause spike damage, specify the spike damage type's name here.
spike_damage_vulnerabilities: Normally, objects hit by a spike damage attack will receive the damage specified. If you want this mob type to take more or less damage (or even heal!), you can specify it here. This is a block, where every attribute inside has the spike damage type's name as a name, and the percentage as a value. Example:
poison = 50will make this enemy take half the intended damage when ingesting a White Pikmin.
true, this object can be walked on top of by other objects. Other objects will be able to mount it if they fall on it from above, or if they are on a floor that's within 50 units of height from the top of this object (much like how climbing up stairs work).
Creating a Pikmin type
To create a Pikmin type's attributes, follow the standard procedure written above. Then, you must also specify the following attributes:
icon_leaf: Name of the image with the Pikmin type's icon for when it is a leaf. This is displayed on the HUD, for the standby Pikmin bubble. The image should be in
Game_data/Graphics, and the extension of the file name must be included.
icon_bud: Same as
icon_leaf, but for a bud.
icon_flower: Same as
icon_leaf, but for a flower.
top_leaf: Name of the image with the leaf sprite to use in-game. The image should be in
Game_data/Graphics, and the extension of the file name must be included.
top_bud: Same as
top_leaf, but for a bud.
top_flower: Same as
top_leaf, but for a flower.
In addition, you may also specify the following, although they are optional:
throw_strength_mult: The strength of the throw arc will be multiplied by this. A standard Pikmin has this set to 1. For reference, a Yellow Pikmin has this set to 1.1.
carry_strength: The Pikmin is worth this much for carrying strength. Default is 1.
trueif the Pikmin has an Onion,
falseotherwise (e.g. White Pikmin). Default is true.
sprout_evolution_time_1: How long a leaf Pikmin sprout must wait before they turn into a bud. 0 means it will never evolve into the next stage.
sprout_evolution_time_2: Same as the previous, but between a bud and a flower.
sprout_evolution_time_3: Same as the previous, but between a flower and the process of withering back into a leaf.
Then, you must create the Pikmin type's animations. Use the animation tutorial for this.
One thing to note when making Pikmin is that the movement speed attribute indicates the movement speed of a leaf Pikmin. Bud Pikmin move 110% faster, and flowers move 120% faster.
Creating a leader type
For a Pikmin, a Pikmin type is "Red", "Yellow", etc. For leaders, a leader type is the same thing: "Olimar", "Louie", "Alph", etc. Although yes, it does not make sense to have more than one "Alph" in the same area, each "person" is still considered a type. Plus, you could want a group of three "Giant Red Pikmin" leaders, and for that, we need a "Giant Red Pikmin" type.
For a leader type's attributes, first, follow the standard procedure written above, then add the following mandatory attribute:
icon: Name of the image file with the leader's icon. This icon is used on the HUD. The image should be in
Game_data/Graphics, and the extension of the file name must also be included.
You can also specify the following attributes if you want:
dismiss_sfx: Name of the sound file to play when this leader dismisses. The sound should be in
Game_data/Audio, and the extension of the file name must be included. If not set, no sound will play.
name_call_sfx: Same as
dismiss_sfx, but the sound the leader makes when they are switched to.
pluck_delay: How much time it takes before the Pikmin comes out. Default is 0.6.
throw_strength_mult: When this leader is thrown, the strength of the throw arc will be multiplied by this. A standard Pikmin has this set to 1, but leaders normally have it set to 0.7.
whistle_range: Maximum range the whistle can cover. Default is 80.
whistle_sfx: Same as
dismiss_sfx, but the sound the leader's regular whistle makes.
Then, you must create the leader type's animations. Use the animation tutorial for this.
Creating an enemy type
To create an enemy type, follow the standard procedure written above. If you want, you can also specify the following optional attributes:
falsemakes it so that Pikmin cannot attack it with grounded attacks; the only way to hurt it is by throwing Pikmin and letting them attack latched on.
trueif this enemy drops a corpse,
falseotherwise. Default is true.
pikmin_seeds: How many seeds this enemy gives when the corpse is returned to the Onion. Default is 0.
Creating an Onion type
To create an Onion type, simply follow the standard procedure above, and then specify the following attribute as well:
pikmin_type: Name of the type of Pikmin this Onion belongs to.
Then, you must create the Onion type's animations. Use the animation tutorial for this.
Creating a pellet type
To create a pellet type, follow the standard procedure written above, and then specify the following attributes:
match_seeds: How many seeds it gives to the Onion when the pellet's Pikmin type matches the Onion's.
non_match_seeds: How many seeds it gives to the Onion when the pellet's Pikmin type does not match the Onion's.
number: The number written on the pellet (e.g. 1, 5, 10). This will set the weight to the same thing.
number_image: Name of the image with the number. The image should be in
Game_data/Graphics, and the extension of the file name must be included.
pikmin_type: Name of the type of Pikmin the pellet matches with.
Then, you must create the pellet type's animations. Use the animation tutorial for this.
Creating a ship type
To create a type of ship (Hocotate ship, S.S. Drake, etc.), follow the standard procedure written above. Then, simply specify the following attribute:
true, that means that leaders can heal their spacesuits using this ship, like the S.S. Dolphin. Default is false.
Then, you must create the ship type's animations. Use the animation tutorial for this.
Creating a treasure type
To create a type of treasure (or ship part, fruit, or what have you; they're all considered "treasure"), follow the standard procedure written above. At the moment, there are no other attributes that can be added.
Then, you must create the treasure type's animations. Use the animation tutorial for this.
Creating a gate type
To create a type of gate, follow the standard procedure above. At the moment, there are no other attributes that can be added.
Then, you must create the gate type's animations. Use the animation tutorial for this.
Creating a bridge type
To create a type of bridge, follow the standard procedure above. Then, simply specify the following attributes:
main_texture: File name of the texture to use for the bridge's main floor, extension included. This texture should be in
rail_texture: Same as above, but the texture to use for the railing.
Then, you must create the bridge type's animations. Use the animation tutorial for this.
Creating a fully custom object type
If you want, for instance, a rubber ball that bounces around when a Pikmin is thrown at it, but is not meant to do anything specific, like be carried, what category would you put it in? It's not an enemy since it can't drop a corpse or leave behind a spirit, it's not something Pikmin should be targeting, etc. It's definitely not a leader, or a Pikmin. Well, you can use the "Custom" category to place any object that works completely custom. These use a script, like enemies, to control their behavior. This category is also where you'd place simple obstacles, like fire geysers.
Spawning other objects
If you want your object to spawn other objects, you need to specify their spawn data. In
Data.txt, include a block titled
spawns. Inside, you will write a series of blocks, each one with a unique name that will identify that spawn data. Later, when you want to spawn an object using the script, you need to refer to this name.
These spawn data blocks must have the following attributes inside:
object: Name of the type of object to be spawned. This is the formal name, i.e. the name provided in the
nameattribute in the mob type's
It can also optionally have these attributes:
relative: Are the specified spawn coordinates absolute or relative? See here for more help.
coordinates: Coordinates to spawn in, in the format
x y z.
angle: Angle the spawned object will be facing.
vars: Any script variables to include.
true, a link will be created from the spawned object to your object.
true, a link will be created from your object to the spawned object.
If your object is meant to be a parent, composed of several different child objects, then you need to specify the children data. In
Data.txt, add a block called
children. Inside, you will include a series of blocks, each one with a unique name that represents the child, e.g. "left_foot". Now, when your object is spawned, it will spawn these children along with it.
Each of these blocks needs to have the following attributes:
spawn: Name of the spawn data to use.
The blocks can also have the following optional attributes:
true, then the parent object is holding this one, much like an enemy holds a Pikmin that is latched on to it. Use the following attributes to specify the location.
hold_body_part: If the parent holds this child, this is the name of the body part it is held on. If empty, the center of the parent object is used instead.
hold_offset_distance: If the parent holds this child, this is how far away from the center of the body part/object the child is. 0 means dead center, and 1 means on the edge, but you can write numbers beyond this range.
hold_offset_angle: If the parent holds this child, this is the angle from the body part/object's default position that the child is located at.
true, the child object suffers any damage that it receives.
true, the child object relays any damage suffered to the parent object.
true, the child object handles any event that it receives.
true, the child object relays any events received to the parent object.
true, the child object handles any status effect that it receives.
true, the child object relays any status effects received to the parent object.
limb_animation: If there is meant to be a "limb" drawn between the child and parent, specify the name of its animation here. This animation must be included in the parent object's animation set.
limb_thickness: If there is a limb, this specifies how thick it is.
limb_parent_body_part: If there is a limb, this specifies where it connects to in the parent. If it's empty, it connects to the parent's center. Otherwise, it connects to the center of the specified body part.
limb_parent_offset: If there is a limb, you can specify how far away it is from the center of the parent-side connection.
limb_child_body_part: Same as
limb_parent_body_part, but for the child object.
limb_child_offset: Same as
limb_parent_offset, but for the child object.
limb_draw_method: How to draw the limb. This can be one of the following:
below_both: Draw the limb below both the parent and the child.
below_child: Draw the limb below the child. It may appear above or below the parent, depending on the child and parent's positions.
below_parent: Draw the limb below the parent. It may appear above or below the child, depending on the child and parent's positions.
above_parent: Draw the limb above the parent. It may appear above or below the child, depending on the child and parent's positions.
above_child: Draw the limb above the child. It may appear above or below the parent, depending on the child and parent's positions.
above_both: Draw the limb above both the parent and the child.