BlockySurvival / issue-tracker

A non-code repo for tracking issues w/ the Blocky Survival minetest server
12 stars 0 forks source link

Add hostile mobs (in very restricted contexts) #94

Open fluxionary opened 5 years ago

fluxionary commented 5 years ago

One of the features our server lacks, that players often ask for, is hostile mobs.

I'm not opposed to this in principle, but I feel that such mobs need to be introduced in a way that doesn't affect the essential characteristics (eigenschaften) of the server. To this end, I feel that the mobs should be restricted to the following areas:

  1. The Nether
  2. The Caverealms (i.e., only around caverealms blocks at certain elevations)
  3. The Asteroids

I have put the work I've done so far here: https://github.com/obl3pplifp/minetest-bls_mobs


So, there's an additional requirement that hasn't been written here for some reason:

After talking to some other mod devs, it seems like this would be much easier if we used the mobkit API instead of mobs_redo, and that porting all our existing mobs to mobkit shouldn't be much work.

ExeVirus commented 5 years ago

This is a great idea, and I'm excited by the prospect of battling in general on the server (mobs or otherwise in specific contexts). This provides future ability for us to implement fun mechanics and gameplay:) (i.e. bosses and rewards for beating them)

fluxionary commented 5 years ago

@ExeVirus: NSSM has a lot of such things built in, but I don't want to bring in the whole of that mod, and I don't know how to incorporate them. If you (or any other dev) wants to take over this project from me, please do, as I probably won't get back to it for a while.

ExeVirus commented 5 years ago

Okay, I may take this over after tidying up the waterfalls mod (almost done). my current priority list is:

  1. Tidy up waterfalls for release on Blocky

  2. Convince the Core Devs to implement a simple culling method for rendering particles, which would provide up to a 5x speedup.

  3. Start Contributing to the Minetest Wiki.

  4. Work on NSSM, with the goal of cleaning it up, simplifying it down, and hopefully optimizing for server speed.

So maybe 1-2 weeks? hard to estimate properly sometimes

fluxionary commented 5 years ago

@ExeVirus No hurry.

As a side note, I don't consider my mod to be NSSM anymore, though it certainly gets credit for the resources and most of the code.

krypticbit commented 5 years ago

I would suggest not having mobs in the caverealms, except possibly in diamond caverealms due to the fact that players like to build in them and it's odd to have monsters in caverealms but nowhere else in the underground overworld. However, mobs in the asteroids (aliens?) and nether are good. 👍

ExeVirus commented 5 years ago

I've been trying to think if ways to cut down on processing, and I think Aliens is a good solution to cut out a majority of the pathfinding code, as many of the mobs could be flying mobs that have a patrol pattern (or randomized patrol pattern). these would be flying saucers, star wars ep. 1 style drones, etc.

The hard part there is how would they attack at range... can particles be used for this or would that require another entity?

Alternatively, to simplify mob coding, we could have designated areas in the nether and asteroids where 1/2 slabs are used in node block generation so that mobs can always walk without running into a wall, eliminating the a jump requirement, so their pathfinding could literally be go to/run away from/circle around the nearby player.

Just spitballing, is there other parts of entity code that are a drain on the server?

thomasrudin commented 5 years ago

However, mobs in the asteroids (aliens?) and nether are good

I'm using https://github.com/pandorabox-io/mobs_xenomorph on my asteroids :smile: just fyi...

fluxionary commented 5 years ago

For the asteroids, I'm quite fond of how the bird-type mobs from NSSM work up there (Scrausics, Phoenix, Moon Heron, Night Master). In fact, as there's two pairs of birds, it's natural to have one pair spawn in the grey asteroids, one pair in the red asteroids.

However, the phoenix has a ranged attack, and players currently don't have a way of dealing with that...

fluxionary commented 5 years ago

@Billy-S I've thought about this a little more; if we introduced hostile mobs in the asteroids, a handful of builds (e.g. my decor store, the newb schools, scrapper's experimentation area, SoB's space ship, ...) would be overrun. Would you consider it appropriate to have mobs in the caverealms if we had a restriction on mobs, that they can't spawn within protected areas? Or if it's feasible, within something like 16 nodes of a protected area?

I personally like the idea of having mobs in the caverealms, because there's 9 caverealms, and you can have different kinds of mobs spawn in each one. Otherwise, we only have 3 zones to work with.

I don't like the idea of mobs spawning in the caves in general, because players mostly want to mine, but the caverealms have a few rare precious resources, which could use an extra challenge to retrieve.

Mathiaszero commented 4 years ago

Just wanted to chime in, I was referred recently by flux. I have not been in space much, so I can't really speak on that. I've been on servers where there were aggressive mobs that could be found anywhere, and it seems after reading these this is not the direction the server would take. I suggest starting slow and add mobs to 1 or 2 caverealms, but it's all up to you for the final decisions. I think there should be hovering or flying mobs if there are resources at the top of the caves, ex near caverealm mese hanging downwards. Maybe defensive monsters that guard mushrooms or titanuim deposits. Also, what about mobs that take the resources, and you have to kill them to get it? Most mobs in my experience don't really play defense, so I think this could be a unique feature.

fluxionary commented 4 years ago

so, the number 1 priority, before adding any hostile mob, is to add a facility to the areas mod, to tag an area in a way that the mobs API can respond to it - we need a way to keep hostile mobs from spawning in people's existing bases in the middle of the hostile areas of the server. it would be really inappropriate for some players giant factories to suddenly be overrun.

then i agree, we can work on adding one or two hostile mobs and working from there. no need to release them all at once.

i don't have any specific rewards planned for the mobs, but i wanted them to mostly be used for rare items that can't be got any other way. maybe the terumetal tool upgrades should use some drops from the mobs instead of "mundane" terumet items.

also, in case its not clear, i wanted different kinds of mobs to show up in each of the 3 major areas mentioned above, and if possible, separate mobs associated w/ each caverealm. that gives us 12 total "biomes" to consider (9 caverealms, 2 asteroids, 1 nether).

Mathiaszero commented 4 years ago

I am having some trouble figuring out how the mobs API can access the areas data, as I believe that is the ideal solution for this problem. However, I played around with the areas mod itself and developed a simple algorithm that allows the user to tag areas that kill mobs if they are in a claimed area. I don't think this is the solution you had in mind but I think I got a better understanding of how the areas mod works in the code, and may be an easy way to add/remove the mob names. Maybe I or others can use this as a source of improvement to create the script that could simply be added right after preforming the necessary environmental checks before spawning the mob, eg, time, lighting, elevation etc. If the mob is about to spawn and the location was in a tagged claimed area then don't spawn; otherwise if the claimed area was not tagged, OK to spawn.

Ex pseudo code: for _,area in ipairs(areas:areas) do if string.find("no_mobs") then--assuming there is a tag in the data representing a user's area return end end

Here are some notes/commands for using my attached WIP script:

/noMobs {area ID} will actually access the areas data itself, tag the area, kill any mobs in the specified area, and should prevent mobs from bothering the player especially if the player needs to be in the area; /yesMobs {area ID} should undo that; /goir gets the names and counts how many player and non-player objects there are; /list_noMobs lists the areas that have a "no_mobs" tag.

no_mobs.zip

I am not well-versed on programming mod to mod interaction/ dependencies, but hoping some additional time spent learning could improve that. Also not crash my local server more than half the time during testing heheh

In all seriousness though, I hope this code helps in some way, shape or form as I gain experience with this.

Edit: after the block comment on line 3736 of api.lua, you can try this: --is area tagged? local mobPosX=pos["x"] local mobPosY=pos["y"] local mobPosZ=pos["z"]

        for id, area in pairs(areas.areas) do
            xMin=area["pos1"]["x"]
            xMax=area["pos2"]["x"]
            yMin=area["pos1"]["y"]
            yMax=area["pos2"]["y"]
            zMin=area["pos1"]["z"]
            zMax=area["pos2"]["z"]

            if xMin<=mobPosX and xMax>=mobPosX and yMin<=mobPosY and yMax>=mobPosY and zMin<=mobPosZ and zMax>=mobPosZ then
                local str=string.find(minetest.serialize(area),"no_mobs")
                if str==nil then
                    --continue
                elseif str~=nil then
                    return
                end
            end

        end`

lol This should work in conjunction with the file in the zip that lets one use a chat command to tag areas that prevent mobs from spawning. If you disable the global step function, the server will not continuously check for mobs in the area, so those that spawn from outside and make their way towards the tagged area can still bother players. I hope this helps. I recommend testing before applying to active server since "areas:save()" is being used.

Lanhild commented 4 years ago

Mobs on Fussel's server are pretty stable, and respect restrictions like areas protection. For having tested the mobs on this server many times, they seem to work pretty much.

I can check and ask him what mod he uses for it's mobs.

fluxionary commented 4 years ago

no harm in asking

Lanhild commented 4 years ago

The mod name for mobs on Fussel's server is apparently "pmobs" but Heavilly modified

Link to Pmobs: https://forum.minetest.net/viewtopic.php?t=10354