Started by Ranran on indefinite leave, February 13, 2022, 12:16:13 PM
0 Members and 1 Guest are viewing this topic.
Quote from: neroden on April 28, 2023, 03:08:11 PMHonestly, I always crank the number of rivers WAY up (to 1024+) and live with the long map generation time. I think it's an important part of the game... I agree that the default number of rivers should be scaled with map size, like the number of towns and the number of industries (so should the number of attractions). My default choice is huge.Maybe there's a way to make the river generation process faster. It currently generates one river (with the river builder tool) and modifies the map, then generates another river and modifies the map, etc. For initial map generation, there may be some way to do this a lot faster. It would be worth profiling it to see where the most time is spent.If it's in riverbuilder.calc_route, I don't have great ideas, since that's not very parallelizable.But if it's in riverbuilder.build, we could do something else: we could precalc the routes for all the rivers, put them in a shadow array (parallel to karte_t, but just with one byte per map tile) explaining where the rivers of each size are going to go, and then arrange a "mass build" to rewrite the topography all at once. A big coding project but quite viable. riverbuilder.build_shadow would adjust the shadow array and then there would be a routine to apply the changes from the shadow array to the topography all at once.If it's in riverbuilder.init_builder, that's another problem and there may be some way to address that.And there's another possibility. Currently way_builder_t isn't really using object-oriented programming. Perhaps a subclass of way_builder_t (river_builder_for_map_generation_t) could be created which *just* builds rivers, deleting all the code for building other stuff, and *this* could be called by the initial river generation code. It could also delete a whole bunch of unnecessary checks for stuff which doesn't exist in a new map (piers, etc. etc.) I might try this first, it seems easiest.Anyway, I think it's worth seeing if the river generation code can be sped up.