[A12d] Tools for haul. Animal will help us! V1.5d 22-10-2015

Started by BBream, April 17, 2015, 06:32:23 AM

Previous topic - Next topic

BBream

Quote from: Killaim on April 28, 2015, 01:46:48 AM
is there a way to change the priority of how the carts / cargo picks what to gather?

because my suggestion would be for a cargo hauler to look only at a stockpile then gather all items for that type of stock pile

then when its done pick a new stockpile and gather all those items

then atleast the cargos wont skip back and forth between stockpiles with random items picked up and get confused maybe with dropping wrong items?

though this would require picking priority on the stockpiles instead of items priority.

This has same problem. If item satisfied stockpiles's setting is scatterd, then colonist should move back and forth.
So, do you want colonist move more efficiently, right? I'll change logic.
Before
Go to stockpileCell and drop
Go to stockpileCell and drop
...

After
Go to stockpileCell
If the colonists stop by one stockpile
   then they try drop all of item matching stockpile setting.
       drop item.
       find item matching stockpile setting.
       advance the order of drop. Too complicate
       try drop other item while standing.
Go to next stockpileCell
...


And I'll bring a whip for you ;D

Edit1: Now colonist will colllect and drop items in adjacent cell at once.

Turtle Dude

Quote from: thefinn on April 28, 2015, 03:10:32 AM
I have a CTD issue. I am not good at reading the error logs but I did post in Edb's threads as his mod seems to come up a lot in there.

He suggested I should also post here as he thinks it's some kind of interaction between this mod and his.

This happens somewhere mid-game - not early game - and because it CTD's straight away I cannot tell if it relates to a particular job or not.

Just so you do know the Error is an out of memory error and is due to your computer trying to allocate more memory then it can to the game, if your using a older version of ToolsforHauling update it has a fix that will help with that. but the other errors I've never seen and I look at my output file after every game so it might be from multiple mods clashing.

Oh BBream after roughly 4 hours of playing instead of crashing it only went up to 1.7gb of ram usage so if you want to take your time finding the leak now you have plenty of time with a leak this slow it shouldn't hamper any ones game.

thefinn


BBream

Quote from: Turtle Dude on April 28, 2015, 04:48:39 AM
-snip

I'm glad that you can play game 4 hours.
I try it harder but I have no idea for removing leak anymore. I give it up and It's up to Tynan. Call Tynan and yelling him, "LEAK LEAK LEAK"

Latta

When a cargo hauls stone chunk, this error spam my log:

Holder of ChunkSlate291397 is not a usable type; it is a ToolsForHaul.Vehicle_Cargo: Verse.ThingContainer

But it can be avoided by setting its filter.

Also when a colonist newly made a cargo and hauls it(hand held item; before gets replaced by actual "Vehicle") to somewhere this exception spam my log:

Exception drawing *PawnName*: System.NullReferenceException: Object reference not set to an instance of an object

  at ToolsForHaul.Vehicle_Cargo.DrawAt (Vector3 drawLoc) [0x00000] in <filename unknown>:0

  at Verse.PawnRenderer.RenderPawnAt (Vector3 drawLoc, BodyDrawType bodyDrawType) [0x00000] in <filename unknown>:0

  at Verse.Pawn.DrawAt (Vector3 drawLoc) [0x00000] in <filename unknown>:0

  at Verse.Thing.Draw () [0x00000] in <filename unknown>:0

  at Verse.ThingWithComps.Draw () [0x00000] in <filename unknown>:0

  at Verse.DynamicDrawManager.DrawDynamicThings () [0x00000] in <filename unknown>:0


[attachment deleted due to age]

BBream

Quote from: Latta on April 28, 2015, 11:47:58 AM
-snip

1)Maybe it is cause from designation. I have removed it when collecting. It will be fine.
2)I didn't expect it would be carried by hand. It will be fixed in next version.

Thanks for reporting.

Killaim

i had a weird idea.

would it be possible to make a special stockpile

then set that to be for cargo carts.

then they will exclusively dump any items (NOT) in a stockpile at that cart stockpile

then you could make a central stockpile dump area where they can then sort it out later by hand to all the other stockpiles ?

*edit*

like turn on/off if a cargo cart is allowed to put items into the stockpile ?

BBream

Quote from: Killaim on April 29, 2015, 01:52:14 AM
i had a weird idea.

would it be possible to make a special stockpile

then set that to be for cargo carts.

then they will exclusively dump any items (NOT) in a stockpile at that cart stockpile

then you could make a central stockpile dump area where they can then sort it out later by hand to all the other stockpiles ?

*edit*

like turn on/off if a cargo cart is allowed to put items into the stockpile ?

I don't know. If I add other tools like truck then delivery zone is needed and it is useful. But now it will make game is complicated

Turtle Dude

I know you said you gave up on looking for the leak, but if you do look I know this might be information you already have since you are the one coding, but with the chart you posted all I can see is a step to every tick, meaning that the memory leak is caused by a loop that seems to either never stop trying (no termination point) or gets stuck. But I also have a bit time with the mod, and noticed that the leak happens when the game is paused and even when all colonists are idle (I trapped them to test this). So wouldn't that make the leak in a part of a loop that doesn't need them to cause an action to happen (such as picking up an item)?

I've by doing small tests over the time I'm able to play seeing if there is a ways to make the leak expand (nothing has), or stop (pausing the game doesn't work, neither does trapping them in a room with nothing it in to idle them all) only taking off the backpacks has actually stopped the leak.

Sorry If I'm only confusing you, or just being annoying (I've been told I can do both easily, not a good talent to have...).

Ninefinger

Quote from: Turtle Dude on April 29, 2015, 02:09:43 PM
I know you said you gave up on looking for the leak, but if you do look I know this might be information you already have since you are the one coding, but with the chart you posted all I can see is a step to every tick, meaning that the memory leak is caused by a loop that seems to either never stop trying (no termination point) or gets stuck. But I also have a bit time with the mod, and noticed that the leak happens when the game is paused and even when all colonists are idle (I trapped them to test this). So wouldn't that make the leak in a part of a loop that doesn't need them to cause an action to happen (such as picking up an item)?

I've by doing small tests over the time I'm able to play seeing if there is a ways to make the leak expand (nothing has), or stop (pausing the game doesn't work, neither does trapping them in a room with nothing it in to idle them all) only taking off the backpacks has actually stopped the leak.

Sorry If I'm only confusing you, or just being annoying (I've been told I can do both easily, not a good talent to have...).

actually that is good information, making it so that pawns cancel the action there seeking there hauling orders after so many ticks if no haul-able items are within certain parameters could solve this problem, however coding this i think would take a lot of work sine you would have to set up distance parameters, and set up parameters if items are accessible, there may be a simpler hack job way of doing it so that orders get canceled and turn to idle in some other way but that is the way i would envision it. unfortunately i know absolutely jack about how to mod dll files so i cant offer any specific solutions code wise just the general idea for what i think you could do to stop the memory leaks. you just need them to be able to stop there task if certain parameters are not met.

Turtle Dude

Quote from: Ninefinger on April 29, 2015, 04:59:33 PM
Quote from: Turtle Dude on April 29, 2015, 02:09:43 PM
...

I've gone through the backpacks gizmo file it seems only 1 part runs on an event trigger run by the FloatMenuOption I'm wondering if hauling has an event of it's own that can be used as a trigger, which all the backpacks can do is if event is triggered, it can then check for space in backpack, and then if there is space do the rest of putting the item into memory and placing the image into the backpack slot. This would allow for a termination through the hauling event. Because it seems like there is no termination for the backpacks and it continuously tries to find the image/item for the slots in the backpack by what I can see.

I'll I can say is I hope this maybe help

I'm not a expert, I've only been messing with code for college classes for a year and a half so if possible take what I say with a grain of salt.

BBream

Quote from: Turtle Dude on April 29, 2015, 07:47:57 PM
Quote from: Ninefinger on April 29, 2015, 04:59:33 PM
Quote from: Turtle Dude on April 29, 2015, 02:09:43 PM
...

I've gone through the backpacks gizmo file it seems only 1 part runs on an event trigger run by the FloatMenuOption I'm wondering if hauling has an event of it's own that can be used as a trigger, which all the backpacks can do is if event is triggered, it can then check for space in backpack, and then if there is space do the rest of putting the item into memory and placing the image into the backpack slot. This would allow for a termination through the hauling event. Because it seems like there is no termination for the backpacks and it continuously tries to find the image/item for the slots in the backpack by what I can see.

I'll I can say is I hope this maybe help

I'm not a expert, I've only been messing with code for college classes for a year and a half so if possible take what I say with a grain of salt.

Backpack don't use for storing item. It just bring from wearer's inventory. So backpack use no memory for item.
This is GUI method so it should be not ended in middle point.
Memory that can reduce is texture(image) memory. All texture I made is static and readonly so it will not make new one.  I call method named GUI.DrawTexture() for drawing and this is in Core dll method. But In Core method, I don't know how it process texture and cannot fix it. It is not my region.
For checking whether this is really my memory leak, then it should be checked:
1) Check whether other gizmo has same memory graph while drawing GUI without this mod.
This is result. Gizmo use some memory but it is collected soon. I think any gizmo has same memory usage graph.



2) Check whether game has memory leak after playing long time without this mod.

Latta

I wonder what program is that graph. Maybe just one of spreadsheet program, and the data was generated by your debug method?

BBream

Quote from: Latta on April 30, 2015, 08:07:09 AM
I wonder what program is that graph. Maybe just one of spreadsheet program, and the data was generated by your debug method?

I used MS Office 2010. This is the progress the graph made.
1) Load txt file to excel
2) Filtering data
3) Draw graph

Yes, I use method named GC.GetTotalMemory() in GetGizmo().

Turtle Dude

I would love to say I've been testing the code every which way to Sunday... but I don't know much of C#, It's the only other class that I'll be starting either next school semester, or later so I've been looking at the code trying to find out how to copy and past the Debug code into every place I can (If this would even work, by that I mean test the memory/results of every loop to find the leaking area) to try and get a completely grid map of every thing within your code, and then find the code from the game to place in there. Sadly no luck and with finals week only well a week away taking the time to learn it is almost null.

Sorry this isn't a helpful post I just hope any issues are fixed.

Also on a side note I'm seeming to having an issue I still get odd errors (Ones not produced without your mod active, but might be due to compatibility with another mod)

JobDriver threw exception in Tick. Pawn=Engie, Job=Hunt A=WildBoar_Corpse3354649 B=(208, 0, 188) C=(0, 0, 0) Exception: System.NullReferenceException: Object reference not set to an instance of an object

  at Verse.AI.JobDriver.DriverTick () [0x00000] in <filename unknown>:0


And it seems none of my guys are using the space in the backpacks anymore, this might be due to a glitch on my part but even making take them off and go grab and put them doesn't make them use it. They just seems to prefer using there hands, and not putting any items in the backpack.