Ludeon Forums

RimWorld => Mods => Unfinished => Topic started by: neitsa on August 10, 2017, 11:08:41 AM

Title: [A17] Prepare Landing
Post by: neitsa on August 10, 2017, 11:08:41 AM
A few ongoing tests for my PrepareLanding (https://ludeon.com/forums/index.php?topic=34592.0) mod.

note: this is not an update, just a few tests (if they are conclusive they will make it to the next release)

I'm currently doing a few test for world map overlays (at the moment only temperature for biomes).

I have hit a problem right now: I'm using a class inheriting from RimWorld.Planet.WorldLayer to draw the meshes over the map but it's damn slow (it takes around 30 seconds for a big biome on 30% planet coverage). I might be able to optimize the code but I doubt I'll be able to get below 15 seconds... Anyway, more tests to come.

Here's a preview:

(http://i.imgur.com/zMpRrkJh.png)

Title: Re: [A17] Prepare Landing
Post by: SpaceDorf on August 10, 2017, 12:08:06 PM
Can you overwrite the draw class for the hex itself ?
So the hex places the hue on its own when drawn according to its own temperature..
Title: Re: [A17] Prepare Landing
Post by: neitsa on August 12, 2017, 08:11:21 AM
Quote from: SpaceDorf on August 10, 2017, 12:08:06 PM
Can you overwrite the draw class for the hex itself ?
So the hex places the hue on its own when drawn according to its own temperature..

Hi SpaceDorf  :)

This is, sort of, what I do: hexes on the world map are drawn on layers (biome, hilliness, road, rivers, etc) and they all ultimately inherit from the RimWorld.Planet.WorldLayer class, which is the class that draw things on the world map. There are two draw types: single tiles (e.g currently selected tile, tile under the mouse, etc.) or batch of tiles (biomes, etc.). I'm currently using the "batch of tiles" way of doing this.

In the end it's more or less the same thing, either you draw <number_of_tiles> time one "template" tile (just changing it's color, as you mentionned) or draw 1 time <number_of_tiles> in a batch process.

You question made me think that I could use one of those pre-existing batch to draw the color rather than drawing a new layer (e.g use the biome drawing and change the color of the biome tile), but the problem is that I need to patch the drawing algorithm and I really try to not patch the vanilla game as much as I can.
Title: Re: [A17] Prepare Landing
Post by: SpaceDorf on August 12, 2017, 08:17:53 AM
That was what I was thinking.
But I can understand if you prefer to add to the Vanilla algorithm than change it or make it do something it is not supposed to do .. this could have bad consequences later on.

for example when drawing the planet later in the game your method could still try to change things when it should not ..
I did not think about that .
Title: Re: [A17] Prepare Landing
Post by: DoctorVanGogh on August 13, 2017, 03:01:03 PM
I really hope it's the RegenerateNow call that's taking those 15 seconds, not the actual rendering itself...