# Sleeping is almost real-time

**URL:** https://discourse.cataclysmdda.org/t/sleeping-is-almost-real-time/7997
**Category:** The Garage
**Created:** [November 22, 2014, 7:56am UTC](https://discourse.cataclysmdda.org/t/sleeping-is-almost-real-time/7997 "2014-11-22T07:56:24Z")
**Posts on this page:** 20
**Page:** 2

<div class="post-metadata">

### Author: ![Barhandar](https://avatars.discourse-cdn.com/v4/letter/b/ebca7d/32.png) [@Barhandar](https://discourse.cataclysmdda.org/u/Barhandar)
#### Post date: [November 26, 2014, 9:59pm UTC](https://discourse.cataclysmdda.org/t/sleeping-is-almost-real-time/7997/21 "2014-11-26T21:59:59Z")

</div>

> [@Maur](#):
>
> [quote=“Kevin Granade, post:17, topic:7997”]It’s number of instances of items.

Okay, i know it sounds silly, but after checking thesaurus, i am still not sure (i am not a native speaker…)

Do you mean:

a) the number of item kinds/types.  
b) the total number of items (so 700 rags count as 700 items).

I think its the second, but as i said, i am not sure.[/quote]  
The second, amount of separate entries in pickup and examine menus. I.e. salt and other portioned items will only count as 1 instance when they’re all in one tile, while rags will count as many instances.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex016/uploads/cataclysmdda/original/1X/21b5d044e8473b25d0bf905d60477e25f6fbe0cf.png) [@system](https://discourse.cataclysmdda.org/u/system)
#### Post date: [November 26, 2014, 10:37pm UTC](https://discourse.cataclysmdda.org/t/sleeping-is-almost-real-time/7997/22 "2014-11-26T22:37:18Z")

</div>

What about allowing the construction of dedicated storage areas: a larder (for meat), a pantry (for dry goods), a wardrobe (for clothing), a workbench (for parts), and so on. Only specific goods can be placed in them. What they do is delete the object, then simply record the number of each item it holds and its age/condition. The benefit is that you don’t need to constantly display the contents, and you only need to check the contents array when it’s xamined, or when crafting occurs nearby. Each time it’s accessed, you age the items according to how many turns it’s been since it was last accessed.

I can no longer even craft in my base, much less sleep. It takes about two minutes right now, real-time, for an hour to pass in game.

---

<div class="post-metadata">

### Author: ![Thwap](https://avatars.discourse-cdn.com/v4/letter/t/4af34b/32.png) [@Thwap](https://discourse.cataclysmdda.org/u/Thwap)
#### Post date: [November 27, 2014, 12:17am UTC](https://discourse.cataclysmdda.org/t/sleeping-is-almost-real-time/7997/23 "2014-11-27T00:17:07Z")

</div>

What exactly changed? What are we ‘gaining’ in exchange for the game shitting itself when there are too many items around?

---

<div class="post-metadata">

### Author: ![Zireael](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/zireael/32/956_2.png) [@Zireael](https://discourse.cataclysmdda.org/u/Zireael)
#### Post date: [November 27, 2014, 8:19am UTC](https://discourse.cataclysmdda.org/t/sleeping-is-almost-real-time/7997/24 "2014-11-27T08:19:34Z")

</div>

[quote=“CarlStayBack!, post:22, topic:7997”]What about allowing the construction of dedicated storage areas: a larder (for meat), a pantry (for dry goods), a wardrobe (for clothing), a workbench (for parts), and so on. Only specific goods can be placed in them. What they do is delete the object, then simply record the number of each item it holds and its age/condition. The benefit is that you don’t need to constantly display the contents, and you only need to check the contents array when it’s xamined, or when crafting occurs nearby. Each time it’s accessed, you age the items according to how many turns it’s been since it was last accessed.

I can no longer even craft in my base, much less sleep. It takes about two minutes right now, real-time, for an hour to pass in game.[/quote]

That’s a good idea.

---

<div class="post-metadata">

### Author: ![Coolthulhu](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/coolthulhu/32/2446_2.png) [@Coolthulhu](https://discourse.cataclysmdda.org/u/Coolthulhu)
#### Post date: [November 27, 2014, 11:03am UTC](https://discourse.cataclysmdda.org/t/sleeping-is-almost-real-time/7997/25 "2014-11-27T11:03:33Z")

</div>

> [@CarlStayBack!](#):
>
> What about allowing the construction of dedicated storage areas: a larder (for meat), a pantry (for dry goods), a wardrobe (for clothing), a workbench (for parts), and so on.

The idea of segregating items by their “activeness” is good.  
Here’s how it could be easily and elegantly implemented: a single furniture (and vehicle part) tag like “NO\_ACTIVE” preventing storing active items (perishable food, reanimating corpses, artifacts, flashlights turned on, live grenades etc.) and then being skipped during timed item checks. Wardrobes, pantries etc. would be just cosmetically different items with this tag, with splitting the item types being something the player does rather than enforced annoyance.  
Active items placed there by force would have to fall out, but that’s a tiny “realism” cost for a big performance boost.

> [@CarlStayBack!](#):
>
> Each time it’s accessed, you age the items according to how many turns it’s been since it was last accessed.

If it was this easy, you could just have every non-important item processed this way. I once proposed similar a solution, but it was immediately shot down: food rotting speed depends on temperature.  
A dedicated food storage could speed things very slightly by skipping tool checks, corpse checks etc., but those aren’t that expensive.

---

<div class="post-metadata">

### Author: ![NOMOETOE](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/nomoetoe/32/287_2.png) [@NOMOETOE](https://discourse.cataclysmdda.org/u/NOMOETOE)
#### Post date: [November 28, 2014, 5:45am UTC](https://discourse.cataclysmdda.org/t/sleeping-is-almost-real-time/7997/26 "2014-11-28T05:45:04Z")

</div>

> [@Valpo](#):
>
> i crashed a vehicle into 10s of thousands mettal bits … they weren t unique all of them but they still slowed down the game considerably and every time i entered that map section it took quite some time to load them in freezing the game.

I had the same problem, except it was with blob globs, so, so many blob globs. ;\_; at least I’ll have a ton of superglue.

Does putting stuff in a crate and the sealing it help with such things? or is that not so? :o

---

<div class="post-metadata">

### Author: ![Thwap](https://avatars.discourse-cdn.com/v4/letter/t/4af34b/32.png) [@Thwap](https://discourse.cataclysmdda.org/u/Thwap)
#### Post date: [November 28, 2014, 6:07am UTC](https://discourse.cataclysmdda.org/t/sleeping-is-almost-real-time/7997/27 "2014-11-28T06:07:09Z")

</div>

Can we just have whatever we had in 0.A back rather than add a storage system as a crutch to keep the game from choking on items? Craftable storage boxes or whatever aren’t going to help when someone wrecks a car or otherwise creates a lot of crap, or when someone turns item spawn up in settings.

---

<div class="post-metadata">

### Author: ![kevin.granade](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/kevin.granade/32/1316_2.png) [@kevin.granade](https://discourse.cataclysmdda.org/u/kevin.granade)
#### Post date: [November 29, 2014, 8:18am UTC](https://discourse.cataclysmdda.org/t/sleeping-is-almost-real-time/7997/28 "2014-11-29T08:18:21Z")

</div>

No, because I don’t know what exactly the problem is, and if I did, it’d probably be faster to just fix it than to roll features back.  
I’ll be getting to this in due time, and it will be fixed.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex016/uploads/cataclysmdda/original/1X/21b5d044e8473b25d0bf905d60477e25f6fbe0cf.png) [@system](https://discourse.cataclysmdda.org/u/system)
#### Post date: [November 29, 2014, 8:40am UTC](https://discourse.cataclysmdda.org/t/sleeping-is-almost-real-time/7997/29 "2014-11-29T08:40:21Z")

</div>

[quote=“Kevin Granade, post:28, topic:7997”]No, because I don’t know what exactly the problem is, and if I did, it’d probably be faster to just fix it than to roll features back.  
I’ll be getting to this in due time, and it will be fixed.[/quote]

Something caught my eye in the changelog:

Turn number added to calendar since it’s called a gajillion times.

If I understand this, the “calendar” is a function which gets called on a timed basis, and which acts as a virtual command stack. Is this right? It sounds like this may be related to the problem. Is it possible this function is calling itself, resulting in exponential lag?

---

<div class="post-metadata">

### Author: ![kevin.granade](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/kevin.granade/32/1316_2.png) [@kevin.granade](https://discourse.cataclysmdda.org/u/kevin.granade)
#### Post date: [November 29, 2014, 9:13am UTC](https://discourse.cataclysmdda.org/t/sleeping-is-almost-real-time/7997/30 "2014-11-29T09:13:03Z")

</div>

Pretty sure the changes in that area have made things strictly faster, I’ll be looking at this soon, probably tomorrow.

---

<div class="post-metadata">

### Author: ![Thwap](https://avatars.discourse-cdn.com/v4/letter/t/4af34b/32.png) [@Thwap](https://discourse.cataclysmdda.org/u/Thwap)
#### Post date: [December 3, 2014, 8:30pm UTC](https://discourse.cataclysmdda.org/t/sleeping-is-almost-real-time/7997/31 "2014-12-03T20:30:41Z")

</div>

I’m being hollered at to come here and check up on the status of this bug by a couple people who’ve heard my tales of this game but want to wait until “game explodes if you get too into base-building” is dealt with to try it.

---

<div class="post-metadata">

### Author: ![Zireael](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/zireael/32/956_2.png) [@Zireael](https://discourse.cataclysmdda.org/u/Zireael)
#### Post date: [December 4, 2014, 8:33am UTC](https://discourse.cataclysmdda.org/t/sleeping-is-almost-real-time/7997/32 "2014-12-04T08:33:35Z")

</div>

Someone on reddit suggested making rags/bones etc work like ammo (have charges). I believe the idea has been thrown around on the forums too.

---

<div class="post-metadata">

### Author: ![kevin.granade](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/kevin.granade/32/1316_2.png) [@kevin.granade](https://discourse.cataclysmdda.org/u/kevin.granade)
#### Post date: [December 4, 2014, 8:59am UTC](https://discourse.cataclysmdda.org/t/sleeping-is-almost-real-time/7997/33 "2014-12-04T08:59:23Z")

</div>

I’m working on it, the solution to this includes an overhaul of item/map interactions, and I don’t exactly have unlimited time to work on it. A little patience would be appreciated.

---

<div class="post-metadata">

### Author: ![Thwap](https://avatars.discourse-cdn.com/v4/letter/t/4af34b/32.png) [@Thwap](https://discourse.cataclysmdda.org/u/Thwap)
#### Post date: [December 4, 2014, 8:06pm UTC](https://discourse.cataclysmdda.org/t/sleeping-is-almost-real-time/7997/34 "2014-12-04T20:06:17Z")

</div>

Thanks man, I’ll let them know it’s being handled. 🙂

---

<div class="post-metadata">

### Author: ![NOMOETOE](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/nomoetoe/32/287_2.png) [@NOMOETOE](https://discourse.cataclysmdda.org/u/NOMOETOE)
#### Post date: [December 4, 2014, 9:12pm UTC](https://discourse.cataclysmdda.org/t/sleeping-is-almost-real-time/7997/35 "2014-12-04T21:12:24Z")

</div>

> [@Kevin Granade](#):
>
> I’m working on it, the solution to this includes an overhaul of item/map interactions, and I don’t exactly have unlimited time to work on it. A little patience would be appreciated.

Well you have a solution. 😛 That’s good enough for me.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex016/uploads/cataclysmdda/original/1X/21b5d044e8473b25d0bf905d60477e25f6fbe0cf.png) [@system](https://discourse.cataclysmdda.org/u/system)
#### Post date: [December 18, 2014, 5:06pm UTC](https://discourse.cataclysmdda.org/t/sleeping-is-almost-real-time/7997/36 "2014-12-18T17:06:17Z")

</div>

Out of curiosity, I loaded up the resource monitor while my character was sleeping to see where the bottleneck was occuring, since I have an i7 and I find it surprising that a largely text-based game is making it choke. To my surprise I discovered that total CPU usage never goes above 15% even while the game is locked up. That’s not even a single core pegged out. RAM use is about 3.5 gigs, though. Given the 4 gig limit for 32-bit programs, is this where the bottleneck is occuring?

---

<div class="post-metadata">

### Author: ![kevin.granade](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/kevin.granade/32/1316_2.png) [@kevin.granade](https://discourse.cataclysmdda.org/u/kevin.granade)
#### Post date: [December 18, 2014, 5:16pm UTC](https://discourse.cataclysmdda.org/t/sleeping-is-almost-real-time/7997/37 "2014-12-18T17:16:04Z")

</div>

Probably memory loads are the bottleneck rather than instruction processing.  
What it’s doing is scanning through the tens of thousands of nearby items looking for the active ones to process.  
I have it mostly overhauled to allow it to just keep track of the active items seperately, at which point the problem should vanish unless you have 10,000+ _active_ items, I have a way to fix that too, but it won’t be immediate.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex016/uploads/cataclysmdda/original/1X/21b5d044e8473b25d0bf905d60477e25f6fbe0cf.png) [@system](https://discourse.cataclysmdda.org/u/system)
#### Post date: [December 18, 2014, 5:23pm UTC](https://discourse.cataclysmdda.org/t/sleeping-is-almost-real-time/7997/38 "2014-12-18T17:23:13Z")

</div>

> [@Kevin Granade](#):
>
> Probably memory loads are the bottleneck rather than instruction processing.

Interesting, interesting. Would a 4 gig RAM disk solve the problem then? I mean, it’s a push-it-till-it-moves solution, but better than nothing until you can roll out a patch.

---

<div class="post-metadata">

### Author: ![Coolthulhu](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/coolthulhu/32/2446_2.png) [@Coolthulhu](https://discourse.cataclysmdda.org/u/Coolthulhu)
#### Post date: [December 18, 2014, 6:57pm UTC](https://discourse.cataclysmdda.org/t/sleeping-is-almost-real-time/7997/39 "2014-12-18T18:57:42Z")

</div>

> [@CarlStayBack!](#):
>
> Interesting, interesting. Would a 4 gig RAM disk solve the problem then? I mean, it’s a push-it-till-it-moves solution, but better than nothing until you can roll out a patch.

No, your OS already caches disk reads in RAM. Also, disk read/writes don’t happen all that often during the game, mostly just on saves or when moving around.

Memory reads as in “reads from RAM into CPU cache”.

---

<div class="post-metadata">

### Author: ![kevin.granade](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/kevin.granade/32/1316_2.png) [@kevin.granade](https://discourse.cataclysmdda.org/u/kevin.granade)
#### Post date: [December 22, 2014, 1:37am UTC](https://discourse.cataclysmdda.org/t/sleeping-is-almost-real-time/7997/40 "2014-12-22T01:37:10Z")

</div>

Latest build has a fix for this. Again, unless you have ridiculous amounts of active items (like a literal ton of butchered meat), it should be super fast now.  
I’m working on that problem too, might have a fix later today.

[Previous page](https://discourse.cataclysmdda.org/t/sleeping-is-almost-real-time/7997.md?page=1)

[Next page](https://discourse.cataclysmdda.org/t/sleeping-is-almost-real-time/7997.md?page=3)
