ChokePoint Enhanced

All mods from Reika

Moderator: Reika

Post Reply
JFS
Manual Inserter
Manual Inserter
Posts: 4
Joined: Mon Jul 23, 2018 11:11 am
Contact:

ChokePoint Enhanced

Post by JFS »

Sorry for making a thread, but 1) this is not a bug report, 2) there was no mod thread for ChokePoint.

I like the ChokePoint mod, but noticed some issues with it: with the mod installed, there was significant choppiness/lag while walking around (disabling just ChokePoint made the choppiness completely go away, and re-enabling the mod made the game laggy again). I benchmarked the different tile generation programs included in the mod, measuring how much time it took to reveal the same large area around the spawn point:

Code: Select all

/c game.forces.player.chart(game.player.surface, {lefttop = {x = -512, y = -512}, rightbottom = {x = 512, y = 512}})
I saw that there was a roughly linear relationship between the number of times the simplex function is invoked and the time it took to generate the tiles:
  • continents.lua (1x simplex): 38s
  • fusedcontinents.lua (2x simplex): 62s
  • rivercutsrings2.lua (3x simplex): 105s
  • rivercutsringswithland2.lua (4x simplex): 140s
However, with many of the faster programs the player can spawn inside deep water, instantly dying, and starting ore spawns can also be similarly affected.

So I made faster variants of the continents and rivers programs (only invoking simplex 1x), with added protection for the players' starting areas. (in light of the MIT license)

It's not as crude as just enforcing a strict no-water-zone, as that would result in sharp unnatural transitions at the boundary. Instead, I introduced a gradual bias added to the simplex noise that slowly tapers off the water mass as it approaches the spawn point. This creates a more natural-looking environment, where you can imagine the spawn point as the top of a small hill:

Image and Image

This is vanilla default, with my modified version of ChokePoints. Notice that on both maps, without the land bias spawn point protection, the player would have spawned inside deep water: there's a north-south river/canal that tapers off and leaves room around the start location only because of the added spawn protection.

I realize some computers can handle 4x simplex and some can't. So I added a mod setting to the GUI where players can choose from the algorithms:

Image
  • FastContinents is my modified 1x simplex continents variant. Example map.
  • PrettyContinents is based on 4x simplex fusedcontinentsbridge2.lua . Example map.
  • FastRivers is my modified 1x simplex rivers variant. Example map.
  • PrettyRivers is based on 4x simplex rivercutsringswithland2.lua (the default in 1.0.97). Example map.
FastContinents, FastRivers and PrettyRivers include my version of enhanced spawn protection. PrettyContinents includes a form of spawn protection that was present in fusedcontinentsbridge2, I just fixed a small multiplayer-related bug and made it a bit longer-range and scalable. All spawn protection can be tuned (or set to 0 to disable) in the mod settings:

Image

Here is my modified ChokePoint version, offered under the same MIT license. Reika, if you like it, feel free to incorporate the changes into your mod.
Attachments
ChokePoint_1.0.979.zip
(34.69 KiB) Downloaded 270 times

User avatar
Reika
Filter Inserter
Filter Inserter
Posts: 583
Joined: Tue May 19, 2015 1:56 am
Contact:

Re: ChokePoint Enhanced

Post by Reika »

JFS wrote:Sorry for making a thread, but 1) this is not a bug report, 2) there was no mod thread for ChokePoint.

I like the ChokePoint mod, but noticed some issues with it: with the mod installed, there was significant choppiness/lag while walking around (disabling just ChokePoint made the choppiness completely go away, and re-enabling the mod made the game laggy again). I benchmarked the different tile generation programs included in the mod, measuring how much time it took to reveal the same large area around the spawn point:

Code: Select all

/c game.forces.player.chart(game.player.surface, {lefttop = {x = -512, y = -512}, rightbottom = {x = 512, y = 512}})
I saw that there was a roughly linear relationship between the number of times the simplex function is invoked and the time it took to generate the tiles:
  • continents.lua (1x simplex): 38s
  • fusedcontinents.lua (2x simplex): 62s
  • rivercutsrings2.lua (3x simplex): 105s
  • rivercutsringswithland2.lua (4x simplex): 140s
However, with many of the faster programs the player can spawn inside deep water, instantly dying, and starting ore spawns can also be similarly affected.

So I made faster variants of the continents and rivers programs (only invoking simplex 1x), with added protection for the players' starting areas. (in light of the MIT license)

It's not as crude as just enforcing a strict no-water-zone, as that would result in sharp unnatural transitions at the boundary. Instead, I introduced a gradual bias added to the simplex noise that slowly tapers off the water mass as it approaches the spawn point. This creates a more natural-looking environment, where you can imagine the spawn point as the top of a small hill:

Image and Image

This is vanilla default, with my modified version of ChokePoints. Notice that on both maps, without the land bias spawn point protection, the player would have spawned inside deep water: there's a north-south river/canal that tapers off and leaves room around the start location only because of the added spawn protection.

I realize some computers can handle 4x simplex and some can't. So I added a mod setting to the GUI where players can choose from the algorithms:

Image
  • FastContinents is my modified 1x simplex continents variant. Example map.
  • PrettyContinents is based on 4x simplex fusedcontinentsbridge2.lua . Example map.
  • FastRivers is my modified 1x simplex rivers variant. Example map.
  • PrettyRivers is based on 4x simplex rivercutsringswithland2.lua (the default in 1.0.97). Example map.
FastContinents, FastRivers and PrettyRivers include my version of enhanced spawn protection. PrettyContinents includes a form of spawn protection that was present in fusedcontinentsbridge2, I just fixed a small multiplayer-related bug and made it a bit longer-range and scalable. All spawn protection can be tuned (or set to 0 to disable) in the mod settings:

Image

Here is my modified ChokePoint version, offered under the same MIT license. Reika, if you like it, feel free to incorporate the changes into your mod.
A lot of this is now no longer applicable - I did a lot of cleanup, and the performance is better. That said, I will probably include the spawn protection.

Also, the license for ChokePoint was never MIT - that was an error in the mod portal affecting many mods, including some of mine.
Image

adesazz
Burner Inserter
Burner Inserter
Posts: 6
Joined: Thu Oct 04, 2018 10:32 pm
Contact:

Re: ChokePoint Enhanced

Post by adesazz »

First off, thanks for this mod and thanks for updating to v17. Really looking forward to seeing this in action.

In control.lua my first line is [require "programs.rivercuts"] is that right? None of the programs I try seem to be taking but I also don't know how to tell for sure. I do get the handful of options for mod config in-game.

Thanks for any help

User avatar
Reika
Filter Inserter
Filter Inserter
Posts: 583
Joined: Tue May 19, 2015 1:56 am
Contact:

Re: ChokePoint Enhanced

Post by Reika »

adesazz wrote:
Mon Mar 25, 2019 3:50 am
First off, thanks for this mod and thanks for updating to v17. Really looking forward to seeing this in action.

In control.lua my first line is [require "programs.rivercuts"] is that right? None of the programs I try seem to be taking but I also don't know how to tell for sure. I do get the handful of options for mod config in-game.

Thanks for any help
If you did not specify the program correctly, the game would not even enter a map; it would throw an error.
Image

adesazz
Burner Inserter
Burner Inserter
Posts: 6
Joined: Thu Oct 04, 2018 10:32 pm
Contact:

Re: ChokePoint Enhanced

Post by adesazz »

Ah ok, thanks for the reply. I tried a dozen different formats with game reloads in between, I never got an error but I also never got a noticeable effect (I also ran Alien Biomes). Anyway if that's the right syntax I guess I'm stuck waiting for an in-game dropdown. Thanks again.

There will never be an ingame dropdown; that system cannot control the code like this.

Again, the fact you were loading without crashes means the code was running, whether you immediately noticed an effect or not.

Post Reply

Return to “Reika's Mods”