HG means HG so make one more HG :)
openRA has many disadvantages nested in TerrainRenderer concept.
Do you prefer SequnceProvider & TerrainSpriteLayer or Theater ?
if you do
then you do use SequnceProvider & TerrainSpriteLayer.
if you do
then you do use Theater
SO let the battle SequnceProvider & TerrainSpriteLayer vs Theater begins:)
Battle for what?
How many draw calls.
How many CPU eats each other.
Battle for D2TerrainLayer : IRenderOverlay (dune2 mod)
D2TerrainLayer (dune2 mod)
Сonvert from self TerrainSpriteLayer to renderer linked to Theater and it is IRenderTerrain renderer!
Next:
Сhange sideSprites to wr.Theater.TileSprite(t, 0) and gotcha.
Total:
-1 draw batch with huge count(38400) of vertexes on 128x128 cells map
That was too simple as beginning implies.
Next batlle ResourceLayer.cs
Simply it holds Content for logick and RenderContent for sprites that logick linked.
Two events can interfer to ResourceLayer it is : Harvest and Destroy method.
RL=ResourceLayer
TSL=TerrainSpriteLayer
Harvest and Destroy methods modifies Content list.
While it modifies Content list this methods updates RenderContent list.
And as on picture above u see RenderContent.CellEntryChanged method that update quad for resource cell in TSL vertex buffer.
After RL needs to redraw the cells that was changed by Harvest or Destory methods.
For now, RL setups self TSL with size of the whole map.
Then RL updates TSL and finally on RL.Render it draws all Content list and adds +1 draw batch!
For now it alwasy adds 1+ draw batch
that picture shows why it cant optimize +1 draw batch in each frame.
HG means HG so make one more HG :) openRA has many disadvantages nested in TerrainRenderer concept.
Do you prefer SequnceProvider & TerrainSpriteLayer or Theater ?
if you do then you do use SequnceProvider & TerrainSpriteLayer.
if you do then you do use Theater
SO let the battle SequnceProvider & TerrainSpriteLayer vs Theater begins:)
Battle for what?
Battle for D2TerrainLayer : IRenderOverlay (dune2 mod)
Сonvert from self TerrainSpriteLayer to renderer linked to Theater and it is IRenderTerrain renderer!
Next:
Сhange sideSprites to wr.Theater.TileSprite(t, 0) and gotcha. Total: -1 draw batch with huge count(38400) of vertexes on 128x128 cells map
That was too simple as beginning implies.
Next batlle ResourceLayer.cs Simply it holds Content for logick and RenderContent for sprites that logick linked. Two events can interfer to ResourceLayer it is : Harvest and Destroy method.
RL=ResourceLayer TSL=TerrainSpriteLayer
Harvest and Destroy methods modifies Content list. While it modifies Content list this methods updates RenderContent list. And as on picture above u see RenderContent.CellEntryChanged method that update quad for resource cell in TSL vertex buffer. After RL needs to redraw the cells that was changed by Harvest or Destory methods.
For now, RL setups self TSL with size of the whole map. Then RL updates TSL and finally on RL.Render it draws all Content list and adds +1 draw batch!
For now it alwasy adds 1+ draw batch
that picture shows why it cant optimize +1 draw batch in each frame.
ResourceLayers wins for now:)