[ANN] Arceus.jl Efficient runtime trait library

This is my first package. Wish me good luck. This package was awkwardly developed and is really cursed internally. Hopefully it’s still usable.

Please star it if you like it.

3 Likes

What does it do? What’s an arcane entity management system?

It stores up to 64 traits efficiently (Using a single Uint64), then, it efficiently evaluates statement

effectiveness =1.0
if (electro)
effectiveness *= 2.0
end
if (laser)
effectiveness *= 2.0
end
#etc

And turn it into a single lookup

arr[((Value&mask)*magic)>>shift]

Example use includes efficiently Calculating job weight and other attributes from species trait in Stellaris.

For example, the politician job weight modifier is as following.
Modifiers

  • Charismatic.png ×1.5 Charismatic
  • Trait necrophage.png ×1.5Necrophage
  • Trait void dweller positive.png ×1.5 Void Dweller
  • Domestic protocols.png ×1.5 Domestic Protocols
  • Trait traditional.png ×1.25 Traditional
  • Propaganda machines.png ×1.25Propaganda Machines
  • Trait brainslugged.png ×1.25 Brain Slug Host
  • Trait primitive.png ×1.13 Natural Intellectuals
  • Robust.png ×1.13 Robust
  • Trait quarrelsome.png ×0.75Quarrelsome
  • Repugnant.png ×0.5 Repugnant

We can turn this into a single mask, multiply, shift, lookup calculation.
Another example is… imagine if Pokémon can have more than 2 types, we can calculate the attack’s effectiveness by this principle as well.

2 Likes

Update: Fixed random dependency.