Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 14 22:58
    junkdog commented #592
  • Oct 14 22:57
    junkdog commented #592
  • Oct 13 14:49
    DaanVanYperen unlabeled #592
  • Oct 13 14:05
    DaanVanYperen closed #579
  • Oct 13 14:05
    DaanVanYperen commented #579
  • Oct 13 14:04
    DaanVanYperen unpinned #538
  • Oct 13 14:04
    DaanVanYperen closed #538
  • Oct 13 14:04
    DaanVanYperen commented #538
  • Oct 13 14:04
    DaanVanYperen labeled #538
  • Oct 13 14:04
    DaanVanYperen unlabeled #538
  • Oct 13 14:03
    DaanVanYperen closed #575
  • Oct 13 14:03
    DaanVanYperen commented #575
  • Oct 13 13:55
    DaanVanYperen closed #573
  • Oct 13 13:55
    DaanVanYperen commented #573
  • Oct 13 13:48
    DaanVanYperen closed #558
  • Oct 13 13:48
    DaanVanYperen commented #558
  • Oct 13 13:46
    Speiger commented #586
  • Oct 13 13:41
    DaanVanYperen unlabeled #558
  • Oct 13 13:41
    DaanVanYperen labeled #558
  • Oct 13 13:39
    DaanVanYperen milestoned #578
Florian “codneutro” B
@codneutro_gitlab
For instance, how would you manage a player inventory with features such as drag&drop, right-click on an item opens a context menu from which u can split the item
Piotr Jastrzebski
@piotr-j
you would stick entire thing into single entity, most likely
Florian “codneutro” B
@codneutro_gitlab
@piotr-j really ?
Piotr Jastrzebski
@piotr-j
unless you have a proper editor its more trouble then its worth trying to do gui with entities
Florian “codneutro” B
@codneutro_gitlab
dziękuję, do widzenia
Kamil Dąbrowski
@Namek
@gavar If you'd have multiple Renderable components tied to one entity then in what order would those be stored? What would manage that order. How would you implement the changing of that order and where would you save that order of multiple components of same type for every single entity? This complicates things A LOT. Rendering is not the only example.
Bart van Helvert
@Bartvhelvert
Anyone knows if it is possible to add components to an entity outside a system?
Max Stankevich
@gavar
@Namek as I mentioned above, they should not be sorted by default in the place where the're stored. In my example I sort Renderable components by redner-layer, render-order and natural order they been added to an entity: https://github.com/gavar/google-front-end-web-developer/blob/develop/exploring-js/13/src/ts/systems/sort.ts#L49-L54
If we're talking in Artemis context, I see that as an option of Aspect class, which sorts the collection whenever something added, removed or order changed. The order is part of compnent itself, so component which does note require ordering just don't have one. I wouldn't say that it complicates things a lot, it makes the lookup process little bit slower (still O(1) but amortized)
Fabien
@kaychamo_gitlab
hey, little design question. how can i handle the checks in my ecs/libgdx tower defense
for example when the player wants to build a new tower, when should I control if PlayerMoney is high enough?
i'm a bit lost because I start to have a lot of code in my libgdx code (ui, scene, stage...)
and i would prefer to concentrate on the ecs systems but my ui needs to know things before it allow actions
maybe i would like to grey out the build tower button if money is not enough. but that would mean some dirty code in the design to call the logic?
Fabien
@kaychamo_gitlab
@Bartvhelvert i use this after world creation :
Entity e = world.createEntity(); e.edit() .add(new PlayerGoldComponent()) .add(new PlayerTowerLimitComponent()); world.getSystem(TagManager.class).register("PLAYER", e);
Florian “codneutro” B
@codneutro_gitlab
Hello guys, I would like to know how would you manage a system that can be created multiple times (for instance an AssetSystem whose job consists of loading multiple texture atlases via an AssetManager (libgdx object)) but need to load data only once ? This system is shared among all my game Screens. Thanks.
Hiverize
@Hiverize
Hi, yould you help me understand links between components better? I want entities to be able to become allies in the game. I do not know how many allies an entity may have, that changes dynamically. So how do I achieve that with an EntityLinkManager? I add the "anchor" component to my entity, but how do I hande the changing number of "targets"?
schosin
@schosin
I'm currently writing my own SystemInvocationStrategy and now that I'm done with the actual processing, I'm looking into implementing other basic functionality (setEnabled, checkProcessing, ...) and I just realized that I cannot call BaseSystem#begin() and #end() myself, which kinda sucks. Any ideas that dont end in "eflection" or hacking artemis-odb on how to have a begin/end mechanic? Interface with both methods (default impl) and check with instanceof? I can't think of a decent solution.
Daan van Yperen
@DaanVanYperen
If you guys haven't yet join the libgdx discord https://discord.gg/7c6Wg8H. It has a very active (text) ECS channel with Ashley and Artemis-odb users.
HerrDerb
@HerrDerb
Is there a reason artemis is still on java 1.7?
Daniel Anderson
@Mr00Anderson
Oh hey I joined this finally.
Kamil Dąbrowski
@Namek
\o/
Daniel Anderson
@Mr00Anderson
0/
Kamil Dąbrowski
@Namek
@schosin just curious, what's the use case?
Kamil Dąbrowski
@Namek
image.png
Kamil Dąbrowski
@Namek
artemis_entity_tracker_2.gif
Kara Valentine
@archmage

Hey all! Is there a way to attach an existing component to an entity? I've been reading docs and searching issues for a little while, particularly https://github.com/junkdog/artemis-odb/wiki/Component, and there doesn't seem to be a nice way of doing it.

I wanna do something like:

val existingPositionComponent = Position(4, 7) // more complex than this in practice
// later...
mPosition.attach(entityId, existingPositionComponent)
Kamil Dąbrowski
@Namek
@archmage world.edit(entityId).add(existingPositionComponent) ?
Kara Valentine
@archmage
Thanks! I'll have to try it when I'm next at my codebase
Kara Valentine
@archmage

I also ran into an issue with artemis-odb's reflection when paired with Scala's case classes and default values. The reflection throws errors saying there's no blank constructor for a file such as:

case class Position(x: Int = 0, y: Int = 0) extends Component
// default values allow it to be called as:
val position = Position() // x = 0, y = 0

I know technically there's no blank constructor, because the only constructor takes two parameters, but because of the default values provided you can instantiate it without parameters provided... which looks exactly the same as calling a blank constructor. Evidently it doesn't transpile to that though? I'm not really sure how to resolve this.

I don't really want to have to do:

class Position() extends Component {
  var x = 0
  var y = 0

  def this(x: Int, y: Int) {
    var position = Position()
    position.x = x
    position.y = y
    position
  }
}

for every component I write.

I know artemis-odb isn't a Scala library and I believe junkdog doesn't work with Scala, so I'm not particularly hopeful with this one, but if I could find a solution here, it'd be much appreciated <3
Kamil Dąbrowski
@Namek
@archmage have you tried with the var keyword? I don't expect a different result but still.
case class Position(var x: Int = 0, var y: Int = 0) extends Component
Kamil Dąbrowski
@Namek
maybe the other way?
case class Position(var x: Int, var y: Int) extends Component {
    def this() = this(0, 0)
}
it seems that this is a won't fix bug in Scala: scala/bug#4278
kitaness
@kitaness
Yep, I ended up having to do the def this() = this(defaults...) thing for every component back when I was using artemis-odb on scala.
Kara Valentine
@archmage

I did some more research into this and found that wontfix, along with a StackOverflow question about possible workarounds. I guess it's going to be ugly no matter how it's sliced :/

I did try the var thing, yeah - no dice on that one.

Thanks anyway, folks.

kitaness
@kitaness
It's a bit of an annoyance, especially for components with parameters that don't have any sensible default value. But overall artemis-odb works pretty well with scala and there aren't a lot of issues like this.
LaurenceWarne
@LaurenceWarne
Hi all, I created a new plugin for artemis: https://github.com/LaurenceWarne/artemis-odb-component-lookup (:
Kara Valentine
@archmage
Woah, the @One and @Exclude annotations thing for systems is new! I like it!
schosin
@schosin
@Namek I was basically playing around with a multi-threaded system invocation strategy. Had everything in place, but then I came across the mentioned limitations.
Bertozzi Julien
@JulienBe

Hello everyone, I have an issue when trying to use TagManger, it's null when I get it:

    override fun show() {
        val playerEntityId = world.create(Builder.player.build(world))
        Setup.player(playerEntityId, world)
        Gdx.input.inputProcessor = GInput
    }
    fun player(playerEntityId: Int, world: World) {
        val tagManager = world.getSystem(TagManager::class.java)
        println("tagManager: $tagManager") // there it's null
    }

What am I doing wrong ? :3

schosin
@schosin
Artemis injects systems if you declare them as fields. Just add "private TagManager tagManager;" (or the kotlin equivalent) to your system
iirc you also have to add TagManager to the world yourself, not 100% sure though
Bertozzi Julien
@JulienBe
@schosin Haaa thanks, I'll give it a try when I get home :)
Bertozzi Julien
@JulienBe
Thanks !
schosin
@schosin

What would be a decent way to handle systems being dependent on what other systems did with an entity?

My current example is rendering a name tag and a health bar above an entity. The health bar is only visible if it's not full, so the name tag must be offset depending on that.
I don't really like the idea of combining both systems or them somehow sharing state or the name tag system checking the health component, requiring knowledge of how the health system rendered the health bar.

Marcus Lagerström
@ghroot
sounds like the easiest solution would be to combine the systems into UnitInfoRenderingSystem?
or that both systems adds and edits ui components in some kind of container that automatically aligns above the unit
schosin
@schosin
I postponed the problem by not bothering with names yet, but I guess a UnitInfoRenderingSystem would work the best. Especially if I decide it has to be more fancy than just rendering them on top of each other.
Nikos Lazaridis
@KeyC0de
Guys a question. Is there a C++ version of this library, or similar to it? Cheers junkdog, great library.
Daniel Anderson
@Mr00Anderson
Yes.
Its linked on the main wiki.
Nikos Lazaridis
@KeyC0de
I'm afraid I don't see it.