Page 1 of 1

[Mod] assign Mobs to spawn in given habitats [mobshabitats]

PostPosted: Tue Oct 25, 2016 11:26
by taikedz
A supporting mod for spawning mobs made with mobs_redo

The intent is for mobs modders to be able to define where their mobs should spawn, and be able to assign the mobs to those places in bulk. Add a dependency to mobshabitats or just copy-in the api.lua file.

+ Server admins


Features:

    * Define main characteristics of a habitats
    * Define group mobs into families
    * Assign individual mobs or mob groups to habitats
    * Simple syntax, defaults taken care of

+ Predefined biomes (can be overridden)


An example of adding mobs to ethereal biomes:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
-- ethereal biomes

mobsbiomes:add_biome("ethereal:firepits",{
        floors = {"ethereal:fiery_dirt"},
        plants = {"ethereal:dry_shrub"},
        walls = {"default:obsidian"},
})

mobsbiomes:add_biome("ethereal:bamboo",{
        floors = "ethereal:bamboo_dirt",
        trees = "ethereal:bamboo",
        plants = "ethereal:bush",
})

-- spawning example


if minetest.get_modpath("dmobs") then
        mobsbiomes:add_spawn("dmobs:panda","ethereal:bamboo") -- use default spawning values from mobsbiomes
end

if minetest.get_modpath("mobs_monster") then
        mobsbiomes:add_family("firemonsters",{
                lavaflan = {mobstring="mobs_monster:lavaflan",spawnon="floors",spawnby="walls"},
                dungeonmaster = {mobstring="mobs_monster:dungeon_master",spawnon="floors",spawnby="walls",max_light=10},
        })

        mobsbiomes:add_family("groundmonsters",{
                oerkki = {mobstring="mobs_monster:oerkki",spawnon="floors",spawnby="walls"},
                stonemonster = {mobstring="mobs_monster:stone_monster",spawnon="floors",spawnby="walls"},
        })

        mobsbiomes:add_family_spawn("firemonsters","ethereal:firepits")
        mobsbiomes:add_family_spawn("groundmonsters","ethereal:firepits")
        mobsbiomes:add_family_spawn("groundmonsters","default:caves")
end


Git: https://github.com/taikedz/minetest-mobsbiomes
Zip: https://github.com/taikedz/minetest-mob ... master.zip
License: LGPLv3

Re: [Mod] Mobs Biomes [mobsbiomes][wip]

PostPosted: Tue Oct 25, 2016 13:48
by Andrey01
Taikedz, i haven`t understood, what have you added are these biomes for, if do they be default?What are mobs will be spawn in it?

Re: [Mod] Mobs Biomes [mobsbiomes][wip]

PostPosted: Tue Oct 25, 2016 15:43
by taikedz
Andrey01 - this is a supporting mod for anyone to use.

Re: [Mod] assign Mobs to spawn in given Biomes [mobsbiomes][

PostPosted: Tue Oct 25, 2016 19:37
by D00Med
So the idea is that biome mods can make mobs spawn on them?

Re: [Mod] assign Mobs to spawn in given Biomes [mobsbiomes][

PostPosted: Tue Oct 25, 2016 20:27
by taikedz
The idea really is that mobs mods themselves can define biomes generally and assign mobs to them in bulk.

I developed it with nssm in mind but thought it could also generally be useful....

Mob modders can then declare the biome types thdir mobs will spawn in, and server admins can add swathes of mobs to multiple similar (or not) biomes

Re: [Mod] assign Mobs to spawn in given Biomes [mobsbiomes][

PostPosted: Wed Oct 26, 2016 02:37
by manawy
This looks like a very interesting library for game developer. I tried this by hand and it's indeed quite difficult.

I'd like to suggest some changes :

- it seems to me that mobs spawn on top of nodes, so instead of trees, it should be leaves (but I may be wrong)

- The default interval shouldn't be "1", it what make the goblin mods very difficult to play in a larger world. If the interval is one, the chance parameter doesn't matter and the mobs will spawn anyway (for large enough biomes). From my tests, it seems better to play with the chance parameter and leave the interval parameter at 30. It should also be less resource intensive (though I don't know how much in practice)

Re: [Mod] assign Mobs to spawn in given Biomes [mobsbiomes][

PostPosted: Wed Oct 26, 2016 12:14
by taikedz
manawy wrote:- it seems to me that mobs spawn on top of nodes, so instead of trees, it should be leaves (but I may be wrong)


Mobs spawn on top of specified nodes indeed. If you want mobs to spawn on leaves, define an environment that has leaves

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
mobsbiomes:add_biome("treetops:pine",{
    floors="default:pine_leaves",
    walls="default:pine_tree"
})

mobsbiomes:add_spawn("mymobs:eagle","treetops:pine")


Floors will often be where the mob spawns *on*, you can define it to be anything.

Defining by floors, walls, plants and trees is just a handy way to be able to use shorthands. "spawn an owl in [treetops] and in [plains]" without having to also say "if in trees, spawn on the plants, if in plains, spawn on the ground".

It's easier if you define the "floor" from the point of view of the mob: what is a ceiling to a bear is a floor to a bird.

manawy wrote:- The default interval shouldn't be "1", it what make the goblin mods very difficult to play in a larger world. If the interval is one, the chance parameter doesn't matter and the mobs will spawn anyway (for large enough biomes).


I've never seen the behaviour you describe. Though it is entirely possible that the goblins mod does something funny, as I know that it forked a copy of mobs_redo instead of adding a dependency.

Re: [Mod] assign Mobs to spawn in given Biomes [mobsbiomes][

PostPosted: Wed Oct 26, 2016 12:30
by taikedz
D00Med -- sorry I was on mobile device yesterday, should have just held off on responding

For a mobs mod (taking dmobs as an example), I could imaging adding a file "spawns.lua" (either the server admin could make their own, or shipping one in the mod) containing something like

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
mobsbiomes:add_family("woodlandcreatures",{
   {mobstring="dmobs:panda",spawnon="floors",spawnby="floors",chance=5000}, -- make the panda rare
   {mobstring="dmobs:fox",spawnon="floors",spawnby="trees"},
   {mobstring="dmobs:hedgehog",spawnon="floors",spawnby="plants"},
})

mobsbiomes:add_family_spawn("woodlandcreatures","default:forest")
mobsbiomes:add_family_spawn("woodlandcreatures","default:pineforest")
mobsbiomes:add_family_spawn("woodlandcreatures","ethereal:bamboo_grove") -- which could be defined by ethereal itself, or in another mod entirely


So rather than having spawning interspersed around the place and having to manage each spawn params separately, manage them in a single place and add them to multiple "biome" types.

Re: [Mod] assign Mobs to spawn in given Biomes [mobsbiomes][

PostPosted: Wed Oct 26, 2016 13:22
by manawy
taikedz wrote:It's easier if you define the "floor" from the point of view of the mob: what is a ceiling to a bear is a floor to a bird.


Ok, I didn't understood it like that. I'll give it a try

taikedz wrote:I've never seen the behaviour you describe. Though it is entirely possible that the goblins mod does something funny, as I know that it forked a copy of mobs_redo instead of adding a dependency.


For me it has to do with how many time you launch the dice. It does not matter that you have 1/100000000000000 chance of spawning a mob, if you try it 10000000000000000000000000 you will spawn it.
By increasing the interval, the mob spawning is a bit more random. It all depends on what you want, but it may be better as a default value to avoid a mob of angry users . But at least the option is available so it's good :)

Re: [Mod] assign Mobs to spawn in given Biomes [mobsbiomes][

PostPosted: Thu Oct 27, 2016 11:15
by azekill_DIABLO
i like this support mod!! i will see if i can merge it with mila... may not be hard at all XD

Re: [Mod] assign Mobs to spawn in given Biomes [mobsbiomes][

PostPosted: Thu Oct 27, 2016 12:19
by taikedz
Really, the only part that is "dependent" on mobs_redo is the spawning call

So only that call needs to be adjusted to match what MILA expects

Re: [Mod] assign Mobs to spawn in given Biomes [mobsbiomes][

PostPosted: Sat Oct 29, 2016 16:48
by azekill_DIABLO
Juste what i thought. O:-)