<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hant">
  <title>轉生者們 · 開發日誌</title>
  <link href="https://lockestudio.net/devlog/feed.xml" rel="self" type="application/atom+xml"/>
  <link href="https://lockestudio.net/devlog/" rel="alternate" type="text/html" hreflang="zh-Hant"/>
  <id>https://lockestudio.net/devlog/feed.xml</id>
  <updated>2026-10-11T15:31:06+08:00</updated>
  <author><name>Locke Studio</name></author>
  <entry>
    <title type="html">居民為什麼會肚子餓：需求系統設計</title>
    <link href="https://lockestudio.net/devlog/2026/10/needs-overview/" rel="alternate" type="text/html"/>
    <id>https://lockestudio.net/devlog/2026/10/needs-overview/</id>
    <published>2026-10-11T00:00:00+08:00</published>
    <updated>2026-10-11T00:00:00+08:00</updated>
    <summary type="html">食慾、睡眠、娛樂、社交四種慾望，如何驅動居民的每一天，甚至養成他們的性格。</summary>
    <content type="html" xml:base="https://lockestudio.net/devlog/2026/10/needs-overview/">&lt;p&gt;在《轉生者們》裡，居民不是站在原地等玩家來搭話的布景。他們會肚子餓、會累、會無聊、會寂寞，也會為了這些事情出門、花錢、找人聊天，甚至走投無路時鋌而走險。&lt;/p&gt;

&lt;p&gt;這篇介紹讓居民「活起來」的核心：&lt;strong&gt;需求系統&lt;/strong&gt;。&lt;/p&gt;

&lt;h2 id=&quot;四種慾望&quot;&gt;四種慾望&lt;/h2&gt;

&lt;p&gt;每位居民身上都有四種慾望：&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;慾望&lt;/th&gt;
      &lt;th&gt;怎麼滿足&lt;/th&gt;
      &lt;th&gt;特性&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;食慾&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;吃東西&lt;/td&gt;
      &lt;td&gt;食物可以先買起來放，餓了再吃&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;睡眠&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;睡覺&lt;/td&gt;
      &lt;td&gt;必須空出一段完整的時間，但通常睡一次就飽&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;娛樂&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;做自己喜歡的事&lt;/td&gt;
      &lt;td&gt;同一件事做太多次會膩&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;strong&gt;社交&lt;/strong&gt;&lt;/td&gt;
      &lt;td&gt;和人相處&lt;/td&gt;
      &lt;td&gt;需要對方也願意，而且聊一次補不了多少&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;你可以把每種慾望想成一個水位。水位會隨著時間慢慢下降。一旦跌破&lt;strong&gt;警戒線&lt;/strong&gt;，居民就會感到飢餓、疲倦、無聊或寂寞，狀態跟著變差。反過來，如果好好滿足了，就會得到吃飽、睡飽、心情好的正面效果。&lt;/p&gt;

&lt;p&gt;四種慾望的難易度也不同：睡眠最容易，一覺就補滿；社交最難，要和人來往好幾次才夠。&lt;/p&gt;

&lt;figure class=&quot;post-fig&quot; role=&quot;img&quot; aria-label=&quot;需求系統示意圖：四種慾望各有水位，跌破警戒線後，居民會比較各種方法，再動身去滿足，水位回升後又會慢慢下降，形成循環&quot;&gt;
&lt;svg viewBox=&quot;0 0 600 300&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;
  &lt;defs&gt;
    &lt;marker id=&quot;ar3&quot; viewBox=&quot;0 0 10 10&quot; refX=&quot;9&quot; refY=&quot;5&quot; markerWidth=&quot;7&quot; markerHeight=&quot;7&quot; orient=&quot;auto&quot;&gt;&lt;path d=&quot;M0 0 L10 5 L0 10 Z&quot; fill=&quot;#8b6b34&quot; /&gt;&lt;/marker&gt;
  &lt;/defs&gt;
  &lt;g font-family=&quot;&apos;Noto Serif TC&apos;,serif&quot; fill=&quot;#3a2a10&quot;&gt;
    &lt;g stroke=&quot;#8b6b34&quot; stroke-width=&quot;1.5&quot; fill=&quot;none&quot;&gt;
      &lt;rect x=&quot;40&quot; y=&quot;40&quot; width=&quot;30&quot; height=&quot;200&quot; /&gt;&lt;rect x=&quot;95&quot; y=&quot;40&quot; width=&quot;30&quot; height=&quot;200&quot; /&gt;
      &lt;rect x=&quot;150&quot; y=&quot;40&quot; width=&quot;30&quot; height=&quot;200&quot; /&gt;&lt;rect x=&quot;205&quot; y=&quot;40&quot; width=&quot;30&quot; height=&quot;200&quot; /&gt;
    &lt;/g&gt;
    &lt;rect x=&quot;41&quot; y=&quot;100&quot; width=&quot;28&quot; height=&quot;139&quot; fill=&quot;#c9a35a&quot; /&gt;
    &lt;rect x=&quot;96&quot; y=&quot;160&quot; width=&quot;28&quot; height=&quot;79&quot; fill=&quot;#c9a35a&quot; /&gt;
    &lt;rect x=&quot;151&quot; y=&quot;200&quot; width=&quot;28&quot; height=&quot;39&quot; fill=&quot;#b5593a&quot; /&gt;
    &lt;rect x=&quot;206&quot; y=&quot;130&quot; width=&quot;28&quot; height=&quot;109&quot; fill=&quot;#c9a35a&quot; /&gt;
    &lt;path d=&quot;M30 180 H245&quot; stroke=&quot;#b5593a&quot; stroke-width=&quot;1.5&quot; stroke-dasharray=&quot;5 4&quot; /&gt;
    &lt;text x=&quot;250&quot; y=&quot;184&quot; font-size=&quot;12&quot; fill=&quot;#b5593a&quot;&gt;警戒線&lt;/text&gt;
    &lt;g font-size=&quot;14&quot; text-anchor=&quot;middle&quot;&gt;
      &lt;text x=&quot;55&quot; y=&quot;262&quot;&gt;食慾&lt;/text&gt;&lt;text x=&quot;110&quot; y=&quot;262&quot;&gt;睡眠&lt;/text&gt;&lt;text x=&quot;165&quot; y=&quot;262&quot;&gt;娛樂&lt;/text&gt;&lt;text x=&quot;220&quot; y=&quot;262&quot;&gt;社交&lt;/text&gt;
    &lt;/g&gt;
    &lt;g stroke=&quot;#8b6b34&quot; stroke-width=&quot;1.5&quot; fill=&quot;#f7f0dc&quot;&gt;
      &lt;rect x=&quot;300&quot; y=&quot;50&quot; width=&quot;130&quot; height=&quot;56&quot; /&gt;&lt;rect x=&quot;460&quot; y=&quot;50&quot; width=&quot;130&quot; height=&quot;56&quot; /&gt;
      &lt;rect x=&quot;460&quot; y=&quot;184&quot; width=&quot;130&quot; height=&quot;56&quot; fill=&quot;#ecd9a4&quot; /&gt;&lt;rect x=&quot;300&quot; y=&quot;184&quot; width=&quot;130&quot; height=&quot;56&quot; /&gt;
    &lt;/g&gt;
    &lt;g font-size=&quot;16&quot; font-weight=&quot;700&quot; text-anchor=&quot;middle&quot;&gt;
      &lt;text x=&quot;365&quot; y=&quot;75&quot;&gt;慢慢下降&lt;/text&gt;&lt;text x=&quot;525&quot; y=&quot;75&quot;&gt;跌破警戒線&lt;/text&gt;
      &lt;text x=&quot;525&quot; y=&quot;209&quot;&gt;比較方法&lt;/text&gt;&lt;text x=&quot;365&quot; y=&quot;209&quot;&gt;動身去做&lt;/text&gt;
    &lt;/g&gt;
    &lt;g font-size=&quot;12&quot; text-anchor=&quot;middle&quot; fill=&quot;#6b5530&quot;&gt;
      &lt;text x=&quot;365&quot; y=&quot;94&quot;&gt;時間一久就會想要&lt;/text&gt;&lt;text x=&quot;525&quot; y=&quot;94&quot;&gt;餓、累、無聊、寂寞&lt;/text&gt;
      &lt;text x=&quot;525&quot; y=&quot;228&quot;&gt;背包、商店、朋友…&lt;/text&gt;&lt;text x=&quot;365&quot; y=&quot;228&quot;&gt;吃飯、睡覺、聊天&lt;/text&gt;
    &lt;/g&gt;
    &lt;g stroke=&quot;#8b6b34&quot; stroke-width=&quot;1.5&quot; fill=&quot;none&quot; marker-end=&quot;url(#ar3)&quot;&gt;
      &lt;path d=&quot;M430 78 H458&quot; /&gt;&lt;path d=&quot;M525 106 V182&quot; /&gt;&lt;path d=&quot;M460 212 H432&quot; /&gt;&lt;path d=&quot;M365 184 V108&quot; /&gt;
    &lt;/g&gt;
    &lt;text x=&quot;372&quot; y=&quot;150&quot; font-size=&quot;12&quot; fill=&quot;#7a4f12&quot;&gt;水位回升&lt;/text&gt;
  &lt;/g&gt;
&lt;/svg&gt;
&lt;figcaption&gt;每種慾望都是一個會慢慢下降的水位，居民一天的行動，就是在照顧這四個水位。&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2 id=&quot;每天都有自己的行程&quot;&gt;每天都有自己的行程&lt;/h2&gt;

&lt;p&gt;居民會替隔天排好行程：什麼時候工作、吃幾餐、什麼時候睡、有沒有空去玩或找朋友。一天的時間和體力有限，不可能每件事都做到最好，所以每個人都得取捨。&lt;/p&gt;

&lt;h2 id=&quot;去哪裡滿足也是一種盤算&quot;&gt;去哪裡滿足，也是一種盤算&lt;/h2&gt;

&lt;p&gt;肚子餓了，居民不會只往最近的地方跑。他們會比較手邊的選項：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;背包裡還有沒有存糧？&lt;/li&gt;
  &lt;li&gt;附近的店貴不貴？遠一點的店比較便宜，但值得走這一趟嗎？&lt;/li&gt;
  &lt;li&gt;去餐廳吃得比較飽，但口袋裡的錢夠嗎？&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;他們會考慮能補多少、要走多遠、要花多少錢，再看看自己的預算，選出最划算的一個。這也是商店和市場能做生意的原因（詳見〈&lt;a href=&quot;/devlog/2026/10/economy-overview/&quot;&gt;一塊麵包是怎麼來到你手上的&lt;/a&gt;〉）。&lt;/p&gt;

&lt;h2 id=&quot;慾望會養成性格&quot;&gt;慾望會養成性格&lt;/h2&gt;

&lt;p&gt;這個世界有「七罪」與「七德」，像是暴食與節制、貪婪與慷慨、懶惰與勤勉。它們和慾望息息相關：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;偏向罪的人&lt;/strong&gt;胃口大、消耗快，但一次也能吃得多、撐得久。食物充足的地方，他們如魚得水。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;偏向德的人&lt;/strong&gt;消耗少、比較省，但存不了太多。東西稀缺的時候，他們更能撐下去。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;兩者沒有誰比較好，&lt;strong&gt;取決於他們活在多富裕的世界裡&lt;/strong&gt;。&lt;/p&gt;

&lt;p&gt;性格也不是天生寫死的。每個人每天都有大致該吃多少、該玩多少的份量，&lt;strong&gt;超過了就是放縱&lt;/strong&gt;。一再放縱的人，可能慢慢染上罪；懂得忍耐的人，則有機會走向德。&lt;/p&gt;

&lt;h2 id=&quot;走投無路的時候&quot;&gt;走投無路的時候&lt;/h2&gt;

&lt;p&gt;四種慾望裡，只有&lt;strong&gt;吃和睡&lt;/strong&gt;會要人命。無聊和寂寞雖然難受，卻不會死。&lt;/p&gt;

&lt;p&gt;當一個人真的餓到撐不下去、身上又什麼都沒有時，他會怎麼做，要看&lt;strong&gt;他是什麼樣的人&lt;/strong&gt;，以及&lt;strong&gt;對方是誰&lt;/strong&gt;：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;善良的人&lt;/strong&gt;會向認識的人開口求助，或者乞討。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;邪惡或叛逆的人&lt;/strong&gt;可能去偷、去搶那些他本來就不喜歡的人。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;正義的人&lt;/strong&gt;甚至可能搶奪惡人，再把東西分給善良的人。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;活下來可能要付出道德的代價，而這也是罪在困苦中萌芽的方式。如果連這條路都走不通，那份結局也是他自己一路走來的結果，而不是擲骰子決定的。&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;需求系統是這個世界裡大部分故事的起點：商店為什麼有客人、居民為什麼會結交朋友、一個好人為什麼會變壞。之後我們也會再分享性格、人際關係與疾病等系統，看看它們怎麼和需求交織在一起。&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title type="html">一塊麵包是怎麼來到你手上的：經濟線設計</title>
    <link href="https://lockestudio.net/devlog/2026/10/economy-overview/" rel="alternate" type="text/html"/>
    <id>https://lockestudio.net/devlog/2026/10/economy-overview/</id>
    <published>2026-10-10T00:00:00+08:00</published>
    <updated>2026-10-10T00:00:00+08:00</updated>
    <summary type="html">公會、商會、商店各做什麼？用一張圖看懂世界裡的貨與錢怎麼流動。</summary>
    <content type="html" xml:base="https://lockestudio.net/devlog/2026/10/economy-overview/">&lt;p&gt;在《轉生者們》的世界裡，商店架上的東西不是憑空出現的。每一件貨都有人採、有人做、有人轉手，價格也跟著一路變化。這篇用最簡單的方式，說明背後的三個角色：&lt;strong&gt;公會、商會、商店&lt;/strong&gt;。&lt;/p&gt;

&lt;figure class=&quot;post-fig&quot; role=&quot;img&quot; aria-label=&quot;經濟線架構圖：採集場與工房把貨賣給商會，商會批發給商業公會的市場，也配貨給商店，商店再零售給居民&quot;&gt;
&lt;svg viewBox=&quot;0 0 600 330&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;
  &lt;defs&gt;
    &lt;marker id=&quot;ar&quot; viewBox=&quot;0 0 10 10&quot; refX=&quot;9&quot; refY=&quot;5&quot; markerWidth=&quot;7&quot; markerHeight=&quot;7&quot; orient=&quot;auto&quot;&gt;&lt;path d=&quot;M0 0 L10 5 L0 10 Z&quot; fill=&quot;#8b6b34&quot; /&gt;&lt;/marker&gt;
  &lt;/defs&gt;
  &lt;g font-family=&quot;&apos;Noto Serif TC&apos;,serif&quot; text-anchor=&quot;middle&quot; fill=&quot;#3a2a10&quot;&gt;
    &lt;g stroke=&quot;#8b6b34&quot; stroke-width=&quot;1.5&quot; fill=&quot;#f7f0dc&quot;&gt;
      &lt;rect x=&quot;20&quot; y=&quot;30&quot; width=&quot;130&quot; height=&quot;56&quot; /&gt;
      &lt;rect x=&quot;20&quot; y=&quot;130&quot; width=&quot;130&quot; height=&quot;56&quot; /&gt;
      &lt;rect x=&quot;235&quot; y=&quot;80&quot; width=&quot;130&quot; height=&quot;56&quot; /&gt;
      &lt;rect x=&quot;450&quot; y=&quot;80&quot; width=&quot;130&quot; height=&quot;56&quot; fill=&quot;#ecd9a4&quot; /&gt;
      &lt;rect x=&quot;235&quot; y=&quot;240&quot; width=&quot;130&quot; height=&quot;56&quot; /&gt;
      &lt;rect x=&quot;450&quot; y=&quot;240&quot; width=&quot;130&quot; height=&quot;56&quot; stroke-dasharray=&quot;5 4&quot; /&gt;
    &lt;/g&gt;
    &lt;g font-size=&quot;20&quot; font-weight=&quot;700&quot;&gt;
      &lt;text x=&quot;85&quot; y=&quot;58&quot;&gt;採集場&lt;/text&gt;&lt;text x=&quot;85&quot; y=&quot;158&quot;&gt;工房&lt;/text&gt;
      &lt;text x=&quot;300&quot; y=&quot;108&quot;&gt;商會&lt;/text&gt;&lt;text x=&quot;515&quot; y=&quot;108&quot;&gt;商業公會&lt;/text&gt;
      &lt;text x=&quot;300&quot; y=&quot;268&quot;&gt;商店&lt;/text&gt;&lt;text x=&quot;515&quot; y=&quot;268&quot;&gt;居民&lt;/text&gt;
    &lt;/g&gt;
    &lt;g font-size=&quot;14&quot; fill=&quot;#6b5530&quot;&gt;
      &lt;text x=&quot;85&quot; y=&quot;76&quot;&gt;小麥、礦石、藥草&lt;/text&gt;&lt;text x=&quot;85&quot; y=&quot;176&quot;&gt;麵包、藥、金屬錠&lt;/text&gt;
      &lt;text x=&quot;300&quot; y=&quot;126&quot;&gt;中盤商&lt;/text&gt;&lt;text x=&quot;515&quot; y=&quot;126&quot;&gt;大盤・經營市場&lt;/text&gt;
      &lt;text x=&quot;300&quot; y=&quot;286&quot;&gt;麵包店、醫院&lt;/text&gt;&lt;text x=&quot;515&quot; y=&quot;286&quot;&gt;買來吃、用、治病&lt;/text&gt;
    &lt;/g&gt;
    &lt;g stroke=&quot;#8b6b34&quot; stroke-width=&quot;1.5&quot; fill=&quot;none&quot; marker-end=&quot;url(#ar)&quot;&gt;
      &lt;path d=&quot;M150 64 L233 98&quot; /&gt;
      &lt;path d=&quot;M150 152 L233 120&quot; /&gt;
      &lt;path d=&quot;M365 108 L448 108&quot; /&gt;
      &lt;path d=&quot;M300 136 L300 238&quot; /&gt;
      &lt;path d=&quot;M365 268 L448 268&quot; /&gt;
    &lt;/g&gt;
    &lt;g font-size=&quot;15&quot; fill=&quot;#7a4f12&quot;&gt;
      &lt;text x=&quot;185&quot; y=&quot;70&quot;&gt;原料&lt;/text&gt;&lt;text x=&quot;185&quot; y=&quot;152&quot;&gt;成品&lt;/text&gt;
      &lt;text x=&quot;406&quot; y=&quot;100&quot;&gt;批發&lt;/text&gt;
      &lt;text x=&quot;300&quot; y=&quot;190&quot; text-anchor=&quot;start&quot; dx=&quot;10&quot;&gt;成本價配貨&lt;/text&gt;
      &lt;text x=&quot;406&quot; y=&quot;260&quot;&gt;零售&lt;/text&gt;
    &lt;/g&gt;
  &lt;/g&gt;
&lt;/svg&gt;
&lt;figcaption&gt;貨由左往右流動，錢則反方向流回去。&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;h2 id=&quot;三個角色&quot;&gt;三個角色&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;商業公會：大盤，負責經營市場。&lt;/strong&gt;
公會向商會收購貨物，再放到市場上大量出售。市場做的是大宗生意，適合整批進貨的人，不是讓人一個一個零買的地方。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;商會：中盤，負責牽起上下游。&lt;/strong&gt;
商會向採集場和工房收貨，一邊轉賣給公會，一邊把貨鋪給旗下的商店。每個商會只收自己業務範圍內的貨。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;商店：零售，直接面對居民。&lt;/strong&gt;
商店是商會的會員，可以用成本價向商會進貨，再加價賣給居民。賺到的錢有兩成要繳回商會，其餘歸自己。醫院也是一種商店：醫生會先診斷病人得了什麼病，再開對症的藥。&lt;/p&gt;

&lt;h2 id=&quot;生產者也有自己的盤算&quot;&gt;生產者也有自己的盤算&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;採集場&lt;/strong&gt;派人去田裡、礦坑採集，把原料賣給商會。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;工房&lt;/strong&gt;要自己去市場買原料，做成成品再賣出。平常賣給商會，倉庫快滿、商會吃不下時，才由公會出面收購。&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;價格為什麼一層比一層高&quot;&gt;價格為什麼一層比一層高&lt;/h2&gt;

&lt;p&gt;每一層都是&lt;strong&gt;買斷&lt;/strong&gt;上一層的貨，不是代賣，所以每一層都要賺到差價才做得成生意。賣不掉的風險，也由當時持有貨物的人承擔：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;工房 → 商會 → 公會 → 市場，每過一手，價格就往上加一點。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;商店則是在市價上再加成，這是零售賺錢的方式。所以在商店買東西通常比市場貴，但可以&lt;strong&gt;殺價&lt;/strong&gt;。&lt;/p&gt;

&lt;h2 id=&quot;居民也會精打細算&quot;&gt;居民也會精打細算&lt;/h2&gt;

&lt;p&gt;居民肚子餓、生病的時候，會比較幾個選項：背包裡的存糧、附近的店、遠一點但比較便宜的店。他們會考慮走過去的路程、價格，以及自己的預算，再決定去哪裡買。沒錢的時候，就只能先將就。&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;這套經濟線還在持續開發與調整，之後的開發日誌會再分享各個環節的細節，例如工房怎麼決定要生產什麼，以及缺貨時價格會怎麼波動。&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title type="html">世界越大，一天越難結束：日結效能的三道關卡</title>
    <link href="https://lockestudio.net/devlog/2026/10/day-close-parallel/" rel="alternate" type="text/html"/>
    <id>https://lockestudio.net/devlog/2026/10/day-close-parallel/</id>
    <published>2026-10-10T00:00:00+08:00</published>
    <updated>2026-10-10T00:00:00+08:00</updated>
    <summary type="html">從介面卡頓、結算越跑越慢，到把一天的結算拆成多條隊伍同時進行。</summary>
    <content type="html" xml:base="https://lockestudio.net/devlog/2026/10/day-close-parallel/">&lt;p&gt;《轉生者們》的世界裡，每位居民、每間商會與公會都在各自過日子。每到一天結束，世界要做一次&lt;strong&gt;日結&lt;/strong&gt;：工房結算產量、商會進貨、公會收購、居民吃飯看病、帳款入帳……全部算完，才能進入隔天。&lt;/p&gt;

&lt;p&gt;世界還小的時候，這一切都很順。但隨著城市與人口變多，我們接連撞上了三道關卡。&lt;/p&gt;

&lt;h2 id=&quot;第一關一開觀測視窗就卡&quot;&gt;第一關：一開觀測視窗就卡&lt;/h2&gt;

&lt;p&gt;開發時，我們會開「觀測站」視窗即時查看世界的狀態。問題是，畫面每次重繪都直接去翻世界的資料，而世界本身也在同一條執行緒上運作。結果就是：&lt;strong&gt;畫面在等世界，世界也在等畫面&lt;/strong&gt;，整個編輯器跟著卡頓。&lt;/p&gt;

&lt;p&gt;這不只是開發工具的問題，之後玩家看到的遊戲介面也會遇到。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;解法&lt;/strong&gt;：讓世界搬到自己的背景執行緒上運作，每秒發布一份「快照」。畫面只讀快照，不再碰正在變動的世界。一秒一次對人眼來說已經足夠，而世界終於可以專心跑自己的事。&lt;/p&gt;

&lt;h2 id=&quot;第二關一天比一天更難結束&quot;&gt;第二關：一天比一天更難結束&lt;/h2&gt;

&lt;p&gt;世界搬家之後，新的問題浮現：模擬速度追不上設定，而且&lt;strong&gt;日結一天比一天慢&lt;/strong&gt;。第一天只要 1.6 秒，幾天後最慢的一天竟然要 22 秒。&lt;/p&gt;

&lt;p&gt;我們把日結的每一段分開計時，最後發現：大約&lt;strong&gt;九成的時間&lt;/strong&gt;，都花在「每完成一張委託，就把整份委託資料寫回資料庫」。但在玩家真的存檔之前，根本沒有人需要這份資料。&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;解法&lt;/strong&gt;：只在存檔時才寫入。修完之後，日結回到每天 1～2 秒，而且不再隨天數變長。&lt;/p&gt;

&lt;h2 id=&quot;第三關想同時做卻怕算錯錢&quot;&gt;第三關：想同時做，卻怕算錯錢&lt;/h2&gt;

&lt;p&gt;接下來的目標，是讓世界變大時依然撐得住。最直覺的做法是&lt;strong&gt;併行&lt;/strong&gt;：日結裡有許多彼此無關的工作，例如甲商會進貨、乙商會進貨、居民各自吃飯，沒道理一定要排成一列。&lt;/p&gt;

&lt;p&gt;但併行有一個致命的風險。想像兩個人同時對同一個錢包做事：&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;錢包裡有 100 枚銅幣。A 收到 30 枚，B 同時收到 50 枚。兩人都先看到「100」，各自算出 130 和 150 再寫回去，最後錢包裡是 150。&lt;strong&gt;那 30 枚就這樣憑空消失了。&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;調查時我們還發現，這種風險其實&lt;strong&gt;早就存在&lt;/strong&gt;：居民的行為和日結本來就可能同時動到同一個錢包，只是還沒有被觀察到。&lt;/p&gt;

&lt;h2 id=&quot;現在的設計分隊伍共用窗口排隊&quot;&gt;現在的設計：分隊伍，共用窗口排隊&lt;/h2&gt;

&lt;figure class=&quot;post-fig&quot; role=&quot;img&quot; aria-label=&quot;序列與併行對照圖：以前所有工作排成一列；現在依擁有者分成多條隊伍同時進行，等大家都做完才進入下一階段&quot;&gt;
&lt;svg viewBox=&quot;0 0 600 300&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot;&gt;
  &lt;defs&gt;
    &lt;marker id=&quot;ar2&quot; viewBox=&quot;0 0 10 10&quot; refX=&quot;9&quot; refY=&quot;5&quot; markerWidth=&quot;7&quot; markerHeight=&quot;7&quot; orient=&quot;auto&quot;&gt;&lt;path d=&quot;M0 0 L10 5 L0 10 Z&quot; fill=&quot;#8b6b34&quot; /&gt;&lt;/marker&gt;
  &lt;/defs&gt;
  &lt;g font-family=&quot;&apos;Noto Serif TC&apos;,serif&quot; fill=&quot;#3a2a10&quot;&gt;
    &lt;g font-size=&quot;17&quot; font-weight=&quot;700&quot;&gt;
      &lt;text x=&quot;20&quot; y=&quot;64&quot;&gt;以前&lt;/text&gt;
      &lt;text x=&quot;20&quot; y=&quot;200&quot;&gt;現在&lt;/text&gt;
    &lt;/g&gt;
    &lt;g stroke=&quot;#8b6b34&quot; stroke-width=&quot;1.5&quot; fill=&quot;#f7f0dc&quot;&gt;
      &lt;rect x=&quot;80&quot; y=&quot;40&quot; width=&quot;80&quot; height=&quot;36&quot; /&gt;&lt;rect x=&quot;160&quot; y=&quot;40&quot; width=&quot;80&quot; height=&quot;36&quot; /&gt;&lt;rect x=&quot;240&quot; y=&quot;40&quot; width=&quot;80&quot; height=&quot;36&quot; /&gt;
      &lt;rect x=&quot;320&quot; y=&quot;40&quot; width=&quot;80&quot; height=&quot;36&quot; /&gt;&lt;rect x=&quot;400&quot; y=&quot;40&quot; width=&quot;80&quot; height=&quot;36&quot; /&gt;&lt;rect x=&quot;480&quot; y=&quot;40&quot; width=&quot;80&quot; height=&quot;36&quot; /&gt;
      &lt;rect x=&quot;80&quot; y=&quot;130&quot; width=&quot;80&quot; height=&quot;36&quot; /&gt;&lt;rect x=&quot;160&quot; y=&quot;130&quot; width=&quot;80&quot; height=&quot;36&quot; /&gt;
      &lt;rect x=&quot;80&quot; y=&quot;176&quot; width=&quot;80&quot; height=&quot;36&quot; /&gt;&lt;rect x=&quot;160&quot; y=&quot;176&quot; width=&quot;80&quot; height=&quot;36&quot; /&gt;
      &lt;rect x=&quot;80&quot; y=&quot;222&quot; width=&quot;80&quot; height=&quot;36&quot; /&gt;&lt;rect x=&quot;160&quot; y=&quot;222&quot; width=&quot;80&quot; height=&quot;36&quot; /&gt;
    &lt;/g&gt;
    &lt;g font-size=&quot;14&quot; text-anchor=&quot;middle&quot;&gt;
      &lt;text x=&quot;120&quot; y=&quot;63&quot;&gt;甲商會&lt;/text&gt;&lt;text x=&quot;200&quot; y=&quot;63&quot;&gt;乙商會&lt;/text&gt;&lt;text x=&quot;280&quot; y=&quot;63&quot;&gt;丙工房&lt;/text&gt;
      &lt;text x=&quot;360&quot; y=&quot;63&quot;&gt;居民 1&lt;/text&gt;&lt;text x=&quot;440&quot; y=&quot;63&quot;&gt;居民 2&lt;/text&gt;&lt;text x=&quot;520&quot; y=&quot;63&quot;&gt;居民 3&lt;/text&gt;
      &lt;text x=&quot;120&quot; y=&quot;153&quot;&gt;甲商會&lt;/text&gt;&lt;text x=&quot;200&quot; y=&quot;153&quot;&gt;居民 1&lt;/text&gt;
      &lt;text x=&quot;120&quot; y=&quot;199&quot;&gt;乙商會&lt;/text&gt;&lt;text x=&quot;200&quot; y=&quot;199&quot;&gt;居民 2&lt;/text&gt;
      &lt;text x=&quot;120&quot; y=&quot;245&quot;&gt;丙工房&lt;/text&gt;&lt;text x=&quot;200&quot; y=&quot;245&quot;&gt;居民 3&lt;/text&gt;
    &lt;/g&gt;
    &lt;path d=&quot;M260 120 V268&quot; stroke=&quot;#8b6b34&quot; stroke-width=&quot;2&quot; stroke-dasharray=&quot;6 5&quot; /&gt;
    &lt;text x=&quot;260&quot; y=&quot;286&quot; font-size=&quot;13&quot; text-anchor=&quot;middle&quot; fill=&quot;#7a4f12&quot;&gt;等大家都做完&lt;/text&gt;
    &lt;path d=&quot;M268 194 H318&quot; stroke=&quot;#8b6b34&quot; stroke-width=&quot;1.5&quot; marker-end=&quot;url(#ar2)&quot; /&gt;
    &lt;rect x=&quot;320&quot; y=&quot;176&quot; width=&quot;100&quot; height=&quot;36&quot; fill=&quot;#ecd9a4&quot; stroke=&quot;#8b6b34&quot; stroke-width=&quot;1.5&quot; /&gt;
    &lt;text x=&quot;370&quot; y=&quot;199&quot; font-size=&quot;14&quot; text-anchor=&quot;middle&quot;&gt;下一階段&lt;/text&gt;
    &lt;rect x=&quot;440&quot; y=&quot;130&quot; width=&quot;140&quot; height=&quot;128&quot; fill=&quot;none&quot; stroke=&quot;#8b6b34&quot; stroke-width=&quot;1.5&quot; stroke-dasharray=&quot;4 4&quot; /&gt;
    &lt;g font-size=&quot;13&quot; text-anchor=&quot;middle&quot; fill=&quot;#6b5530&quot;&gt;
      &lt;text x=&quot;510&quot; y=&quot;156&quot; font-weight=&quot;700&quot; fill=&quot;#5b3f14&quot;&gt;共用窗口&lt;/text&gt;
      &lt;text x=&quot;510&quot; y=&quot;180&quot;&gt;錢包・市場&lt;/text&gt;
      &lt;text x=&quot;510&quot; y=&quot;200&quot;&gt;人際關係&lt;/text&gt;
      &lt;text x=&quot;510&quot; y=&quot;226&quot;&gt;一次只服務一位&lt;/text&gt;
      &lt;text x=&quot;510&quot; y=&quot;246&quot;&gt;其他人排隊&lt;/text&gt;
    &lt;/g&gt;
    &lt;path d=&quot;M80 100 H560&quot; stroke=&quot;#b8893a&quot; stroke-width=&quot;1&quot; /&gt;
    &lt;text x=&quot;320&quot; y=&quot;96&quot; font-size=&quot;12&quot; text-anchor=&quot;middle&quot; fill=&quot;#7a4f12&quot;&gt;時間 →&lt;/text&gt;
  &lt;/g&gt;
&lt;/svg&gt;
&lt;figcaption&gt;依擁有者分成多條隊伍同時進行；共用的窗口一次只讓一位辦事。&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;我們沒有大改每個系統的寫法，而是只改了兩個地方：&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;一位排程員&lt;/strong&gt;：負責把當天的工作分隊伍。同一家商會、同一位居民的事永遠排在同一條隊伍，不同擁有者的事就可以同時進行。每個階段結束時，等所有隊伍都做完，才進入下一階段。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;共用窗口加鎖&lt;/strong&gt;：錢包、市場、人際關係、公會成員名冊這些大家都會碰的東西，各自加上「一次只服務一位」的鎖。鎖只包住「看、算、寫回」那一小段，而且辦事途中不准跑去別的窗口插隊，避免兩個人互相等對方而卡死。&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;另外還有幾條規則：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;兩種模式隨時切換&lt;/strong&gt;：「序列模式」照舊一件一件做，方便抓問題；「併行模式」用多條隊伍。量效能時切換比對，就知道瓶頸在哪。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;兩個市場的日結不同時進行&lt;/strong&gt;：市場缺貨時會向別的市場買，如果兩邊同時做，可能互相等對方。&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;怎麼確認沒算錯&lt;/strong&gt;：併行之後，誰先買到貨會因時機而不同，所以我們不要求兩種模式的結果一模一樣，而是檢查&lt;strong&gt;守恆&lt;/strong&gt;：全世界的錢與貨物，增減都要對得上帳，不能有負數，也不能有同一個人重複加入同一種組織。&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;成果&quot;&gt;成果&lt;/h2&gt;

&lt;p&gt;在四座城、128 位居民的測試世界裡：&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;整天的日結從平均約 &lt;strong&gt;3.5 秒降到 2.6 秒&lt;/strong&gt;。&lt;/li&gt;
  &lt;li&gt;其中各家機構的結算段，速度約是原本的 &lt;strong&gt;2 倍&lt;/strong&gt;。&lt;/li&gt;
  &lt;li&gt;兩種模式都跑出零錯誤。&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;不是每一段都能併行。有些階段本來就有先後順序，例如要先上架，別人才買得到，這些我們刻意保留成一件一件做。&lt;/p&gt;

&lt;p&gt;量測過程中也看到了下一個瓶頸：世界每一刻都在替所有角色更新狀態效果的倒數，連遠方城市的居民也包括在內。這部分已經在規劃新的做法，之後有進展再跟大家分享。&lt;/p&gt;
</content>
  </entry>
  <entry>
    <title type="html">開發日誌開張</title>
    <link href="https://lockestudio.net/devlog/2026/10/devlog-start/" rel="alternate" type="text/html"/>
    <id>https://lockestudio.net/devlog/2026/10/devlog-start/</id>
    <published>2026-10-09T00:00:00+08:00</published>
    <updated>2026-10-09T00:00:00+08:00</updated>
    <summary type="html">《轉生者們》的開發紀錄從這裡開始。</summary>
    <content type="html" xml:base="https://lockestudio.net/devlog/2026/10/devlog-start/">&lt;p&gt;《轉生者們》的開發日誌從今天開始更新。&lt;/p&gt;

&lt;p&gt;這裡會記錄遊戲在開發過程中的點點滴滴：新系統的設計想法、美術進度、踩到的坑和修掉的 bug，以及每個里程碑。&lt;/p&gt;

&lt;h2 id=&quot;會寫些什麼&quot;&gt;會寫些什麼&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;系統&lt;/strong&gt;：轉生、天賦、NPC 的生活循環與經濟線是怎麼一步步長出來的&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;美術&lt;/strong&gt;：角色立繪、介面與場景的進度&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;修正&lt;/strong&gt;：比較有意思的 bug，以及它們是怎麼被抓到的&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;里程碑&lt;/strong&gt;：可以玩的版本、展覽與發布消息&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
  &lt;p&gt;祝福，抑或詛咒？轉生者的命運，掌握在你的手中。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;可以透過 &lt;a href=&quot;/devlog/feed.xml&quot;&gt;RSS&lt;/a&gt; 訂閱更新。&lt;/p&gt;
</content>
  </entry>
</feed>

