Jump to content
  • Latest updates

  • Newest Posts

    • Yes, it's possible. You can make a mod with resized cursor images (https://trac.wildfiregames.com/wiki/Modding_Guide). Default cursor is at mod/art/textures/cursors/default-arrow.png, in-game cursors are inside public/art/textures/cursors.
    • Can the size and color of the cursor be customized? I have poor vision. Consequently I keep "losing" the cursor. To improve its visibility, I would like to make the cursor bigger and to change its color.
    • Ok, I've got these errors with the second one :    So yes, itu says that is null, so how can I call my UpdateColor function if this is null ?
    • Weird because the second one is correct The first one registers a new interface for the engine. So it should never be called outside of the first initialisation of the component in the js file (Although you could create runtime components for nefarious purposes, I would advise against it) If the first one doesn't work, it means that whatever is calling that code doesn't have that component attached, which could mean the template is invalid.
    • I think I found something but I don't know how to use the UpdateColor function in another file. I tried this :  let cmpParticlePlayerColor = Engine.RegisterInterface("ParticlePlayerColor"); if (cmpParticlePlayerColor) { cmpParticlePlayerColor.UpdateColor(); } And this :  let cmpParticlePlayerColor = Engine.QueryInterface(this.entity, IID_ParticlePlayerColor); if (cmpParticlePlayerColor) { cmpParticlePlayerColor.UpdateColor(); } I think I understand why the second one doesn't work (wrong interface) but why the first one ?    I'm trying this because i saw that the UpdateColor function is called before the owner is set, and I think that's the problem.
    • I was curious so I did some testing in this c++ reference: https://en.cppreference.com/w/cpp/algorithm/stable_sort and it seems like stable_sort() is faster when there are redundant values, but when they are made quite different on purpose, sort() is faster.
    • int CompareLengthSquared(u64 cmpSquared) const { u64 d2 = SQUARE_U64_FIXED(X) + SQUARE_U64_FIXED(Y); // d2 <= 2^63 (no overflow) if (d2 < cmpSquared) return -1; if (d2 > cmpSquared) return +1; return 0; } https://code.wildfiregames.com/source/0ad/browse/ps/trunk/source/maths/FixedVector2D.h#:~:text=int CompareLengthSquared(,} ok so, yes the precision for lengths is 1 meter, but the differences are found for x^2+y^2, so for a 70 meter range archer, 1 meter out of up to 4900 is very little. So basically, the precision when sorting lengths gets higher the farther away the unit is: a single integer represents a range differences of 0.014 meters near 70 meters range. The relationship looks like this: The only thing is the relationship needs to be a parabola, so you can't just do (x^3/Px^2) because this would incorrectly rank units distances. I suppose the thing to do would be to use an integer square root estimation algorithm, and then integer division by the precision value. Then, the profiling would be needed to see if the potential improvements to sorting would be worth it. Even if its pretty similar, I think the impacts on the overkill situation would be nice. https://stackoverflow.com/questions/34187171/fast-integer-square-root-approximation
×
×
  • Create New...