MovingBlocks / FacadeAWT

A facade showing the game in a pure 2D version using AWT rather than LWJGL
3 stars 4 forks source link

Use faster drawing for small tiles #4

Open msteiger opened 10 years ago

msteiger commented 10 years ago

Currently, drawImage() is used to draw individual tiles. Using drawLine(), fillRect() or maybe setting raster data directly should be a lot faster for tiles that are smaller than 2x2 pixels.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/12238948-use-faster-drawing-for-small-tiles?utm_campaign=plugin&utm_content=tracker%2F539380&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F539380&utm_medium=issues&utm_source=github).
mkienenb commented 10 years ago

Or it may be that we should skip drawing tiles at 2x2 and 1x1 and go straight to the city-rendering-view

On Fri, Feb 28, 2014 at 2:48 AM, Martin Steiger notifications@github.comwrote:

Currently, drawImage() is used to draw individual tiles. Using drawLine(), fillRect() or maybe setting raster data directly should be a lot faster for tiles that are smaller than 2x2 pixels.

Reply to this email directly or view it on GitHubhttps://github.com/MovingBlocks/FacadeAWT/issues/4 .

msteiger commented 10 years ago

The cities renderer relies on two aspects: it uses the 2D (simplex noise) height map directly, which is a lot faster than creating actual chunks and extracting the height map from there.

Second, it uses an intermediate structure (the Brush) that just writes the block with the highest y value to a 2D array instead of creating chunks.

I think that both approaches are difficult to generalize and therefore won't work for other world generators. If that's ok, we can surely speed up the rendering a lot, but it will work for "Cities" worlds only. What do you think?

mkienenb commented 10 years ago

If you are willing to give it a try, that sounds good. Right now we don't have anything that works, right? So getting it to work with Cities worlds is a start.

On Fri, Feb 28, 2014 at 4:37 AM, Martin Steiger notifications@github.comwrote:

The cities renderer relies on two aspects: it uses the 2D (simplex noise) height map directly, which is a lot faster than creating actual chunks and extracting the height map from there.

Second, it uses an intermediate structure (the Brush) that just writes the block with the highest y value to a 2D array instead of creating chunks.

I think that both approaches are difficult to generalize and therefore won't work for other world generators. If that's ok, we can surely speed up the rendering a lot, but it will work for "Cities" worlds only. What do you think?

Reply to this email directly or view it on GitHubhttps://github.com/MovingBlocks/FacadeAWT/issues/4#issuecomment-36334758 .