Quality Trees


Plant quality seeds, get quality trees.

Content
2 months ago
2.0
575
Factorio: Space Age Icon Space Age Mod
Cheats

g Harvested plants not giving quality products.

Hello! I'm having an issue in my playthrough where while the seeds that are planted do produce quality plants, when harvested said plants always revert to their common counterparts. This very well could be a mod incompatibility - I have Maraxsis enabled which it says alters agri towers.

I am so sorry for this to be so soon after - literal seconds after posting the previous thread a tower activated next to me and harvested rare crop. I'[ll look further into this and see if I can identify the issue.

15 days ago

No worries, so the code for this mod is incredibly simple, if you plant a seed with quality, we store the resulting objects quality based on its planet and position. If a plant is harvested, it checks if there is any quality at that planet and position, and simply modifies the loot.

The thing is, memory in a computer is stored with numbers, (not planets and positions) so the code needs to convert "Gleba:10,350" into a number in memory - this is called hashing.

It is possible for hashing to have collisions, say "Gleba:10,350" and "Nauvis:104,251" might both map to memory spot 12345 and usually languages do a good job or avoiding this, but very very rarely, it may be the case that a slightly older plant is lost and overwritten in the hash map.

This should be stupidly rare - although technically possible, and also reduced over-time, as the plants don't move, so the addresses should stabalize as the computer does its thing rehashing and dealing with collisions appropriately.

Also this is a computer and Lua language issue - I actually tried implementing my own spatial hashing solutions, but honestly the real computer scientists have got me beat on this one, and its better to use the Lua implementations for string hashing.

All this to say, I hope you can't find another reproducible example of this occuring haha, but also its done this way to ensure the mod is extremely performant, checking the quality of a tree is basically instant and free.
(Storing everything in an array and "searching" for the correct tree would be very bad if you were mega-basing with ag towers)

Enjoy you quality trees, and I'll monitor this chat if you find any more issues! Thanks for trying the mod =)

New response