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

Post Reply
User avatar
taikedz
Member
Posts: 698
Joined: Sun May 15, 2016 11:11
GitHub: taikedz
IRC: DuCake
In-game: DuCake
Location: Scotland, UK
Contact:

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

by taikedz » Post

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.
Spoiler
It can also be used to support a server admin who wants to add spawning themselves in an isolated mod -- though the default spawning code would need to be removed from the mobs' code.

Using a centralized file where you can define the spawning of various mob "families" is much more maintainable too
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
Spoiler
default:grasslands
default:snowymountains
default:desert
default:savannah
default:icesea
default:shore
default:sea
default:seabed
default:river
default:riverbed
default:forest
default:pineforest
default:jungle
default:caves
default:tallcaves
default:lavapit
default:dungeon
default:sky
An example of adding mobs to ethereal biomes:

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-mt/mobs_habitats
Zip: https://github.com/taikedz-mt/mobs_habi ... master.zip
License: LGPLv3
Last edited by taikedz on Sat Sep 15, 2018 12:00, edited 5 times in total.

User avatar
Andrey01
Member
Posts: 2597
Joined: Wed Oct 19, 2016 15:18
GitHub: Andrey2470T
In-game: Andrey01
Location: Russia, Moscow

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

by Andrey01 » Post

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?

User avatar
taikedz
Member
Posts: 698
Joined: Sun May 15, 2016 11:11
GitHub: taikedz
IRC: DuCake
In-game: DuCake
Location: Scotland, UK
Contact:

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

by taikedz » Post

Andrey01 - this is a supporting mod for anyone to use.

User avatar
D00Med
Member
Posts: 949
Joined: Sat Feb 07, 2015 22:49
GitHub: D00Med
Location: Australia...somewhere

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

by D00Med » Post

So the idea is that biome mods can make mobs spawn on them?
Look! I have a signature :]
My subgame: viewtopic.php?f=15&t=14051#p207242

User avatar
taikedz
Member
Posts: 698
Joined: Sun May 15, 2016 11:11
GitHub: taikedz
IRC: DuCake
In-game: DuCake
Location: Scotland, UK
Contact:

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

by taikedz » Post

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
Last edited by taikedz on Wed Oct 26, 2016 12:42, edited 1 time in total.

manawy
Member
Posts: 10
Joined: Sat May 28, 2016 20:14

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

by manawy » Post

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)

User avatar
taikedz
Member
Posts: 698
Joined: Sun May 15, 2016 11:11
GitHub: taikedz
IRC: DuCake
In-game: DuCake
Location: Scotland, UK
Contact:

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

by taikedz » Post

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

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.

User avatar
taikedz
Member
Posts: 698
Joined: Sun May 15, 2016 11:11
GitHub: taikedz
IRC: DuCake
In-game: DuCake
Location: Scotland, UK
Contact:

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

by taikedz » Post

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

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.

manawy
Member
Posts: 10
Joined: Sat May 28, 2016 20:14

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

by manawy » Post

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 :)

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

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

by azekill_DIABLO » Post

i like this support mod!! i will see if i can merge it with mila... may not be hard at all XD
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

User avatar
taikedz
Member
Posts: 698
Joined: Sun May 15, 2016 11:11
GitHub: taikedz
IRC: DuCake
In-game: DuCake
Location: Scotland, UK
Contact:

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

by taikedz » Post

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

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

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

by azekill_DIABLO » Post

Juste what i thought. O:-)
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest