Mobs Spawn (and probably despawn and Tick)
#11
(07-11-2013, 02:06 AM)mgueydan Wrote: cNoise is good enough for me, but I think I'll a a coder-friendly method that return an integer in the specified range. As I didn't succeed to find one (the existing one need me to do the math at each call).

Thanks

Would you mind keeping that up to me? I'll code up a simple wrapper class for that, that will include the counter; I'll maybe even export it in the Lua API.
I think I'll have it ready by tomorrow; if you can wait that long, it'd be great.
Reply
Thanks given by:
#12
cFastRandom added in rev 1672. Go ahead and use that one; since you'll be calculating random values for each entity, feel free to use the entity ID as the a_Salt parameter Smile
Reply
Thanks given by:
#13
Thanks
Reply
Thanks given by:
#14
Sorry guys.

There is still alot of work to do on this subject, and I may will, but as I do not intend to go inside a tunnel thing, it post a patch right now. As the version is stable.

Major issues are :
1. As the light level detection is not coded right now (I think that cChunk::UnboundedRelGetBlock do no return the right thing for lighting), there are alot of hostile mobs spawning everywhere
2. As there is no collision detection, there are alot of logs added during launches due to monster going inside walls
3. My opinion is that there are very few passive animals (sheep, cow ...) and I think it's weird. I tried to debug it, but I ended in the conclusion that this is the result of the implemented algorithm and not a bug
4. I never saw any Wolf or Ocelot as spawning condition in this algorithm is very rare

Plus you will find alot of things that are undone (tag is "MG TODO", or "TODO MG", or sometimes just "TODO" but i tried to avoid it)

Plus there are lot of things I may use you don't like, and I have done in a way you wouldn't have. Specifically :
- I never ended my CheckStyle rules, so this is possible there are spaces where you don't want and missing spaces or carriage return too)
- I used alot of static sets and maps, and I saw you do not use to do that.

Plus there are a lot of things I would have done to make thinhs cleaner and I refrained :
- I didn't use any namespace, but I really think this would be much better
- I would have used alot more typedef (as you always are carrying ints) (Oh ! I forgot, I couldn't refrain on that : I named the mob type enum)
- I didn't replace global things like g_BlockTransparent by static member of an object cBlockManager or cTransparencyManager
- ...

As we talked of this a little bit, I assume some of those refactoring are in your head too, but the lack of working forces do not allow you fight every battle.

Thanks

Note : this patch (when it will be finalized) will solve at least part of thoses tickets :
- 403
- 101
- 348


Attached Files
.patch   MonsterSpawn.patch (Size: 22.16 KB / Downloads: 254)
Reply
Thanks given by:
#15
Hope you finish it soon, I'm waiting for this great patchBig Grin
Reply
Thanks given by:
#16
I can't review the patch now, as I still don't have proper access to the sources, but from the patch size of 22 KiB I'm assuming it's quite huge. Just don't over-do it Smile
Reply
Thanks given by:
#17
(07-19-2013, 05:42 AM)xoft Wrote: I'm assuming it's quite huge. Just don't over-do it Smile

You're right. I wasn't able to find "baby steps".
Plus the patch is not perfectly clean it include things like settings.ini.
Plus I tried to fully comment the headers and specifically the public methods.

In the end, there are less than 500 "true" code lines.

I hope you will be pleased anyway
Reply
Thanks given by:
#18
Does this also change the way slime spawn? Slime only spawn in certain chunks and in the swampland biome.
Reply
Thanks given by:
#19
So how's the work going on this? Any news?
Reply
Thanks given by:
#20
Sorry for the silence.
Another project is comming in front-line (with release date on the 31 August)
I shouldn't have underestimate the first correction time.

What's sure, is that I WILL do tese corrections, probably before middle September.
I hope it will be soon, as it's a shame having done almost all the work and let it wait now.

Thanks

(07-27-2013, 07:58 PM)STR_Warrior Wrote: Does this also change the way slime spawn? Slime only spawn in certain chunks and in the swampland biome.

Slime, Dragon, and other "weird" stuff are not spawned according to specific rules.

Once the light/daylight thing will be managed correctely, the mobs that will spawn right are : bats, squids, spider, zombie, skeleton, sheep, cow, chicken, pig.
Nether mobs, Cat and wolf has to be tested.

Everything else need further work
Reply
Thanks given by:




Users browsing this thread: 1 Guest(s)