Mobs Development

From Minetest
Revision as of 21:47, 1 September 2023 by Poetry (talk | contribs)




This subject area:




Introduction

This page discusses "mobs" development. These topics will be of interest to modders and world hosts.

Before you read this page, you should be familiar with Mobs X and B3D files.

Making 3D Models

This is a very high-level summary of how you make mob source and published model files.

Obtain Blender 2.79 (or 2.79b). Higher releases may work.

Install a compatible release of the B3DExport plugin. This will be used to export animated models at a smaller file size than X format.

The github.com B3DExport fork eliminates textures to avoid import errors in earlier versions of Minetest. It also uses the initial commit of RainWarrior's version to avoid this issue:

https://github.com/RainWarrior/B3DExport/issues/2

Other types of models that Blender can export and that Minetest can import via Irrlicht are not capable of animation.

Before exporting, you must join all objects into one mesh, so that Minetest can apply texture to all of the parts (otherwise, additional meshes will be plain white). For more details see the Entities article.

Determining Velocity

When designing mobs, you can prevent "foot sliding" (a.k.a. Moonwalk) by ensuring that the velocity for each sequence is set to the actual speed at which the feet move backward during the timespan when they [the feet] are touching the ground.

Mobs Lua code

Once you have a ".b3d" model for a new mob, it's typically easy to add the mob to an existing "mobpack" such as Codermobs. You can look at how an existing mob such as a badger is done and emulate that.

One issue to be aware of is that you need to set animation parameters correctly for each mob in its primary Lua file. If you created the ".b3d" file used, you should know these parameters. If not, you'll need to talk to the person who did create the file.

Mobs spawning parameters 

How the other parameters for a mob work will depend on the mobs code engine used by the target modset. However, for spawning, in Codermobs, there are "spawn_nodes" and "spawn_by" in a "mobs_param" table that provide for variation of mobs based on terrain.

If both are specified, the range of nodes available will be significantly lower, so the rarity ("chance," which is actually a chance denominator) should be much lower than usual (square root or less) in order for mobs to spawn noticeably.

Editors: This needs to have code fragment examples for it to be comprehensible.

The "chance" is applied to the set of air blocks with both one of the "spawn_nodes" under it and one of the "spawn_by" nodes beside it.