@Empire Phoenix said:
Hashmap, the answer is nearly always a hashmap.
In the par tthat does the rendering add a hashmap with entityid to mywhatever object.
Where mywhatever objects stores wich one is last displayed.
I'm not absolutely clear about that... maybe it could work with a hasmap tile/position to mywhatever object, since the problem is that I have to distinguish multiple entities.
what exactly si slow with your entity renderset? The actual issuing of the update? or the logic that processes it.
The part where I reread the entity set for the actual height layer:
[java]
entityData.getEntities(new FieldFilter(Position.class, "z", this.layer), Position.class, RenderComponent.class);[/java]
@pspeed said:
Is this for the map of where the game is happening or just for a visual display? Or is it both really?
It sounds like maybe the visual representations of objects are being mixed with the entities. The first should be a view of the second and will almost always necessarily have its own objects. Like a spatial for an entity in scene graph terms.
The map represents the whole place of the game, so it holds a value for each tile. Either for open space or for a type of wall. I’d use an array int
for my map data, with int values assigned to block types. Whenever I get to render, I’d take this array and use a lookup-table to match these values to their actual display char, and create a (not es-based) object for the view. The values from the array would also be used for e.g. collision detection. So far everything is okay, I think.
But where I probably already mixed it up, is everything that is not represented in the map data, so everything that is not static, as items, buildings, units. My first approach was to give all these things a RenderComponent with their graphical representation. But this comes to a problem at least at the point where I want to change the view of a entity, e.g. change the color to red for a hurt unit.
So my next idea is to use entity sets to define how a entity is represented, e.g.
[java]entityData.get(new HealthBelowFilter(30), Position.class)[/java]
and represent every entity within this set as a red char. What lets me hesitate to use this approach is that I’d have to hardcode everything, so not very elegant, too.