{"id":2708,"date":"2023-05-27T04:55:45","date_gmt":"2023-05-27T11:55:45","guid":{"rendered":"https:\/\/rose.dev\/blog\/?p=2708"},"modified":"2024-02-07T02:49:37","modified_gmt":"2024-02-07T10:49:37","slug":"starbound-1-4-4-source-code-access","status":"publish","type":"post","link":"https:\/\/rose.dev\/blog\/2023\/05\/27\/starbound-1-4-4-source-code-access\/","title":{"rendered":"Starbound 1.4.4 Source Code"},"content":{"rendered":"\n<p>Starbound has been one of my favorite games of all time, so I&#8217;m happy to say that I have the latest Starbound source code, last commit August 7th, 2019. I will not be explaining how I got these files. It is the actual source, not just a decompilation, and as such includes build scripts, unused stuff, old migration code, comments, a stored test player, etc.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Source Screenshots<\/h2>\n\n\n\n<p>The source has minimal comments, and the structure is reasonable. I found the code easy to read and understand, but perhaps that&#8217;s because I&#8217;ve been modding Starbound for years now and am familiar with its behavior.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Languages Breakdown (GitHub)<\/h4>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"392\" height=\"188\" sizes=\"auto, (max-width: 392px) 100vw, 392px\" src=\"https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/image.png\" alt=\"\" class=\"wp-image-2747\" srcset=\"https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/image.png 392w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/image-300x144.png 300w\" \/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">StarEnvironmentPainter.cpp<\/h4>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"556\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" src=\"https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/StarEnvironmentPainter.cpp_-1024x556.png\" alt=\"StarEnviroment.cpp preview\" class=\"wp-image-2717\" srcset=\"https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/StarEnvironmentPainter.cpp_-1024x556.png 1024w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/StarEnvironmentPainter.cpp_-300x163.png 300w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/StarEnvironmentPainter.cpp_-768x417.png 768w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/StarEnvironmentPainter.cpp_-1536x834.png 1536w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/StarEnvironmentPainter.cpp_-2048x1112.png 2048w\" \/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">StarMixer.cpp (audio related)<\/h4>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"556\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" src=\"https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/StarMixer.cpp_-1024x556.png\" alt=\"StarMixer.cpp source preview\" class=\"wp-image-2718\" srcset=\"https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/StarMixer.cpp_-1024x556.png 1024w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/StarMixer.cpp_-300x163.png 300w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/StarMixer.cpp_-768x417.png 768w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/StarMixer.cpp_-1536x834.png 1536w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/StarMixer.cpp_-2048x1112.png 2048w\" \/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">StarTools.cpp<\/h4>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"556\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" src=\"https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/StarTools.cpp_-1024x556.png\" alt=\"StarTools.cpp source preview\" class=\"wp-image-2720\" srcset=\"https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/StarTools.cpp_-1024x556.png 1024w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/StarTools.cpp_-300x163.png 300w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/StarTools.cpp_-768x417.png 768w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/StarTools.cpp_-1536x834.png 1536w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/StarTools.cpp_-2048x1112.png 2048w\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Building<\/h3>\n\n\n\n<p>And of course, we can build it. I compiled this version without Steam API or the Discord rich presence API, but those are easily included.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1011\" height=\"1024\" sizes=\"auto, (max-width: 1011px) 100vw, 1011px\" src=\"https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/built-1011x1024.png\" alt=\"\" class=\"wp-image-2729\" srcset=\"https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/built-1011x1024.png 1011w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/built-296x300.png 296w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/built-768x778.png 768w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/built.png 1225w\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<span class=\"embed-youtube\" style=\"text-align:center; display: block;\"><iframe loading=\"lazy\" class=\"youtube-player\" width=\"660\" height=\"372\" src=\"https:\/\/www.youtube.com\/embed\/xmSjwU5by74?version=3&#038;rel=1&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;fs=1&#038;hl=en-US&#038;autohide=2&#038;wmode=transparent\" allowfullscreen=\"true\" style=\"border:0;\" sandbox=\"allow-scripts allow-same-origin allow-popups allow-presentation allow-popups-to-escape-sandbox\"><\/iframe><\/span>\n<\/div><figcaption class=\"wp-element-caption\">Skip to 1:10 to see the game launch<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Funny Developer Comments<\/h2>\n\n\n\n<p>Here&#8217;s a look at some of the best (in my opinion) developer comments in the source. This is not intended to be a mockery, far from it, I&#8217;m ecstatic I can take a peek into the minds of the developers. Enjoy.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><\/h2>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"778\" height=\"671\" sizes=\"auto, (max-width: 778px) 100vw, 778px\" src=\"https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/trustworthyish.png\" alt=\"\/\/ message is fullbody encrypted so the response is trust worthyish\" class=\"wp-image-2731\" style=\"width:778px;height:671px\" srcset=\"https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/trustworthyish.png 778w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/trustworthyish-300x259.png 300w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/trustworthyish-768x662.png 768w\" \/><figcaption class=\"wp-element-caption\">\/\/ message is fullbody encrypted so the response is trust worthyish<\/figcaption><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><img loading=\"lazy\" decoding=\"async\" width=\"1062\" height=\"830\" sizes=\"auto, (max-width: 1062px) 100vw, 1062px\" src=\"https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/Meh.png\" alt=\"\/\/ Meh, padding is hard-coded here\" class=\"wp-image-2733\" srcset=\"https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/Meh.png 1062w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/Meh-300x234.png 300w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/Meh-1024x800.png 1024w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/Meh-768x600.png 768w\" \/><figcaption class=\"wp-element-caption\">\/\/ Meh, padding is hard-coded here<\/figcaption><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1095\" height=\"1064\" sizes=\"auto, (max-width: 1095px) 100vw, 1095px\" src=\"https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/hate-hardcoded.png\" alt=\"\/\/ TODO: I hate these hardcoded values.  Please smite with fire.\n\" class=\"wp-image-2735\" srcset=\"https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/hate-hardcoded.png 1095w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/hate-hardcoded-300x292.png 300w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/hate-hardcoded-1024x995.png 1024w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/hate-hardcoded-768x746.png 768w\" \/><figcaption class=\"wp-element-caption\">\/\/ TODO: I hate these hardcoded values. Please smite with fire.<\/figcaption><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1199\" height=\"1210\" sizes=\"auto, (max-width: 1199px) 100vw, 1199px\" src=\"https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/getrid.png\" alt=\"\/\/ TODO: Get rid of this stupid fucking bullshit, this is the ugliest\n\/\/ fragilest pointlessest horseshit code in the codebase.  It wouldn't\n\/\/ bother me so bad if it weren't so fucking easy to do right.\" class=\"wp-image-2737\" srcset=\"https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/getrid.png 1199w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/getrid-297x300.png 297w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/getrid-1015x1024.png 1015w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/getrid-150x150.png 150w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/getrid-768x775.png 768w\" \/><figcaption class=\"wp-element-caption\">\/\/ TODO: Get rid of this stupid fucking bullshit, this is the ugliest<br>\/\/ fragilest pointlessest horseshit code in the codebase. It wouldn&#8217;t<br>\/\/ bother me so bad if it weren&#8217;t so fucking easy to do right.<\/figcaption><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1234\" height=\"1229\" sizes=\"auto, (max-width: 1234px) 100vw, 1234px\" src=\"https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/simple.png\" alt=\"\/\/ This was once simple and elegant and made sense but then I made it\n\/\/ match the actual platform rendering more closely and now it's a big\n\/\/ shitty pile of special cases again. RIP.\" class=\"wp-image-2738\" srcset=\"https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/simple.png 1234w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/simple-300x300.png 300w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/simple-1024x1020.png 1024w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/simple-150x150.png 150w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/simple-768x765.png 768w\" \/><figcaption class=\"wp-element-caption\">\/\/ This was once simple and elegant and made sense but then I made it<br>\/\/ match the actual platform rendering more closely and now it&#8217;s a big<br>\/\/ shitty pile of special cases again. RIP.<\/figcaption><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Example: Simple Re-implementation of Vapor Trail and Sitting Toolbar Usage<\/h2>\n\n\n\n<p>At some point during development, Chucklefish had the idea to add a vapor trail when the player was falling fast. I could&#8217;ve sworn I saw a post on their news about it back when the game was in beta, but I can&#8217;t find it now. Anyway, we can add a small snippet to restore it, as an example of further engine work Starbound can benefit from.<\/p>\n\n\n\n<pre title=\"Add under Player::update\" class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">\/\/ Vapor trail\nif (m_movementController-&gt;velocity()[1] &lt; -50) {\n  m_vaporTrailTimer += WorldTimestep;\n  if (m_vaporTrailTimer &gt; 1)\n      m_humanoid-&gt;setVaporTrail(true);\n  }else{\n  m_vaporTrailTimer = 0;\n  m_humanoid-&gt;setVaporTrail(false);\n}<\/code><\/pre>\n\n\n\n<p>By adding this snippet, we can see what it was roughly meant to look like.<\/p>\n\n\n\n<figure class=\"wp-block-video\"><video controls src=\"https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/vaportrail.mp4\"><\/video><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>We can also modify Player restrictions such as <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">bool Player::canUseTool() const {\n  return !isDead() &amp;&amp; !isTeleporting() &amp;&amp; !m_techController-&gt;toolUsageSuppressed() &amp;&amp; m_state != State::Lounge;\n}<\/code><\/pre>\n\n\n\n<p>to just<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"cpp\" class=\"language-cpp\">return !isDead() &amp;&amp; !isTeleporting() &amp;&amp; !m_techController-&gt;toolUsageSuppressed();\n<\/code><\/pre>\n\n\n\n<p>Allowing us to use our inventory while sitting down<\/p>\n\n\n\n<figure class=\"wp-block-video\"><video controls src=\"https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/sitting_tools.mp4\"><\/video><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Further Thoughts<\/h2>\n\n\n\n<p>Future work on the engine can lead to further modding capabilities and engine optimizations. There are many potential client side performance improvements that could be made without touching any network code. This would maintain compatibility with the vanilla client. The netcode could be updated as well, but this would break compatibility once major changes were made. If both (or more) parties are willing to use a modified client, any theoretical modification could be made. The possibilities are endless.<\/p>\n\n\n\n<p>As of 2024, there now exists a few Starbound open source community projects with the aim of enhancing the base game&#8217;s experience. : )<\/p>\n<hr>\r\nIt helps me if you share this post\r\n<br\/>\r\n<br\/>\r\nPublished 2023-05-27 04:55:45 ","protected":false},"excerpt":{"rendered":"<p>Starbound has been one of my favorite games of all time, so I&#8217;m happy to say that I have the latest Starbound source code, last commit August 7th, 2019. I will not be explaining how I got these files. It is the actual source, not just a decompilation, and as such includes build scripts, unused &hellip; <a href=\"https:\/\/rose.dev\/blog\/2023\/05\/27\/starbound-1-4-4-source-code-access\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Starbound 1.4.4 Source Code<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":2752,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"footnotes":""},"categories":[922,832,833],"tags":[920,860,1015,1182,1061,1181,1185,925,1051,1183,856,1184],"class_list":["post-2708","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-release","category-software","category-technology","tag-920","tag-chucklefish","tag-code","tag-comments","tag-developer","tag-gen-2","tag-manypics","tag-release","tag-source","tag-spaceyay","tag-starbound","tag-starsyay"],"jetpack_featured_media_url":"https:\/\/rose.dev\/blog\/wp-content\/uploads\/2023\/05\/edgeofspacenight.png","_links":{"self":[{"href":"https:\/\/rose.dev\/blog\/wp-json\/wp\/v2\/posts\/2708","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rose.dev\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rose.dev\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rose.dev\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rose.dev\/blog\/wp-json\/wp\/v2\/comments?post=2708"}],"version-history":[{"count":45,"href":"https:\/\/rose.dev\/blog\/wp-json\/wp\/v2\/posts\/2708\/revisions"}],"predecessor-version":[{"id":3298,"href":"https:\/\/rose.dev\/blog\/wp-json\/wp\/v2\/posts\/2708\/revisions\/3298"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rose.dev\/blog\/wp-json\/wp\/v2\/media\/2752"}],"wp:attachment":[{"href":"https:\/\/rose.dev\/blog\/wp-json\/wp\/v2\/media?parent=2708"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rose.dev\/blog\/wp-json\/wp\/v2\/categories?post=2708"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rose.dev\/blog\/wp-json\/wp\/v2\/tags?post=2708"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}