Menu

#306 feat: mob complexity reduction

open
nobody
None
3 days ago
3 days ago
Anonymous
No

Originally created by: SpikeHD

Makes two changes:

  1. Reduces mob complexity by hoisting repeat boilerplate to the parent trait
  2. Fixes a bug where uniform int RNG was not inclusive (which I discovered via killing many pigs and never getting 3 porkchops as a drop)

With this, writing mobs should be slightly easier and more focused on the individual implementations!

Discussion

  • Anonymous

    Anonymous - 3 days ago

    Originally posted by: 4lve

    personally I think it make some problem because we go from just a dyn Entity where the compiler can optimise to inline function to an dyn Entity that try to get a dyn LivingEntity, dyn Ageable, dyn Animal, etc so we double the cost of vtable. I think there is more optimised way to do it

    Yea, functions like these are usually not in hot loops though so it should be fine

     
  • Anonymous

    Anonymous - 3 days ago

    Originally posted by: 4lve

    Being able to somehow get rid of all the boilerplate variant functions would be nice, maybe just like a sound_variant_registry getter function or something?

     
  • Anonymous

    Anonymous - 3 days ago

    Originally posted by: coco875

    Yea, functions like these are usually not in hot loops though so it should be fine

    there is tick who are affected by that so it's in a hot loop

     

Log in to post a comment.