{"id":751,"date":"2010-11-07T11:55:49","date_gmt":"2010-11-07T19:55:49","guid":{"rendered":"http:\/\/technofovea.com\/blog\/?p=751"},"modified":"2010-11-07T12:26:39","modified_gmt":"2010-11-07T20:26:39","slug":"minecraft-monster-spawning-ideas","status":"publish","type":"post","link":"http:\/\/technofovea.com\/blog\/archives\/751","title":{"rendered":"Minecraft monster spawning ideas"},"content":{"rendered":"<p>With the recent 2010 Halloween update to Minecraft, players are complaining about some of the changes to monster-spawning code which causes them to appear in otherwise-safe areas. After kicking some ideas around, I figured they might be worth a blog-post or two.<\/p>\n<p>I&#8217;d like to present three ideas that should make the lighting-based monsters spawning system more viable. While it may seem to make players safer in their bases, it actually means that the game can place a greater emphasis on spawning lots of monsters because it reduces the chance of &#8220;weird&#8221; or &#8220;unfair&#8221; monster appearances.<\/p>\n<h2 style=\"clear: both;\">Suggestion 1: Bright ceilings also deter monster spawns.<\/h2>\n<div id=\"attachment_793\" style=\"width: 120px\" class=\"wp-caption alignleft\"><a href=\"http:\/\/technofovea.com\/blog\/wp-content\/uploads\/2010\/11\/spawn_search_order.png\"><img aria-describedby=\"caption-attachment-793\" loading=\"lazy\" class=\"size-full wp-image-793 \" title=\"spawn_search_order\" src=\"http:\/\/technofovea.com\/blog\/wp-content\/uploads\/2010\/11\/spawn_search_order.png\" alt=\"\" width=\"110\" height=\"176\" \/><\/a><p id=\"caption-attachment-793\" class=\"wp-caption-text\">The order in which cells are checked before spawning a creeper<\/p><\/div>\n<p>Currently, monsters will spawn based on the brightness of the bottommost &#8220;floor&#8221; tiles. While this makes some sense from a technical standpoint, it neglects to consider how players prefer to light their buildings, and leads to cases where an area that <em>seems<\/em> properly lit can still be vulnerable.<\/p>\n<p>To fix this: When deciding whether to spawn a monster, check any empty-space around the spot and make sure the surroundings (especially upwards) are either &#8220;solid&#8221; or else are also dark enough.<\/p>\n<div id=\"attachment_794\" style=\"width: 120px\" class=\"wp-caption alignright\"><a href=\"http:\/\/technofovea.com\/blog\/wp-content\/uploads\/2010\/11\/spawn_search_order2.png\"><img aria-describedby=\"caption-attachment-794\" loading=\"lazy\" class=\"size-full wp-image-794\" title=\"spawn_search_order2\" src=\"http:\/\/technofovea.com\/blog\/wp-content\/uploads\/2010\/11\/spawn_search_order2.png\" alt=\"\" width=\"110\" height=\"176\" \/><\/a><p id=\"caption-attachment-794\" class=\"wp-caption-text\">Blocks checked for light when obstructions are present<\/p><\/div>\n<p>On the left you can see that for a 2&#215;1 creeper (side-view) the spawning system checks each of the blocks in the order shown. If a block on the path is &#8220;solid&#8221;, the checking on that line stops. If any &#8220;open&#8221; block visited has a light-level that is too high, the creeper cannot spawn.<\/p>\n<p>In conclusion, monsters can&#8211;as before&#8211;spawn in very small dark places. However, if the area is larger, some of the extra space is checked to make sure it is also dark-enough.<\/p>\n<h2 style=\"clear: both;\">Suggestion 2: Player &#8220;scent&#8221; trails.<\/h2>\n<p>Some people may be familiar with this as &#8220;breadcrumbs&#8221; from AI terminology. Basically, the player leaves behind a &#8220;smell&#8221; in the world as they move around. This smell goes a small distance from them, and then hangs around areas they&#8217;ve been for a while before fading. A given area will have a smell that depends on how close the player was, and how long ago they were nearby.<\/p>\n<p>Technical details: Each block (or perhaps each &#8220;floor&#8221; surface) has a special counter. Counters which are above zero will decrease with time (and are zeroed when the chunk is unloaded.) If the player is near a block, that block&#8217;s counter cannot be lower than an a certain amount based on how close the player is. This means that the &#8220;smell&#8221; of a block depends both on how long ago the player was nearby, and how close the player was to to that block before they moved away.<\/p>\n<p>This basic idea provides two very useful possibilities in terms of both making players less-frustrated and also making monsters a slightly bigger challenge:<\/p>\n<ol>\n<li>\n<p>Most immediately-useful: <span style=\"text-decoration: underline;\">Monsters can be prevented from spawning anywhere the player has very recently been<\/span>, even if that place is poorly lit. This prevents annoying (and impossible) cases where you walk around a large room, and then a monster appears on the far side of it behind you as you are leaving through the only door.<\/p>\n<\/li>\n<li>\n<p>It provides a way to make monsters <span style=\"text-decoration: underline;\">smarter<\/span>! OK, not very much, but smart enough to actually <em>follow<\/em> you around small corners. If they can&#8217;t directly reach you, they can try to follow the path <em>you<\/em> took by looking at gradients in the smells.<\/p>\n<\/li>\n<\/ol>\n<h2 style=\"clear: both;\">Suggestion 3: Additive lighting<\/h2>\n<p>Currently, Minecraft&#8217;s lighting model is not additive. \u00c2\u00a0This means that (compared to the real world) adding more torches doesn&#8217;t always make certain areas any brighter than they were before. I&#8217;ve made a quick animation to illustrate what I mean by &#8220;non-additive&#8221;. In the real world, you would expect the area between both torches to become brighter, but it does not.<\/p>\n<div id=\"attachment_764\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/technofovea.com\/blog\/wp-content\/uploads\/2010\/11\/non_additive_light.gif\"><img aria-describedby=\"caption-attachment-764\" loading=\"lazy\" class=\"size-medium wp-image-764 \" title=\"non_additive_light\" src=\"http:\/\/technofovea.com\/blog\/wp-content\/uploads\/2010\/11\/non_additive_light-300x90.gif\" alt=\"\" width=\"300\" height=\"90\" srcset=\"http:\/\/technofovea.com\/blog\/wp-content\/uploads\/2010\/11\/non_additive_light-300x90.gif 300w, http:\/\/technofovea.com\/blog\/wp-content\/uploads\/2010\/11\/non_additive_light.gif 830w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-764\" class=\"wp-caption-text\">Click to see an animation showing how light is non-additive in Minecraft<\/p><\/div>\n<p>This lighting model is partly responsible for the frustration people are having in deep areas of the world: They place torches in a way which seems correct based on real-world lighting, but it doesn&#8217;t really work. Every time you see someone make a 1&#215;1 pillar with torches on all four sides, it&#8217;s an example of this mistaken belief. The way the minecraft world currently works, \u00c2\u00a0the ideal way to light things is to <strong>avoid<\/strong> grouping any torches together, yet players do this all the time because it&#8217;s what we &#8220;know&#8221; works.<\/p>\n<p>Changing to an additive model (with an upper cap on brightness) would add visual realism and reduce the amount of frustration players will feel when trying to make areas safe.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>With the recent 2010 Halloween update to Minecraft, players are complaining about some of the changes to monster-spawning code which causes them to appear in otherwise-safe areas. After kicking some ideas around, I figured they might be worth a blog-post or two. I&#8217;d like to present three ideas that should make the lighting-based monsters spawning [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[10,4],"tags":[21],"_links":{"self":[{"href":"http:\/\/technofovea.com\/blog\/wp-json\/wp\/v2\/posts\/751"}],"collection":[{"href":"http:\/\/technofovea.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/technofovea.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/technofovea.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/technofovea.com\/blog\/wp-json\/wp\/v2\/comments?post=751"}],"version-history":[{"count":27,"href":"http:\/\/technofovea.com\/blog\/wp-json\/wp\/v2\/posts\/751\/revisions"}],"predecessor-version":[{"id":806,"href":"http:\/\/technofovea.com\/blog\/wp-json\/wp\/v2\/posts\/751\/revisions\/806"}],"wp:attachment":[{"href":"http:\/\/technofovea.com\/blog\/wp-json\/wp\/v2\/media?parent=751"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/technofovea.com\/blog\/wp-json\/wp\/v2\/categories?post=751"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/technofovea.com\/blog\/wp-json\/wp\/v2\/tags?post=751"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}