Show Tile Grid Lite

by kizrak

Simple less intrusive version of built-in debug settings `show-tile-grid` feature. Useful for radar, pollution, artillery fire, UPS, map generation, chunk-aligned trains, biter expansion, etc. ⚠ This mod currently has some performance/UPS issues. It will probably require a rewrite to fix them. Sorry. πŸ’€

Utilities
2 years ago
0.17 - 1.1
1.07K

b 0.3.13: crippling performance regression in "always" mode

3 years ago

G'day. With 0.3.13 I have a crippling performance problem with STGL; verified by rolling back to 0.3.12 and having it go away. I also checked the mod time spent debug, and saw 11+ ms hits from the script, and also drops as low as 40FPS on mousing over various things like belts.

I have my grid set to "always", and am the only player in the game, so I am not sure where the time is going, but it sure is going somewhere.

If you don't have any insight into what might be triggering this I'll certainly dig a bit deeper myself...

3 years ago
(updated 3 years ago)

I haven't read the code for the auto feature, but I noticed this issue when just enabling/disabling the grid with the settings. Actually I read the code, assumed it would give performance issues when toggling the grid, then installed the mod and tested it.
But it has no quick way to toggle the grid on or off, so it doesn't really matter, it's supposed to be always on. Until I saw the update, now it has an auto toggling feature. So I was really confused and thought I should read the code and see if it was rewritten based on different ideas to enable toggling. So I'm about to do that and saw this thread while checking for updates. So I guess I don't really need to read the code now that I know there's no fix that would enable this feature to actually work.

This doesn't explain why "always" mode has the reduced performance though. It should only be in auto mode. Maybe the grid is recreated always in both modes, and just not deleted when un-mouse-hovering in "always" mode as the only difference compared to the "auto" code? (Edit: read the code, this is pretty much it. It loops through all chunks and rebuilds the entire grid whenever any player does almost any action in practise. Regardless of mode.)

I've been thinking about making my mod ChunkyChunks have the global grid (so it can be seen with map view far away). But there's quite tricky to do it with the combination of a toggle feature, configurable grid sizes and having it be performant. That's why STGL only has the chunk size and had no toggle while CC has configurable grids and toggle but it's not visible in map view. Both are performant (except for this bug), because neither manages to do it all.

Slippy, do you always get bad performance with "always" mode, or only when mousing over entities and doing actions that would enable the grid when in "auto" mode? Sounds like it gets worse with mousing over stuff, but what's it like for you after a while with no actions that would toggle the grid?

I guess I'll read the code and test it out anyways to unconfuse myself :)

Edit: I understand the problem with the code now that I've read it. Always mode should at least be fixable...

3 years ago

Ah, I hit it when moving, and when mousing over things, in always mode. It came and went -- and I'm not 100 percent that "just" moving triggered it, rather than moving happening to mouse over something.

Sounds like you found your own answers though. :)

3 years ago

Yeah please fix.

3 years ago

even on never it gives spikes it seems ^

3 years ago

I downgraded to 0.3.12 and all is fine again.

3 years ago

Please use version 0.3.12 until I have time to fix this, which may not be soon. Sorry 😒

3 years ago

ok, though might i suggest republishing 0.3.12 as 0.3.14 for the time being so people autoupdating their mods use the latest stable version? ❀️

3 years ago
(updated 3 years ago)

I removed 0.3.13 from the downloads list. Hopefully Factorio's fallback for that is clean. Please let me know if it isn't. Thanks and Sorry 🧑

3 years ago

okay i hadnt seen this thread had gotten updates, but i managed to fix it by just commenting out the lines that trigger the redraw function in "on_player_cursor_stack_changed" and "on_selected_entity_changed".

its not a pretty fix but it works

3 years ago
(updated 3 years ago)

Okay, so v0.3.14 is out. If you are not using "Auto" mode, the performance should be similar to 0.3.12 (and I just realized there is a typo in the change-log, which I'm not going to fix πŸ˜”). If you are using "Auto" mode, there is still a performance hit when rending must toggle (nothing I can do about that), but there should not be any lag spikes from just any event.

Please let me know how it works out for everyone, and sorry for delay 🀍

3 years ago

Thank you!

3 years ago

```Error while running event showTileGridLite::on_tick (ID 0)
showTileGridLite/control.lua:13: attempt to index field 'cursor_stack' (a nil value)
stack traceback:
showTileGridLite/control.lua:13: in function 'checkPlayerCursor'
showTileGridLite/control.lua:184: in function <showTileGridLite/control.lua:179>
3218.241 Error ServerMultiplayerManager.cpp:90: MultiplayerManager failed: "The mod Show Tile Grid Lite (0.3.14) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event showTileGridLite::on_tick (ID 0)
showTileGridLite/control.lua:13: attempt to index field 'cursor_stack' (a nil value)
stack traceback:
showTileGridLite/control.lua:13: in function 'checkPlayerCursor'
showTileGridLite/control.lua:184: in function <showTileGridLite/control.lua:179>"
```

3 years ago
(updated 3 years ago)

Quezler, I was not able to reproduce your issue, but I put in a blind fix that I'm hoping will work for you. It should be in version 0.3.15. 😁

3 years ago

a bit of context perhaps: it happened on the server in the middle of a biter raid, so i'm assuming ammo ran out while shooting or when just having put the ammo stack in your hand entirely into a turret (or just plain dying while having your hand out), but those are wild guesses πŸ€”

3 years ago

Quezler, I'm hoping the issue isn't still happening in 0.3.15, is it? 🀞

3 years ago

we had already reverted back to .12 for the 2nd time for that save, haven't tested .15 yet on there (and probably won't until the next run) πŸ˜…

New response