Anchoring RoomVisuals to creeps.


  • TMB

    I've been willing to place visuals onto some creeps, but I'm facing a small issue: creeps are able to visually move during , while visuals can't.

    0_1543085218637_Video_1543066318.gif

    I wish it was possible to attach the room-visual to an room object, so the visual would move along with the object. Additional XY parameters would then be used relatively to the object's center.

    API-wise, adding an optional anchor to the functions would multiply the amount of overload for each of RoomVisual's functions. Since javascript doesn't really support overloads in the first place, I don't think this is a best solution.

    What I think would feel the most consistent across all the visual functions is to embed "anchor" into the pos parameter. As it turns out, pos does not need to derive from RoomPosition, you can write an object literal and it will work just fine :

    room.visual.circle({x:25, y:25, anchor: creep.id});
    

    Passing the id of the object instead of the object itself would allow anchoring visuals onto objects you don't have visibility on. If the object does not exist or is not in the right room, the visual will not be drawn.

    👍


  • Use creep.say for that, it may be not a pretty symbol but it works.


  • TMB

    Well, I used this gif because I had it ready, but in the end it's not about displaying resources badges on my creeps, it's about displaying info on hostiles creeps, which won't let you use the native creep.say.
    (I do have a custom implementation that works on every single RoomObject, owned or not, but it relies on RoomVisuals as well...)

    Plus the amount of character you're able to speak is surprisingly low (10), so not really handy if I ever wanted to display detailled datas. It's more fit for displaying occasional messages than a constant custom ui.



  • While I understand your problem I also view it as very insignificant.
    Lets put it under the category "nice to have"

    Also I get a feeling you spend way to much CPU on a shiny UI 😅


  • TMB

    I don't expect to get this any time soon nor need it urgently; if I can get this into the devs' backlog it will be good enough.

    I don't have a very extensive custom UI... yet. RoomVisuals helps so much with understanding what's going on at a glance.