Storage management

(previously 'DEVELOPER') Private forum for registered community members. To register, please visit www.prison-architect.com/register.

Moderator: NBJeff

Rashkavar
level0
Posts: 1
Joined: Thu Jul 24, 2014 11:37 am

Storage management

Postby Rashkavar » Tue Oct 27, 2015 12:31 am

I'm pretty new to the forum (registered when I got the game, but didn't really do much), but now that it's out of alpha, I've decided to give it a bit more attention. In doing so, I've noticed something that can add up to a pretty massive problem in certain very specific circumstances.

Item stacks are a fundamental part of the game - not only are all of your building materials item stacks, but so are a number of regular imports and exports. However, the AI (of either staff or prisoners) doesn't seem to have the ability to recognize that two or more partial stacks can be combined into a single full stack. In certain circumstances (most notably, clearcutting a forested map for some early funds), this can add up to a fairly significant problem. In the following screnshot, all of the stacks that show only 2 logs are incomplete stacks. I'd estimate that the size of this storage area could be reduced by as much as 50% if the AI could sort this into a smaller amount of more complete stacks.

Image
(Don't worry about the day 85 thing - I left the new map running overnight since I'd just started it and then realized I needed some sleep...and I haven't had a chance to get back to my game until now.)

Edit: sorry for the image being cropped. Apparently that's how this forum handles oversized images.

Having only done the most general look into game AI programming, I realize that this might be a non-trivial behavior to add, especially for such a minor issue (it's pretty unusual to stockpile hundreds of logs (or any other item), which is when you start running into significant space savings).
User avatar
aubergine18
level2
level2
Posts: 231
Joined: Sun Jul 05, 2015 3:24 pm

Re: Storage management

Postby aubergine18 » Tue Oct 27, 2015 4:19 am

From an AI perspective, it's extremely trivial to code it so that partial stacks are combined. Just need to store age on a stack and once it's past a certain age and not full do a quick search for nearby stacks that it can be combined with. Any suitable stacks get their age reset to prevent them from doing their own search (as they'll soon be merged with the other stack).

For logs, you should consider an Exports room - they'll be sold for Profit $$$
User avatar
Brento666
level3
level3
Posts: 290
Joined: Wed Sep 02, 2015 9:23 pm

Re: Storage management

Postby Brento666 » Tue Oct 27, 2015 12:51 pm

Rashkavar; Haven't ever had wood pile up that much.. do you not have a/want to export? So did you go to sleep after setting chop orders and no export?

I'm guessing so... incase you do want to keep and store all of it in nice stacks you could look into having a modded production rule for stacking like;

Code: Select all

#un-tested!
BEGIN ProductionRule       
    Rule                 Storage
    Material             Log
    Distribution         Random
    Room                 Storage
    StackInRoom          Storage
END


You could even create a new roomtype "WoodStorage"...
(but as soon as you do have an export-room set, the excess logs would be taken there and sold regardless of added rules I think; the default rules will overrule your added rules and will then get your logs exported sooner or later.)

edit: if you wanted to keep logs around even with an exports-room; you could keep the materials on site only if you 'load' then on a table or other container... like in a workshop or (new type of) storage with tables...
-I am working on a mod that adds a wood-workshop and a metal-workshop. They work quite well to help one material (metal) not take over a wood-workshop and visa-versa. I never have enough excess logs pile up high enough, so logs are (almost?) never exported... In my setups at least!
User avatar
aubergine18
level2
level2
Posts: 231
Joined: Sun Jul 05, 2015 3:24 pm

Re: Storage management

Postby aubergine18 » Tue Oct 27, 2015 3:37 pm

@Brento - https://github.com/aubergine10/PA-CarpentryMod - would be great to add some sort of wood storage room and shelves to this mod. In fact, the wood storage shelves could replace the tables in carpentry room. It's not published yet, need to check with Trixi as lots of it based on his original Improved Workshop mod.
User avatar
Brento666
level3
level3
Posts: 290
Joined: Wed Sep 02, 2015 9:23 pm

Re: Storage management

Postby Brento666 » Tue Oct 27, 2015 6:04 pm

That's pretty funny :D Our mods seem to be targeting the same problem but in completely different ways!

-me with 2 extra rooms and some production rules... no (custom) sprites or scripts
-yours with log/wood scripts and new machines even!

I'd be very interested to know the differences to the end results ! Maybe we could merge the best of both once we both release and test what each mod does exactly !

Only thing not yet working in my setup atm is importing "out of stock" logs; so I make do with my forested logs for now...
I have;
-workshop for the default shop-classes and wood/metal work.
-metalworkshop only deals in metals
-woodworkshop only deals in wood

-> the workshoppress in my woodworkshop gets fed with wood. There it produces plain boxes and plain doors (both for export). And my carpentry tables in (wood/default) workshops now alternatively also produces schooldesks for export..
It all works very well with an ample supply of wood... I will have to test if and when an extra storage would even be needed, probably only when far outproducing logs and in that case, exporting the rest would be fine by me...
But there would be a charm to not storing materials on tables in the (new) workshops, instead storing those in (new) dedicated storage rooms... It would give more effective space in workrooms, but also means extra rooms must be planned and built (by the player)...and maybe routing the materials from 1 room to another might not be done in an optimal way by the workmen...
User avatar
aubergine18
level2
level2
Posts: 231
Joined: Sun Jul 05, 2015 3:24 pm

Re: Storage management

Postby aubergine18 » Tue Oct 27, 2015 6:14 pm

As you mentioned, there will likely be issues with a main storage room due to sub-optimal AI routing of resources. That's why I was thinking of having shelves in workshops - at least then the resources will be close to hand. And it might be possible to get whoever is working in the workshop to move resources from the shelves to the processor, thus freeing up workers for the long-range jobs of gathering logs from forestry and bringing to workshop. That being said, could small storage areas along the way facilitate a more efficient production chain?
User avatar
Brento666
level3
level3
Posts: 290
Joined: Wed Sep 02, 2015 9:23 pm

Re: Storage management

Postby Brento666 » Tue Oct 27, 2015 9:09 pm

Many smaller rooms along the way might help buffer stuff, but not allot more then a single big storage I think; because the workmen's routing wont mind bringing stuff from the farthest removed room allot of the time :mrgreen:
But maybe prisoners confined in zones and at workroom will be more prone to collect at closer to destination storage... But what you need to avoid at all times is moving stuff around needlessly... with the wrong rules or order in production.txt, stuff will be moving from floor to table and back to storage, all over the place! :roll:

Amyway, I might do a test to see if added storage rooms would be handy, I might even try if mostly banning the materials to them would work effectively, I think the workers would go collect materials if available and out of stock at workplace... seeing as they go pickup logs from elsewhere just fine by stock rules.

I'm trying to not add any script or custom sprites at all to keep it nice and non counting towards the sprite limit... so I just reference stuff in objects already...
Some stuff in the isn't named/defined, but without a sprites.png in my mod I get to reference stuff in directly;

Code: Select all

BEGIN Object     
    Name                 WoodenTable
   Width                4
    ConstructionTime     3.00000 
    MoveSpeedFactor      0.500000 
    Toughness            10.0000 
    Price                -100 
    NumSlots             4
    MadeOf               Wood   
    Group                StaticObject 
   BlockedBy            Wall 
    BlockedBy            StaticObject 
    BlockedBy            UtilityStation 
   Properties           StaticObject
   ToolbarSprite        BenchToolbar
   BEGIN Sprite x 52 y 20 w 8 h 3 RotateType 2 END
END
Don't know if you knew that trick already... I will soon come with a mod featuring no custom sprites, but allot of unreferenced stuff like the comfy office chair... but not in any hurry for that one. Plus all new objects still need markers checked/set and needs for me to define... and the comfy chair isn't gonna be able to fulfill office chair requirements which is a shame. Neither is the wooden table going to fulfill the woodshop req. unless I overrule the reqs. in some specific cases. Like I could use the wooden table from above as a requirement and container for wood and stuff in woodworkshop/woodstorage (rooms)... Or decide all offices need a comfy chair, as default chair or as an extra req.
But adding an extra table in for only logs/woods would cause ambiguity with users, placing them in canteens and what not... even if the in-game-texts along with the table are completely unambiguous, I would still get people asking about it, probably... So was unsure what to do with my some of my newly acquired 'free' objects exactly... But will find a good use I'm sure... 8)

edit; I can probably find the time to make dupes of all rules regarding tables/benches and apply them to the wooden ones, so canteen inside would require white tables and outside canteen would require wooden tables/benches !!!
User avatar
aubergine18
level2
level2
Posts: 231
Joined: Sun Jul 05, 2015 3:24 pm

Re: Storage management

Postby aubergine18 » Tue Oct 27, 2015 9:23 pm

So, if there's not a sprites.png in a mod, and you define a Sprite as if there were a sprites.png, it actually references objects.png (and I assume also people.png for y >= 64)?
User avatar
Brento666
level3
level3
Posts: 290
Joined: Wed Sep 02, 2015 9:23 pm

Re: Storage management

Postby Brento666 » Tue Oct 27, 2015 10:13 pm

YES! Pretty cool huh!
But about outside canteenz; how would I get prisoners there during dinner time?.... can another room be added in the food chain?!

Should I drop the outside canteen room and just override the inside req of canteens and suggest wooden tables? (so you'd always have to build at least 1 white table and bench...)
-> Or do I loose the table requirement and let players figure out they need (wooden-) tables and benches without a clear req ?...
User avatar
aubergine18
level2
level2
Posts: 231
Joined: Sun Jul 05, 2015 3:24 pm

Re: Storage management

Postby aubergine18 » Tue Oct 27, 2015 10:48 pm

Well, that's why I was thinking of shelves rather than tables - if you use tables or anything that looks like a table, it's going to get used in all sorts of crazy places. Shelves would potentially also suffer same fate, but less so.
User avatar
Brento666
level3
level3
Posts: 290
Joined: Wed Sep 02, 2015 9:23 pm

Re: Storage management

Postby Brento666 » Wed Oct 28, 2015 12:41 am

(update: if you do reference things in objects.png with exact coordinates, things are 1 further down and to the right compared to the descriptions in the spritebank)
User avatar
Brento666
level3
level3
Posts: 290
Joined: Wed Sep 02, 2015 9:23 pm

Re: Storage management

Postby Brento666 » Wed Oct 28, 2015 7:33 am

Update 2: I've now found an easy way to extend tables, chairs and benches (and more unannounced upgrades)... the first expansion to {Paint, Upgrade,...} (with 0 graphics and full compatibility) is coming (much) later today! First teasing on reddit :mrgreen:

Return to “Community Members”

Who is online

Users browsing this forum: No registered users and 1 guest