[1.1.80] force_generate_chunk_requests does not respect generate_with_lab_tiles
Posted: Sat Jun 03, 2023 2:08 am
Hello, I own the mod Blueprint Sandboxes and while developing a new feature for it I ran into a minor bus that I was able to workaround, but it worsens performance and might have other implications.
The problem seems entirely reproducible, straight-forward, and obvious, but I will provide surrounding architectural context in case it helps.
Here is a quick log where I started a new game, entered the Sandbox, then cleared the Sandbox, then quit.
The problem seems entirely reproducible, straight-forward, and obvious, but I will provide surrounding architectural context in case it helps.
Overall Flow
Creating (a player wants to enter their Sandbox for the first time):- game.create_surface({default_enable_all_autoplace_controls = false, cliff_settings = { cliff_elevation_0 = 1024 }})
- on_surface_created is handled by the mod, equipping it with custom contents
- surface settings are set, like generate_with_lab_tiles
- player.surface.clear(false)
- on_surface_cleared is handled by the mod, equipping it with custom contents
Previous Handler
There was not an issue in this case, which is somewhat surprising.- Three surface.create_entity method calls within [[0, -2], [0, 2]]
New Handler
Now we have an ItemStack with a Blueprint inside. Simply calling build_blueprint will not place anything, presumably because Chunks aren't generated yet. So, Chunks are generated, but that happens incorrectly, so they must be cleaned up afterwards.- surface.generate_with_lab_tiles = true (as an attempt to definitely set this before any chunks are generated, but it has no effect whether it's true or false)
- Determine bounding box of Blueprint
- surface.request_to_generate_chunks({ x = 0, y = 0 }, chunkRadius)
- surface.force_generate_chunk_requests()
- These new Chunks were not generated with lab tiles; they were generated however the surface would have generated them if that setting was false
- For each Entity in surface.find_entities(), entity.destroy({ raise_destroy = true })
- surface.destroy_decoratives({ { { -radius, -radius }, { radius, radius } }, { 0, 0 } })
- For each X, Y within the expected Chunks to have been generated, determine which lab tile would have been placed; then, surface.set_tiles(tiles)
- Finally, build the Blueprint, twice, since the first attempt might have only placed Tiles and not the Entities on top of them: stack.build_blueprint({ surface = surface.name, force = forceName, position = { 0, 0 }, force_build = true, skip_fog_of_war = true, raise_built = true })
Here is a quick log where I started a new game, entered the Sandbox, then cleared the Sandbox, then quit.
Code: Select all
0.000 2023-06-02 18:50:47; Factorio 1.1.80 (build 60618, linux64, full)
0.004 Operating system: Linux (Arch rolling)
0.004 Program arguments: "/home/cameron/src/factorio/factorio/factorio"
0.004 Config path: /home/cameron/src/factorio/factorio/config/config.ini
0.004 Read data path: /home/cameron/src/factorio/factorio/data
0.004 Write data path: /home/cameron/src/factorio/factorio [495107/1031018MB]
0.004 Binaries path: /home/cameron/src/factorio/factorio/bin
0.007 System info: [CPU: 12th Gen Intel(R) Core(TM) i9-12900KF, 24 cores, RAM: 128687 MB]
0.007 Environment: DISPLAY=:0 WAYLAND_DISPLAY=<unset> DESKTOP_SESSION=i3 XDG_SESSION_DESKTOP=i3 XDG_CURRENT_DESKTOP=i3 __GL_FSAA_MODE=<unset> __GL_LOG_MAX_ANISO=<unset> __GL_SYNC_TO_VBLANK=<unset> __GL_SORT_FBCONFIGS=<unset> __GL_YIELD=<unset>
0.007 Display options: [FullScreen: 1] [VSync: 1] [UIScale: custom (175.0%)] [Native DPI: 1] [Screen: 255] [Special: lmw] [Lang: en]
0.024 Available displays: 1
0.024 [0]: LG HDR 4K 27" - {[0,0], 3840x2160, SDL_PIXELFORMAT_RGB888, 60Hz}
0.270 Initialised OpenGL:[0] NVIDIA GeForce RTX 3080 Ti/PCIe/SSE2; driver: 3.3.0 NVIDIA 530.41.03
0.270 [Extensions] s3tc:yes; KHR_debug:yes; ARB_clear_texture:yes, ARB_copy_image:yes
0.270 [Version] 3.3
0.270 Graphics settings preset: very-high
0.270 Dedicated video memory size 12288 MB
0.323 Graphics options: [Graphics quality: high] [Video memory usage: all] [DXT: high-quality] [Color: 32bit]
0.323 [Max threads (load/render): 32/24] [Max texture size: 0] [Tex.Stream.: 0] [Rotation quality: normal] [Other: STDCWT] [B:0,C:0,S:100]
0.359 [Audio] Backend:SDL(default); Driver:pulseaudio, Device:Default device, Depth:16, Channels:2, Frequency:44100
0.537 Info ModManager.cpp:257: Found duplicate mod angelsbioprocessing, using higher version (0.7.22 > 0.7.21).
0.539 Info ModManager.cpp:257: Found duplicate mod angelsbioprocessing, using higher version (0.7.24 > 0.7.22).
0.565 Info ModManager.cpp:257: Found duplicate mod bobassembly, using higher version (1.1.6 > 1.1.5).
0.578 Info ModManager.cpp:257: Found duplicate mod boblogistics, using higher version (1.1.6 > 1.1.5).
0.585 Info ModManager.cpp:257: Found duplicate mod bobores, using higher version (1.1.6 > 1.1.5).
0.587 Info ModManager.cpp:257: Found duplicate mod bobplates, using higher version (1.1.5 > 1.1.3).
0.588 Info ModManager.cpp:257: Found duplicate mod bobplates, using higher version (1.1.6 > 1.1.5).
0.592 Info ModManager.cpp:257: Found duplicate mod bobrevamp, using higher version (1.1.5 > 1.1.3).
0.592 Info ModManager.cpp:257: Found duplicate mod bobrevamp, using higher version (1.1.6 > 1.1.5).
0.593 Info ModManager.cpp:257: Found duplicate mod bobtech, using higher version (1.1.6 > 1.1.3).
0.596 Info ModManager.cpp:257: Found duplicate mod bobwarfare, using higher version (1.1.6 > 1.1.5).
0.597 Info ModManager.cpp:257: Found duplicate mod BottleneckLite, using higher version (1.2.4 > 1.2.3).
0.605 Info ModManager.cpp:257: Found duplicate mod Constructron-Continued, using higher version (1.0.44 > 1.0.34).
0.606 Info ModManager.cpp:257: Found duplicate mod Constructron-Continued, using higher version (1.0.54 > 1.0.44).
0.607 Info ModManager.cpp:257: Found duplicate mod Constructron-Continued, using higher version (1.0.73 > 1.0.54).
0.607 Info ModManager.cpp:257: Found duplicate mod Constructron-Continued, using higher version (1.0.74 > 1.0.73).
0.622 Info ModManager.cpp:257: Found duplicate mod flib, using higher version (0.12.6 > 0.12.3).
0.622 Info ModManager.cpp:257: Found duplicate mod flib, using higher version (0.12.9 > 0.12.6).
0.632 Info ModManager.cpp:257: Found duplicate mod Gun_Turret_Alerts, using higher version (1.1.11 > 1.1.10).
0.642 Info ModManager.cpp:257: Found duplicate mod informatron, using higher version (0.3.4 > 0.3.3).
0.645 Info ModManager.cpp:257: Found duplicate mod jetpack, using higher version (0.3.13 > 0.3.8).
0.948 Info ModManager.cpp:257: Found duplicate mod RateCalculator, using higher version (3.1.2 > 2.4.6).
0.976 Info ModManager.cpp:257: Found duplicate mod rocket-log, using higher version (1.1.10 > 1.1.7).
0.976 Info ModManager.cpp:257: Found duplicate mod rocket-log, using higher version (1.1.11 > 1.1.10).
1.005 Info ModManager.cpp:257: Found duplicate mod space-exploration, using higher version (0.6.108 > 0.6.104).
1.025 Info ModManager.cpp:257: Found duplicate mod TaskList, using higher version (0.4.5 > 0.4.3).
1.037 Loading mod settings blueprint-sandboxes 1.15.0 (settings.lua)
1.039 Loading mod core 0.0.0 (data.lua)
1.060 Loading mod base 1.1.80 (data.lua)
1.201 Loading mod blueprint-sandboxes 1.15.0 (data.lua)
1.206 Loading mod base 1.1.80 (data-updates.lua)
1.210 Loading mod blueprint-sandboxes 1.15.0 (data-updates.lua)
1.216 Loading mod blueprint-sandboxes 1.15.0 (data-final-fixes.lua)
1.217 Script @__blueprint-sandboxes__/prototypes/illusions-final-fixes.lua:40: data[ammo-turret][se-meteor-defence-container] not found; cannot create Illusion
1.217 Script @__blueprint-sandboxes__/prototypes/illusions-final-fixes.lua:40: data[ammo-turret][se-meteor-point-defence-container] not found; cannot create Illusion
1.217 Script @__blueprint-sandboxes__/prototypes/illusions-final-fixes.lua:40: data[assembling-machine][se-delivery-cannon] not found; cannot create Illusion
1.217 Script @__blueprint-sandboxes__/prototypes/illusions-final-fixes.lua:40: data[assembling-machine][se-delivery-cannon-weapon] not found; cannot create Illusion
1.217 Script @__blueprint-sandboxes__/prototypes/illusions-final-fixes.lua:40: data[assembling-machine][se-energy-transmitter-injector] not found; cannot create Illusion
1.217 Script @__blueprint-sandboxes__/prototypes/illusions-final-fixes.lua:40: data[assembling-machine][se-energy-transmitter-emitter] not found; cannot create Illusion
1.217 Script @__blueprint-sandboxes__/prototypes/illusions-final-fixes.lua:40: data[assembling-machine][se-space-elevator] not found; cannot create Illusion
1.217 Script @__blueprint-sandboxes__/prototypes/illusions-final-fixes.lua:40: data[boiler][se-energy-transmitter-chamber] not found; cannot create Illusion
1.217 Script @__blueprint-sandboxes__/prototypes/illusions-final-fixes.lua:40: data[container][se-rocket-launch-pad] not found; cannot create Illusion
1.217 Script @__blueprint-sandboxes__/prototypes/illusions-final-fixes.lua:40: data[container][se-rocket-landing-pad] not found; cannot create Illusion
1.217 Script @__blueprint-sandboxes__/prototypes/illusions-final-fixes.lua:40: data[electric-energy-interface][se-energy-beam-defence] not found; cannot create Illusion
1.217 Script @__blueprint-sandboxes__/prototypes/illusions-final-fixes.lua:40: data[mining-drill][se-core-miner-drill] not found; cannot create Illusion
1.311 Checksum for core: 3955387189
1.311 Checksum of base: 434889501
1.311 Checksum of blueprint-sandboxes: 3591428886
1.425 Prototype list checksum: 1975694231
1.449 Loading sounds...
1.467 Info PlayerData.cpp:71: Local player-data.json available, timestamp 1685753447
1.467 Info PlayerData.cpp:78: Cloud player-data.json unavailable
1.558 Initial atlas bitmap size is 16384
1.578 Created atlas bitmap 16384x16372 [none]
1.579 Created atlas bitmap 16384x13208 [none]
1.579 Created atlas bitmap 8192x4208 [decal]
1.580 Created atlas bitmap 16384x5568 [low-object, linear-minification]
1.580 Created atlas bitmap 8192x4416 [mipmap, linear-minification, linear-magnification, linear-mip-level]
1.580 Created atlas bitmap 16384x6064 [terrain, mipmap, linear-minification, linear-mip-level]
1.580 Created atlas bitmap 4096x3216 [terrain-effect-map, mipmap, linear-minification, linear-mip-level]
1.580 Created atlas bitmap 4096x1840 [smoke, mipmap, linear-minification, linear-magnification]
1.580 Created atlas bitmap 4096x3104 [mipmap]
1.580 Created atlas bitmap 8192x2240 [icon, not-compressed, mipmap, linear-minification, linear-magnification, linear-mip-level]
1.580 Created atlas bitmap 8192x1496 [alpha-mask]
1.582 Created atlas bitmap 16384x14772 [shadow, linear-magnification, alpha-mask]
1.582 Created atlas bitmap 8192x2352 [shadow, mipmap, linear-magnification, alpha-mask]
1.582 Created atlas bitmap 2048x240 [icon-background, not-compressed, mipmap, linear-minification, linear-magnification, linear-mip-level, ]
1.586 Texture processor created (2048). GPU accelerated compression Supported: yes, Enabled: yes/yes. Test passed. YCoCgDXT PSNR: 35.83, BC3 PSNR: 33.82
1.964 Parallel Sprite Loader initialized (threads: 23)
4.664 Sprites loaded
4.671 Generated mipmaps (4) for atlas [3] of size 16384x5568
4.675 Generated mipmaps (3) for atlas [4] of size 8192x4416
4.688 Generated mipmaps (3) for atlas [5] of size 16384x6064
4.690 Generated mipmaps (3) for atlas [6] of size 4096x3216
4.691 Generated mipmaps (3) for atlas [7] of size 4096x1840
4.705 Generated mipmaps (3) for atlas [8] of size 4096x3104
4.718 Generated mipmaps (5) for atlas [9] of size 8192x2240
4.720 Generated mipmaps (3) for atlas [12] of size 8192x2352
4.735 Custom mipmaps uploaded.
4.770 Custom inputs active: 1
4.815 Factorio initialised
4.816 Info HttpSharedState.cpp:54: Downloading https://updater.factorio.com/updater/get-available-versions?username=somethingtohide&token=<private>&apiVersion=2
5.101 Some core updates would be reachable if experimental updates were enabled.
5.101 0 packages available to download (experimental updates disabled).
10.117 Loading level.dat: 1117310 bytes.
10.117 Info Scenario.cpp:199: Map version 1.1.80-0
10.129 Checksum for script /home/cameron/src/factorio/factorio/temp/currently-playing/control.lua: 2881393120
10.131 Checksum for script __blueprint-sandboxes__/control.lua: 1964738393
10.131 Script @__blueprint-sandboxes__/scripts/init.lua:28: Init.FirstTimeInit
10.131 Script @__blueprint-sandboxes__/scripts/force.lua:38: Skip Force.Init: player
10.131 Script @__blueprint-sandboxes__/scripts/force.lua:38: Skip Force.Init: enemy
10.131 Script @__blueprint-sandboxes__/scripts/force.lua:38: Skip Force.Init: neutral
10.137 Script @__blueprint-sandboxes__/control.lua:43: on_player_created index: 1
10.137 Script @__blueprint-sandboxes__/scripts/force.lua:42: Force.Init: player
10.137 Script @__blueprint-sandboxes__/scripts/init.lua:11: Init.Player: somethingtohide
11.565 Script @__blueprint-sandboxes__/scripts/force.lua:130: Creating Sandbox Force: bpsb-sb-f-player
11.566 Script @__blueprint-sandboxes__/control.lua:62: on_force_created name: bpsb-sb-f-player
11.566 Script @__blueprint-sandboxes__/scripts/force.lua:38: Skip Force.Init: bpsb-sb-f-player
11.570 Script @__blueprint-sandboxes__/scripts/research.lua:14: Copied all Research from: player -> bpsb-sb-f-player
11.570 Script @__blueprint-sandboxes__/scripts/lab.lua:43: Creating Lab: bpsb-lab-p-somethingtohide
11.588 Script @__blueprint-sandboxes__/scripts/lab.lua:156: Equipping Lab: bpsb-lab-p-somethingtohide
11.640 Script @__blueprint-sandboxes__/scripts/sandbox.lua:109: Entering Sandbox: bpsb-lab-p-somethingtohide
11.641 Script @__blueprint-sandboxes__/scripts/force.lua:38: Skip Force.Init: bpsb-sb-f-player
11.641 Script @__blueprint-sandboxes__/scripts/research.lua:38: Unlocking hidden Recipes for: bpsb-sb-f-player
12.786 Script @__blueprint-sandboxes__/scripts/lab.lua:138: Resetting Lab: bpsb-lab-p-somethingtohide
12.788 Script @__blueprint-sandboxes__/scripts/lab.lua:156: Equipping Lab: bpsb-lab-p-somethingtohide
16.248 Quitting: user-quit.
16.449 Goodbye