{"id":4628,"date":"2017-01-22T23:57:12","date_gmt":"2017-01-22T23:57:12","guid":{"rendered":"http:\/\/phoenixgamedevelopment.com\/blog\/?p=4628"},"modified":"2017-01-23T00:03:49","modified_gmt":"2017-01-23T00:03:49","slug":"p0-p-172-part-93-procedural-content-planet-builder","status":"publish","type":"post","link":"https:\/\/phoenixgamedevelopment.com\/blog\/p0-p-172-part-93-procedural-content-planet-builder\/","title":{"rendered":"P0-P-172: Part 93: Procedural Content: Planet Builder"},"content":{"rendered":"<p>There are two major problems that I need to solve when deciding how to procedurally decorate a planet-size object.<\/p>\n<p>There are the obvious issues of generating and storing that much content, and there is the problem of actually placing that data on the planets surface.<\/p>\n<p>The data needs to be accessible on the server, since this is a multiplayer and a persistent world game. I need to be able to make changes to the world overtime, character and ships should move from one city to another, nations and planets could trade, engage in combat, develop new technology, construct or demolish new buildings, etc.<\/p>\n<p>However, I can&#8217;t just place them on the terrain because the terrain wont actually be rendered until there is a player there to see it.<\/p>\n<p>What I have decided to do is to create the core objects (cities, forests, etc) on the server, and give them a position based on just the planet center and its radius. I can then perform all of the necessary server side calculations.<\/p>\n<p>When a server gets close enough for the object to be rendered, (which I can determine from its server position) I can then use a raycast to align it exactly to the terrain surface. By the time the player is close enough to see buildings, etc, they will be close enough that the planet itself will be rendering.<\/p>\n<p>This should work fine. The only issue is that there is no way to tell what the terrain will be like at the location where the object is created. It could be on top of a mountain, or in the middle of an ocean.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are two major problems that I need to solve when deciding how to procedurally decorate a planet-size object. There are the obvious issues of generating and storing that much content, and there is the problem of actually placing that data on the planets surface. The data needs to be accessible on the server, since [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,17,10,11],"tags":[],"class_list":["post-4628","post","type-post","status-publish","format-standard","hentry","category-astral-realms","category-p-0","category-software-and-games","category-spiritus-astrum","has-post-title","has-post-date","has-post-category","has-post-tag","has-post-comment","has-post-author",""],"aioseo_notices":[],"builder_content":"","_links":{"self":[{"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts\/4628"}],"collection":[{"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/comments?post=4628"}],"version-history":[{"count":3,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts\/4628\/revisions"}],"predecessor-version":[{"id":4633,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts\/4628\/revisions\/4633"}],"wp:attachment":[{"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/media?parent=4628"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/categories?post=4628"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/tags?post=4628"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}