Mobs refactoring
#1
I think it's about time MCS got an overhaul of the mobs code.

There have been a few requests on what should be done, so I'll try to keep a list here:
- Per-world settable mobs. In each world.ini, make a section that specifies which mobs are allowed to generate in the world.
- Per-biome settable mobs. In monsters.ini (? perhaps allow a world.ini override?), specify, in which biomes specific mobs are allowed generate.
- Flying mobs should fly (there's nothing funnier than a ghast running on the ground through a forest Wink
- Spawning needs to be adjusted. Spawn mobs underground as well. Don't spawn too many mobs. Animals should spawn only minimally and should generate with the terrain instead.
- New AI - don't let the mobs jump around like crazy, improve their pathfinding etc.
- Add missing mobs - villagers, iron golems, cats, ...

Feel free to comment and throw in some ideas. I'll try to keep this initial post up to date with the ideas.
Reply
Thanks given by:
#2
Quote:Feel free to comment and throw in some ideas.
Feature I would really adore: ability to config zombies door breaking. Reason: I want server with "normal" difficulty, but with zombies breaking the doors.
Reply
Thanks given by:
#3
Ugh, I don't think "zombies breaking door" is likely at all. We'd need someone with really good AI background for this.
Reply
Thanks given by:
#4
I could help with that (seems not a big deal - grab local 3-dimensional blocks array, build A* path, count door as breakable obstacle), but I don't know c++. At all.
Reply
Thanks given by:
#5
Just getting the block array is quite a big deal - each such array is 32^3 blocks copied from the chunks' data, and there could be hundreds of mobs in *each* world. This could actually kill the server performanceTongue
Not to mention ghasts - they have a much longer sight range, afaik, maybe 128 blocks? so 256^3 blocks? Ugh!

And that's only pathfinding, but I was more referring to the AI, choosing what to do next, that's what's bothering me. When does a zombie decide that breaking a door is a better idea than walking around looking for villagers to maul?
Reply
Thanks given by:
#6
Quote:When does a zombie decide that breaking a door is a better idea than walking around looking for villagers to maul?
As far as I can remember, vanilla zombies try to break the door until they die or break the door...

But still, let's do "chance" trick:
Each mob has it's "state". From every state every tick every mod has a chance to change it's state to another one, depending on random.
I used such logics in my LudumDare game, and it worked well enough (yes, I was doing minecraft clone within 48 hours).
Quote:Just getting the block array is quite a big deal - each such array is 32^3 blocks copied from the chunks' data
then let's grab whole chunks!
And let's take only those of them, which are close to players. You know, you simulate mobs only if someone can see them. Then you have like 9x9 chunks to copy per player (if they're spreaded across the map), and you're not forced to copy them every tick. Just when player changes environment and when it leaves 3x3 zone with a center in chunk, that was considered 9x9 zone center when we copied chunks previous time.
Reply
Thanks given by:
#7
the problem with mobspawning in MC-Server now is that they just keep spawning. the mobs won't stop spawning so that should be fixed i think
Reply
Thanks given by:
#8
I don't quite get the chunk grabbing you're proposing. But anyway, I think we can work around that:

Let all mobs grab only a small portion, let's say 5x5x5 blocks around them, by default. This should be enough for them to walk randomly etc.
Only when a mob is within a 16 block distance to any player (plain L1 or euclidean metric, no matter what the blocks are), let them grab the full 32^3 area for pathfinding to the player.

This could work. Maybe even making the small portion adaptive or settable size, at least for experimenting.
Spawning change added to the list in the top post. Nice catch.
State-based AI is okay, but it won't do what vanilla does now - villagers socializing, golems giving roses to children etc.
Reply
Thanks given by:
#9
Quote:I don't quite get the chunk grabbing you're proposing
I could be wrong, but I think MCS stores nearby to players chunks in RAM, right? Why can't we just took those objects' pointers (chunks' pointers) and use their data?
Quote:Only when a mob is within a 16 block distance to any player (plain L1 or euclidean metric, no matter what the blocks are), let them grab the full 32^3
Tiny trick: if mob is close make a raycast first, if mob spotted player - then grab bigger area... That's my thought.

And even more: make a pyramid/cone, similar to culling space of camera, and check if mob-player line is inside it. Then raycast and then grab an area.
Reply
Thanks given by:
#10
will creepers blow up when you come close if the mobs are refactored??
Reply
Thanks given by:




Users browsing this thread: 5 Guest(s)