join
within join
by using just Entities
to get both entities, then compare them for inequality and then access storages. In our game I think we first did that, but now were doing simple sweep-and-prune by using flagged storage to maintain internal data structure.
world.insert(unsafe { transmute::<&'_ DebugOverlay, &'static DebugOverlay>(surface.debug_overlay()) });
hey, can someone tell me if a VecStorage will ever shrink in size?
Looking at the VecStorage implementation of UnsafeStorage it seems that when entities as entities are added the vec grows, but the only way it can shrink is when it is cleaned, where all entities are removed. Is my thinking correct?
EventChannel
resource which can be read and written to by systems. This allows specs/shred to optimize which systems can be executed in parallel automatically, like it's done for component reads/writes. It's working pretty nicely for me so far. Also, this is how specs does events internally for its FlaggedStorage, which allows you to check if/which components have been modified.
I have a problem with pathfinding. I wrote a function to calculate paths. It needs bunch of storages, read-only. Unfortunately, one system that interacts with pathfinding requires one of this storages for mutable access. I had to specify WriteStorage
for pathfinding arguments just because one of system needs it this way. Documentation specifies that it is forbidden to require both ReadStorage
and WriteStorage
simultaneously, so I cannot do that. At this point it doesn't really bother me that much, but I suspect I will have problem with FlaggedStorage
in future.
Is there way to specify argument type for function so it would accept both ReadStorage
and WriteStorage
whichever is available for me in the system, so I can pass it to pathfinding?
i'm having trouble using the .join() method outside of the System trait implementation block. anyone know how i should fix it?
pardon the ugly code, but here is something that I'm having issues with.
https://pastebin.com/wzURVPS5
the method at line 121 does not work when used in a method for the Ai struct, but it does inside the system's .run() function at line 156. what am i doing wrong? perhaps am I just structuring my code wrong in the first place? should I be approaching this sort of thing in a different way?
for (player_entity, target_pos, player) in (&data.entities, &data.positions, &data.players).join()
Hi,
I'm new to rust and specs. I writing a system that needs to access a data that is not owned by specs::World and cannot be copied into world as a resource. What is a good way to pass a data's reference into system's run method? I also cannot store a reference to the data inside of system type because it's lifetime much shorter than the system.
saveload
in specs
" or "no saveload
in the root" for "use specs::saveload;". In Cargo.toml, i have 0.15.1 version. Thanks all.
specs
and maps. This stuff is all new for me and I don't really know if it is a good approach to use ECS for map rendering? For example right now I use a "map" as a component. This map contains lines, points and so on. For each map I then create entities which represents a "level". And one system which is responsible for handling the rendering in the end? Why I am asking? Because technically a map is not a entity. Right, or do I miss something?