Cuberite Forum
Mobs spawning - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html)
+--- Forum: Development (https://forum.cuberite.org/forum-13.html)
+--- Thread: Mobs spawning (/thread-630.html)

Pages: 1 2 3


RE: Mobs spawning - steven2612 - 11-20-2012

ok, that's what i've thought. This is done when health=0. I don't understand why the destroying is delayed when health=0 ?


RE: Mobs spawning - ThuGie - 11-20-2012

isnt it for the animation so it can be finished ?


RE: Mobs spawning - steven2612 - 11-20-2012

ok - that means i've to wait for the client ? I thought the client handles the animation independly of the server ...


RE: Mobs spawning - FakeTruth - 11-20-2012

It's for the death animation. If you destroy the mob it will simply disappear on the clients instead of dying.


RE: Mobs spawning - steven2612 - 11-22-2012

As i'm digging in the source code ... as i can see Entities are not yet read or stored with World Data ?

From the wiki:
"Approximately one in ten newly generated chunks will contain mobs, usually in packs of up to four of the same species."
if i want to do this - where to put this ? in the generator code ? world.cpp ? chunk.cpp?



RE: Mobs spawning - xoft - 11-22-2012

Entities are not stored in the world, that's right.

If you want to store them, you need to modify WorldStorage/WSSAnvil.h + .cpp to include entities when saving world, and then loading them back again from the files.

If you want to generate mobs (animals) with the world, I'd suggest making a new cFinishGen descendant for that (start in Generating/FinishGen.h + .cpp; but probably put it into a new file, it'll be a larger one). Note that most generator-related stuff in MCServer is quite configurable, so you might want to make yours configurable as well (amount of mobs in one group, number of groups, groups frequency, mob type freqencies... )


RE: Mobs spawning - steven2612 - 11-23-2012

(11-22-2012, 11:52 PM)xoft Wrote: If you want to store them, you need to modify WorldStorage/WSSAnvil.h + .cpp to include entities when saving world, and then loading them back again from the files.
ok, but i've seen other references for saving (in world.cpp, chunk.cpp, ..) where the comment looks like here is missing something ...

Quote:If you want to generate mobs (animals) with the world, I'd suggest making a new cFinishGen descendant for that (start in Generating/FinishGen.h + .cpp; but probably put it into a new file, it'll be a larger one). Note that most generator-related stuff in MCServer is quite configurable, so you might want to make yours configurable as well (amount of mobs in one group, number of groups, groups frequency, mob type freqencies... )
Yes i want to make a config file. But for mobs in common not only for generating also for spawning and behavier of the mobs (when doin'g the AI ) ...




RE: Mobs spawning - xoft - 11-23-2012

Those references may be some leftovers from the time when loading and saving was done directly in cWorld, cChunk and cChunkMap, instead of specialized classes. If you think a specific reference is of importance, feel free to ask, giving me the reference line number Wink

I think it'd be beneficial to keep generator-related stuff together, so the generator settings should go into world.ini's Generator section. Mob behavior could then be just in another section of the world.ini file - we'll have per-world settable mob behavior, yay! Smile

Are you really volunteering to rewrite the mob AI? That'd be awesome!
Still, I'd suggest you start a new thread on the forum, explaining in rough contours how you want the algorithms to work. It has proved useful, since others may have some insights why one part or another might prove problematic, and propose a different solution. It'd be better than writing lots of code, only to find out that it doesn't work well, for example with the threading model used in MCServer. Smile


RE: Mobs spawning - steven2612 - 11-23-2012

Wink
yes and no - i wanted to have an playable survival server with mcserver .. so i've to do something myself ...
i've not so much spare time, but i try to help as good as i can.

but first of all i want to make spawning done right - then i'm looking for the AI ... I've read many articels about AI, wayfinding and so on - maybe i can produce something working Wink - and yes - i will start an new thread then ...


RE: Mobs spawning - steven2612 - 11-24-2012

hm .. i looked into the finisher .. i didn't find an example where entities are generated. so i am quite unshure how to generate them.
in world.cpp there is a spawnmob function - but can/should i use this in a finisher ?
Also it's not clear yet (to me) if it needs to do a "Monster = new cSpider();" or simply generate an Entity for the AI?
I'm digging in the source .. but if someone has a hint for me it would speed things up ... Wink
ok
if each finisher ist: cEntityList & a_Entities

when i'm right - i 've to create e new entity with for example new cSpider - then add this to a_Entities. Is this only for the actual Chunk or for the whole world ?
For example if i generate a bulk of Mobs - have i to look that every one is within the actual chunk, or could they spawn in the surroundings chunks too ?