An idea: to increase item logistics, imho the item cap might not be a fix

Hello,

I’ve been reading the A15 update this evening.
I follow the streams and I see Tom working on the optimizations for the items and searching for them (since they can be anywher in the world ) and the cap thing seems to be halfhearted solution. it will not limit the path finding to items and hearthlings will still search from there own location for items they need.

I was thinking about this, I play another game where the inventory is huge and important and that game doesn’t seem to be impacted while it has massive inventories.

The game Ive been playing is another citybuilding or more correct a factory building game => factorio.
and there I like how the inventory system is implemented (from a player perspective obviously I don’t know how its done internally. its a really nice game. )

Although the setup is different => in that game the player is alot more interactive with the world => ‘inventory’ management kicks into high gear , later in in the game, when a logistics network can be created by usage of robots.

In factorio this network is quite visible (who doesn’t like flying robots ? )
I think with some adaptions to the concept it could work for stonehearth and as a bonus the Pathfinder would instantly know where items are, because items can only be at ‘fixed’ locations, maybe even pathfinder paths could be catched between the navgrids,
So items are ‘are’ at location X in the world ( if this makes sense ) , instead of ‘looking/searching’ for items in any location in the world.

Anyway:
In factory once you progress in the game , one needs need to manage vast amounts of inventory.
This is achieved by chests, robots and roboports.
chests store items , robots haul and move them around , and robotports provide influence area’s ( collection area’s)
the player can choose the type of chest to orginaze the inventory , but here the game could decide which types are needed.
There are normal chests and more intelligent chests ( which are in factorio part of a logistics system)

I will discuss the intelligent chests.
Active , Passive , Storage and Requester
I first explain what they are:
Active : items will be picked from this box to move them to Requester chests or Storage chests. If you don’t want the items stored in Storage chests, then use the Passive Provider
Passive : items will be picked from this box to move them to Requester chests only
Storage : it stores items picked up from Active Provider chests here.
Requester : haulers will bring the configured item amounts from Provider chests or Storage chests.

some attention points:

  • Items are only usable after they where put in a chest ( so part of the network), they are not known to the network if they are on the ground !

  • items will be picked up for moving them around in the following priority: active provider chests > storage chests > passive provider chests

  • haulers will begin to fill storage chests from active provider chests if there are no other tasks available.

  • Active providers can be a strain on the network because it pushes items into the network actively => your robots/haulers are working on this and boxes can be filled with these items ( there are also solutions for this -max amount of items in chest and the network can be set)

  • As said in factorio the player plays a more interactive role , so the player can put stuff in chest ( storage for example, in stoneheart , looted or collected items from the ground can go here )

Also a chest or stockpile can be used interchangable. stockpile can play an active , passive , storage role …

Anyway how could this be added to stonehearth.

the firepit or town banner
Your fire pit could be seen as your city center. At the start your firepit has some storage chests attached. (they have some starting items why don’t they start with some crates ? )

With the Itemcap in mind . lets say we start with 2 chest next to the firepit (or a stockpile of X, Y tiles ) . This fire pit would also have a collection and build area, The collection area could be bigger then the build area (building area might not be needed if the building templates can play chest role - see futher) . Upgrading your networth or firepit or even storage buildings could extent this initial capacity.

collecting items
This means collecting items which lay on the ground and are not known to the network ‘yet’.
Everything in a collection area would be collected by your hearthlings (workers only) and dropped of to a storage chest.
So collecting would still be pathfinding to alot of tiles, but because there is a limited area , optimal algorithms can be used.
When do you sweep for items ? this can be triggered by events in the collecting area.
(creating the area , harvesting , looting , fighting , buiding destroyed , etc… ) but overal without events , the sweeps could be done when there is idle time (or x time passed since the last sweep).
Once items are dropped off into a chest, items are available for usage (part of the network).

hauling /delivery
Once the items are in the network , they can be requested by requestor chests (not by hearthlings)
so items move between chests with a purpose from storage/provider to requester , since hearthlings would not longer pick up items -for personal usage- the chance to drop them would be lower. Because once a hearthling decides on a hauling task , the hearthling should have this as a high priority, because dropping the item would ‘remove’ it from the network again and it needs to be collected again and until this time, this item is dissappeared from the pathfinder searching for items in chests. (so dropping an item which was part of the network has a high ‘cost’).

In rare case , the hearthling migth drop ( fear ; fight , dying , etc… ) if its dropped outside a collection area (or without an explicit loot command , the item would not return to the network , to be available again it must be dropped off into a storage chest , it can’t go directly to a requestor chest (because its out of the network untill dropped off)

So if items are needed , pathfinger looks up passive/stoage providers collections ( it start with the pit one ) , chests contains item , Y/N . calculate path and bingo.
Remember items on the ground (and backpacks ) are NEVER part of the inventory and can’t be found by the item search

Anyway pickup items and drop off would have ‘fixed’ start and end points, and with some quick lookup tables/trees ,items can be found , wihtout looking into the world. Once we have the items we can find the location (maybe even the closest chest and the path’s could be cached).

** who will collect or move items and when**
Priority on collecting or haluing items can maybe be choosen.
This could also open up a class ’ of haulers’ which maybe have bigger backpack contents or maybe even they might have a cart.
in the early phases of the game workers can be collectors/haulers , maybe a firepit has X amount (depending on the size hauler slots ) so a worker can take up this position in a more ‘job’ way.

Building something: (requestor chest usage)
When a build blue print is put into the build , a requestor chest would be placed into the world. ( visible or not visible depends on the implemenation )
The requestor chest can search for the items in the providers chest and if it finds it i can even provide a path finding to the provider chest. I’m important to see that the chest searches the network inventory, hearthlings don’t search for items at this point. The chest can commission a hauler ( or worker ) to move the items via the calculated path from provider to requestor.
If a hauler is commissioned the hauler , will path find to the path which was calculated, then i will follow the path without pathing himself, if the hauler encouters an obstruction the path will be updated (via the chest)
The chest can inform the hauler so it has a new path, (if more extended the paths might be saved , if the item in the way was gone or if its moves ( for nonmovable objects , it might occasionally try to repatch find if it still didn’t recieve its goods), the heartling which is selected or takes the task only need to pathfind to the provider and would request the path and run to the provider chest ( fire pit) , they would then haul the items back to the building requestor chest. hearthlings who are building would only utilize the requestor chest and would only run back forth between the building and the requestor chest,
Therefore it might be better that a chest or visual of a container would be present <== this chest can also indicate if all the items are in the network and are maybe even on their way to it ( if a hearthling took up the task) .
If a builder takes it out of the requestor to build it , the item leaves the network (but the requestor chest will not reorder it , since it should end up into the building, when this happens this event would trigger the requestor chest that the item was recieved, this way the building and chest to ghost track items which are taken out by the builders, otherwise the requestor chest after some time must assume that the item was lost (dropped ) and will reorder ) .
As with hauling , the builder would pay a high cost if he would drop the item, he would rather bring it back to the requestor , if he changes this mind, or inform the chest of dropping it , so the chest can immediately reorder it, if in the network, if its not a collecting cycle needs to happen first , this is not triggered by the requestor chest)
As an added bonus the usage of the localized ( per building ) chest the item clutter after finishing a building would be less , because all items in the chest would used. (dno if logs for scaffolding are part of the item list )
items part of buildings are obviously not longer in the network.
Once the building is complete the requestor chest is removed from the world.

Crafters (passive providers )
Each crafter location or crafting workbench would have a provider chest (visible or not , depends on the implemenation again) . it would also have a requestor chest ( to avoid running back and forth to the fire pit ) , this would increase the efficiency of the crafters alot. the requestor chest of the crafters can have a limit filter on the requested item, or the requestor would only request the stuff which is in the build queue.

mining areas( passive providers or active )
the clay discovered and rocks would be put in a passive provider (
a wheelbarrow ??), if its active the clay would be transported to other chest, and the clutter in mines would dissappear.
so the miner moves it to the wheel barrow , the haulers get it etc…
Once the mining is done and the passive provider is emptied ( an active one would make sure this happens )
the provider is removed from the world.

expanding collection area’s
If the chests are used, so as indicated it would limit the amount of pathfinding locations to find objects drastically. But the collection could still be an issue. to expand this buildings or banners or even upgrades are needed.
if you got this far , in the beginning I said there are area’s aroud the firepit ( this is again to avoid mapping the full world and spending to much time collecting stuff ( and moving it to the chests).
outpost buildings , or market charts could be use for this, marketplace. , this could be similar to influence area’s of certains buildings in games like Anno or Simcity.
Heck maybe if the trees are outside the collection zone. a tree feller hut or banner must be placed first so again the amount of trees would be send to this hut where the provider would be…

Again providers like this could dissappear if no trees are left , or not harvest tokens are present in the area.

farming and food storage (passive provider)
Farmplots , each plot could have his own passive provider ( a chest with full items of the plot type) instead of each farm tile. the Farmer would pathfind in the farm plot to the provider (again a wheelbarrow?), but haulers would pick it up from the provider.
( if the farmer is idle he could also do this job )

A different idea could be that mulitple farms plots (or an influence area for the farm plot providers ) would be linked to a farming building => a barn , Granary ,… This would be the provider to the Firepit or to the inventory.
A granary building could start again a limited capacity ( early game ) or food rotts etc…
but with upgrade the chest inventory and the rotting rate could decrease.
But also here => only food items in the granary would become usuable for the path finger or the hearthlings ( they are not available when they are in farmplot)
maybe berry bushes and flowers can be harvested if the farmers are idle if they are in range of the granary. etc…

so for the granaries , it could dependent if he had X amount of farmplot providers it handles or an influence area. where it can connect to farm plot providers.

others

Offcourse stonehearth is rather dyanmic so people can add stuff to the world , banner , furuniture , fanity items , these would not all need requestor chests , but in those cases at least the item is already known because its in the network.
and this would be limited ?

*the end

This is way too lengthy, but In factorio this logistics system is very important and it allows for more possibilites.
The the chests that orginaze the traffic , they have fixed locations, path find, they don’t need to switch tasks , or change their mind. The hearthlings will only transport.
Maybe you should just try factorio a bit and see how efficient this can be , while at the same prevent you from search every world tile for items.
Other RTS or city building game will always try to limit the gathering item locations in the world to avoid searching for through the whole world. I think cap will only delay the inevitable

1 Like

@blah, love the detailed post. Just a heads up that it is @Ponder (Tony) who has been doing the optimization work on the Wednesday morning streams. His twin brother @Tom (Tom) does the graphics and animation that you see on Tuesday and Thursday evenings.

2 Likes

Yeah twins do that to yah. Although I can tell them apart.
Brain messed up during typing.

2 Likes

I aggree on the fact that the item cap must not be a fix.

One thing is that after a while, stocking items is too slow. Chests are not big enought, chests and stockpiles are too far away, hearthlings are too slow. Just try to mine a while, you’ll get quite far away from the “home”, especially if you want to mine rare minerals like gold.

What the game is missing is a mass gathering class, like a wagon or so, and automatic mass gathering. Meaning I will gather minerals far away in the mountain. I must have something, like a class that will transport empty chests here and will transport full ones to the blacksmith. Same with the wood. Maybe a hearthling with a donkey that can carry 4 chests for example is the right way to do it.

I also believe that mostly in a zone there is the same kind of items. I’m digging, I’ve got stones, many, minerals, etc. Maybe the engine should not look at each item in this zone but should have a 16x16 square zone of reasearch or something like this. And hearthling should not gather one item in this zone and look at another thing to do (in the whole world), maybe far away, but will first look around if there is more things to gather.

And futhermore, I don’t think it’s a problem if my blacksmith only look for minerals around him, not far away in the mining area. It’s my job (almost) to get minerals next to him.