# Modding Stonehearth's Graphics Test Program

**URL:** <https://discourse.stonehearth.net/t/modding-stonehearths-graphics-test-program/3540>\
**Category:** Modding\
**Created:** [November 16, 2013, 9:54am UTC](https://discourse.stonehearth.net/t/modding-stonehearths-graphics-test-program/3540 "2013-11-16T09:54:54Z")\
**Posts on this page:** 20\
**Page:** 6

<div class="post-metadata">

**Author:** ![Miturion](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/miturion/32/43498_2.png) [@Miturion](https://discourse.stonehearth.net/u/Miturion)\
**Post date:** [November 20, 2013, 7:29am UTC](https://discourse.stonehearth.net/t/modding-stonehearths-graphics-test-program/3540/101 "2013-11-20T07:29:48Z")

</div>

Awesome, you need some serious scaffolding to build those big towers too. 😃

@Xavion Nice papa rabbit.

---

<div class="post-metadata">

**Author:** ![Xavion](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/xavion/32/43501_2.png) [@Xavion](https://discourse.stonehearth.net/u/Xavion)\
**Post date:** [November 20, 2013, 8:04am UTC](https://discourse.stonehearth.net/t/modding-stonehearths-graphics-test-program/3540/102 "2013-11-20T08:04:50Z")

</div>

Oh I know that much, what I want to figure out is how it determines which colours to use where. All these references to \_radiant.csg are throwing me off though as I can’t find the source, I’m starting to suspect that it’s engine api stuff without api in lua but I’ve still got a few things to try first.

Actually to anyone who wants to try it here is a modified start\_game.luac, to add new entities make a folder for them in the entities folder somewhere and add them to manifest.json. Contains an extra function to allow modifying the terrain as well, for reference the grass and the dirt are two separate cubes which are in fact just rectangular prisms with coordinates for the corners given.

> **[start\_game.luac](https://www.dropbox.com/s/hipnbi7i4ea9s79/start_game.luac)**
>
> Shared with Dropbox

EDIT:  
It was pointed out to me the the file as is will crash the graphics test, this is because it references the big\_rabbit entity which you won’t have. Just deleting or commenting out those lines should fix it.

---

<div class="post-metadata">

**Author:** ![Alesfatalis](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/alesfatalis/32/3023_2.png) [@Alesfatalis](https://discourse.stonehearth.net/u/Alesfatalis)\
**Post date:** [November 20, 2013, 9:31am UTC](https://discourse.stonehearth.net/t/modding-stonehearths-graphics-test-program/3540/103 "2013-11-20T09:31:56Z")

</div>

@LunarWolf @Xavion That was the last thing i thought about haha. Now when im back home im going to mod the game. Maybe i will have a look into controlling the workers seems like most of the function are inside but they get never called. I wish everyone Happy Modding 😉

---

<div class="post-metadata">

**Author:** ![Skull24](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/skull24/32/50675_2.png) [@Skull24](https://discourse.stonehearth.net/u/Skull24)\
**Post date:** [November 20, 2013, 9:48am UTC](https://discourse.stonehearth.net/t/modding-stonehearths-graphics-test-program/3540/104 "2013-11-20T09:48:37Z")

</div>

Dang, you leave for a few hours and people are place entire towns into the damn thing. I wish I could do what you did. But I don’t have the full version of Qubicle Constructor. I’m still holding out for the special version that will be made for SH.

Can someone write up a quick How To on how they are able to put other assists in to the Test? I’m not sure I understand. How did you change the .lua files and then compile them?

---

<div class="post-metadata">

**Author:** ![Xavion](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/xavion/32/43501_2.png) [@Xavion](https://discourse.stonehearth.net/u/Xavion)\
**Post date:** [November 20, 2013, 10:08am UTC](https://discourse.stonehearth.net/t/modding-stonehearths-graphics-test-program/3540/105 "2013-11-20T10:08:38Z")

</div>

To replace the models just replace the .qb files. To add entities make a new folder and follow the format of the current ones along with adding it to manifest.json. To change the lua files you can use the zip I posted a bit back **however** not all of the lua files turned out valid so just copy the ones you need over to replace the corresponding files.

---

<div class="post-metadata">

**Author:** ![Alesfatalis](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/alesfatalis/32/3023_2.png) [@Alesfatalis](https://discourse.stonehearth.net/u/Alesfatalis)\
**Post date:** [November 20, 2013, 12:20pm UTC](https://discourse.stonehearth.net/t/modding-stonehearths-graphics-test-program/3540/106 "2013-11-20T12:20:21Z")

</div>

Here you go made the terrain bigger 🙂 :

 ![](https://us1.discourse-cdn.com/flex022/uploads/stonehearth/original/3X/f/d/fdd32c0a40f5a85c5c8de045f860a2788c15ab1d.png)

And here with more trees and an increased rabbit population:

 ![](https://us1.discourse-cdn.com/flex022/uploads/stonehearth/original/3X/5/3/537e0424badf551e480818bf1a54f10396a18501.png)

---

<div class="post-metadata">

**Author:** ![Skull24](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/skull24/32/50675_2.png) [@Skull24](https://discourse.stonehearth.net/u/Skull24)\
**Post date:** [November 20, 2013, 1:52pm UTC](https://discourse.stonehearth.net/t/modding-stonehearths-graphics-test-program/3540/107 "2013-11-20T13:52:24Z")

</div>

Thank you for the help. It’s good to know how to do it on this level.

---

<div class="post-metadata">

**Author:** ![SteveAdamo](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/steveadamo/32/13955_2.png) [@SteveAdamo](https://discourse.stonehearth.net/u/SteveAdamo)\
**Post date:** [November 20, 2013, 1:58pm UTC](https://discourse.stonehearth.net/t/modding-stonehearths-graphics-test-program/3540/108 "2013-11-20T13:58:59Z")

</div>

> [@Alesfatalis](#):
>
> Here you go made the terrain bigger

excellent work! 👍

> [@Alesfatalis](#):
>
> and an increased rabbit population

i think they’re capable of doing that themselves… 😊

---

<div class="post-metadata">

**Author:** ![Alesfatalis](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/alesfatalis/32/3023_2.png) [@Alesfatalis](https://discourse.stonehearth.net/u/Alesfatalis)\
**Post date:** [November 20, 2013, 3:06pm UTC](https://discourse.stonehearth.net/t/modding-stonehearths-graphics-test-program/3540/109 "2013-11-20T15:06:29Z")

</div>

@SteveAdamo Thanks 😉

I have also build a house made of `DIRT_ROAD`:

 ![](https://us1.discourse-cdn.com/flex022/uploads/stonehearth/original/3X/1/0/107b7e606f37217c4ab3ebbf677334ed37f8ab08.png)

For everyone who is interested here the lua code for the house:

```
      --House first stage
  r3:add_cube(Cube3(Point3(90, 1, 90), Point3(91, 2, 100), Terrain.DIRT_ROAD))
  r3:add_cube(Cube3(Point3(90, 1, 90), Point3(100, 2, 91), Terrain.DIRT_ROAD))
  r3:add_cube(Cube3(Point3(99, 1, 91), Point3(100, 2, 100), Terrain.DIRT_ROAD))
  --Door
  r3:add_cube(Cube3(Point3(90, 1, 100), Point3(93, 2, 101), Terrain.DIRT_ROAD))
  r3:add_cube(Cube3(Point3(97, 1, 100), Point3(100, 2, 101), Terrain.DIRT_ROAD))
  --House second stage
  r3:add_cube(Cube3(Point3(90, 2, 90), Point3(91, 3, 100), Terrain.DIRT_ROAD))
  r3:add_cube(Cube3(Point3(90, 2, 90), Point3(100, 3, 91), Terrain.DIRT_ROAD))
  r3:add_cube(Cube3(Point3(99, 2, 91), Point3(100, 3, 100), Terrain.DIRT_ROAD))
  --Door
  r3:add_cube(Cube3(Point3(90, 2, 100), Point3(93, 3, 101), Terrain.DIRT_ROAD))
  r3:add_cube(Cube3(Point3(97, 2, 100), Point3(100, 3, 101), Terrain.DIRT_ROAD))
  --House third stage
  r3:add_cube(Cube3(Point3(90, 3, 90), Point3(91, 4, 100), Terrain.DIRT_ROAD))
  r3:add_cube(Cube3(Point3(90, 3, 90), Point3(100, 4, 91), Terrain.DIRT_ROAD))
  --Window
  r3:add_cube(Cube3(Point3(99, 3, 91), Point3(100, 4, 96), Terrain.DIRT_ROAD))
  r3:add_cube(Cube3(Point3(99, 3, 99), Point3(100, 4, 100), Terrain.DIRT_ROAD))
  --Door
  r3:add_cube(Cube3(Point3(90, 3, 100), Point3(93, 4, 101), Terrain.DIRT_ROAD))
  r3:add_cube(Cube3(Point3(97, 3, 100), Point3(100, 4, 101), Terrain.DIRT_ROAD))
  --House fourth stage
  r3:add_cube(Cube3(Point3(90, 4, 90), Point3(91, 5, 100), Terrain.DIRT_ROAD))
  r3:add_cube(Cube3(Point3(90, 4, 90), Point3(100, 5, 91), Terrain.DIRT_ROAD))
  --Window
  r3:add_cube(Cube3(Point3(99, 4, 91), Point3(100, 5, 96), Terrain.DIRT_ROAD))
  r3:add_cube(Cube3(Point3(99, 4, 99), Point3(100, 5, 100), Terrain.DIRT_ROAD))
  --Door
  r3:add_cube(Cube3(Point3(90, 4, 100), Point3(93, 5, 101), Terrain.DIRT_ROAD))
  r3:add_cube(Cube3(Point3(97, 4, 100), Point3(100, 5, 101), Terrain.DIRT_ROAD))
  --House fifth stage
  r3:add_cube(Cube3(Point3(90, 5, 90), Point3(91, 6, 100), Terrain.DIRT_ROAD))
  r3:add_cube(Cube3(Point3(90, 5, 90), Point3(100, 6, 91), Terrain.DIRT_ROAD))
  r3:add_cube(Cube3(Point3(99, 5, 91), Point3(100, 6, 100), Terrain.DIRT_ROAD))
  r3:add_cube(Cube3(Point3(90, 5, 100), Point3(100, 6, 101), Terrain.DIRT_ROAD))
  --House sixth stage 
  r3:add_cube(Cube3(Point3(90, 6, 90), Point3(91, 7, 100), Terrain.DIRT_ROAD))
  r3:add_cube(Cube3(Point3(90, 6, 90), Point3(100, 7, 91), Terrain.DIRT_ROAD))
  r3:add_cube(Cube3(Point3(99, 6, 91), Point3(100, 7, 100), Terrain.DIRT_ROAD))
  r3:add_cube(Cube3(Point3(90, 6, 100), Point3(100, 7, 101), Terrain.DIRT_ROAD))
  --House seven stage
  r3:add_cube(Cube3(Point3(90, 7, 90), Point3(91, 8, 100), Terrain.DIRT_ROAD))
  r3:add_cube(Cube3(Point3(90, 7, 90), Point3(100, 8, 91), Terrain.DIRT_ROAD))
  r3:add_cube(Cube3(Point3(99, 7, 91), Point3(100, 8, 100), Terrain.DIRT_ROAD))
  r3:add_cube(Cube3(Point3(90, 7, 100), Point3(100, 8, 101), Terrain.DIRT_ROAD))
  --Roof
  r3:add_cube(Cube3(Point3(90, 8, 90), Point3(100, 9, 101), Terrain.DIRT_ROAD))

```

The worker is on top of the “house” because it’s made of terrain cubes. All assets haven’t got `y-coodrinates` so that is why they are always on top of the terrain. 😛 But when you place a house as a asset instead of terrain cubes the worker will be inside. Nice work @radiant

---

<div class="post-metadata">

**Author:** ![voxel\_pirate](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/voxel_pirate/32/2309_2.png) [@voxel\_pirate](https://discourse.stonehearth.net/u/voxel_pirate)\
**Post date:** [November 20, 2013, 3:22pm UTC](https://discourse.stonehearth.net/t/modding-stonehearths-graphics-test-program/3540/110 "2013-11-20T15:22:39Z")

</div>

… if there are no y-coordiantes, how could you “force” a worker to enter a cave or mine some ore underground?

---

<div class="post-metadata">

**Author:** ![Alesfatalis](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/alesfatalis/32/3023_2.png) [@Alesfatalis](https://discourse.stonehearth.net/u/Alesfatalis)\
**Post date:** [November 20, 2013, 5:20pm UTC](https://discourse.stonehearth.net/t/modding-stonehearths-graphics-test-program/3540/111 "2013-11-20T17:20:33Z")

</div>

@voxel_pirate haven’t found them. I think they must somewhere, but i don’t know where mabye someone else has more luck finding them 🙂

---

<div class="post-metadata">

**Author:** ![voxel\_pirate](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/voxel_pirate/32/2309_2.png) [@voxel\_pirate](https://discourse.stonehearth.net/u/voxel_pirate)\
**Post date:** [November 20, 2013, 5:26pm UTC](https://discourse.stonehearth.net/t/modding-stonehearths-graphics-test-program/3540/112 "2013-11-20T17:26:57Z")

</div>

@Alesfatalis I am not claiming that they are there. It was more a question to you guys if you find something or if you have an idea 😉. The “house” you’ve created could be a way how you can include “caves” in the game. Just put a bit more “mountain” around it and there we go. But what does it help you to have a nice looking cave if your settlers are always placed on top of it 😞.

What I could imagine is that once you enter a cave, the “roof” is cut-off. By doing so, the “soil” on top would be removed and your worker would be placed on the ground (as there is no soil above).

---

<div class="post-metadata">

**Author:** ![Alesfatalis](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/alesfatalis/32/3023_2.png) [@Alesfatalis](https://discourse.stonehearth.net/u/Alesfatalis)\
**Post date:** [November 20, 2013, 6:35pm UTC](https://discourse.stonehearth.net/t/modding-stonehearths-graphics-test-program/3540/113 "2013-11-20T18:35:51Z")

</div>

@voxel_pirate I have seen some walk and following path functions where the .luac files from the idle functions are. These walk functions use x,y,z coordinates maybe the settlers can’t start in a cave but it should be possible to let them walk in. I have until now only modified the start\_game.luac which initialize each asset and terrain elements and there the assets haven’t got any y-coordinates. So let us hope radiant is going to add that to the game if they haven’t done this already 😉

---

<div class="post-metadata">

**Author:** ![Ramcat](https://avatars.discourse-cdn.com/v4/letter/r/65b543/32.png) [@Ramcat](https://discourse.stonehearth.net/u/Ramcat)\
**Post date:** [November 20, 2013, 8:04pm UTC](https://discourse.stonehearth.net/t/modding-stonehearths-graphics-test-program/3540/114 "2013-11-20T20:04:45Z")

</div>

> [@Alesfatalis](#):
>
> @SteveAdamo Can i publish the content of all .luac files? So everyone can see how stonehearth is working?

You can now. And I’m sure that would help some budding modders out there (even me). Since you’ve already done it and we can share that why not save everyone else all that work? Thanks.

[quote=“voxel\_pirate, post:46, topic:3540”]  
So this is the first custom animation I was able to execute.[/quote]

So did you add that to the “idle effects”? Do you want to show us how you did that?

@Xavion You dropbox link is dead for the decompiled Lua.

---

<div class="post-metadata">

**Author:** ![Alesfatalis](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/alesfatalis/32/3023_2.png) [@Alesfatalis](https://discourse.stonehearth.net/u/Alesfatalis)\
**Post date:** [November 20, 2013, 8:25pm UTC](https://discourse.stonehearth.net/t/modding-stonehearths-graphics-test-program/3540/116 "2013-11-20T20:25:09Z")

</div>

@Ramcat Here you go:

Here is the .ZIP file from @Xavion : [Download stonehearth.zip](https://portal.bitcasa.com/send/b0837a6ae5f599b7e65382c65da9222f2ada9402dc109317441f1dafbf24e77a/d9c689719158c86caefc85ba069e613929fbcc03d5399d1c8f04fb504c313931)

---

<div class="post-metadata">

**Author:** ![Alesfatalis](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/alesfatalis/32/3023_2.png) [@Alesfatalis](https://discourse.stonehearth.net/u/Alesfatalis)\
**Post date:** [November 20, 2013, 9:23pm UTC](https://discourse.stonehearth.net/t/modding-stonehearths-graphics-test-program/3540/117 "2013-11-20T21:23:13Z")

</div>

For everyone who is interested. Here a small tutorial how to decompile most of the `.luac` files:

**1.** Get [luadec 5.1](http://files.luaforge.net/releases/luadec51/luadec51-win32-bin/LuaDec5.1binaryforwin32/luadec51_2.0_win32_bin.zip)

**2.** Extract it to a folder.

**3.** Extract from the `.smod` the `.luac` you want to decompile.

**4.** Open up your cmd and browse to the folder where you extracted `luadec 5.1`

**5.** To decompile enter something like this into your cmd:  
 ![](https://us1.discourse-cdn.com/flex022/uploads/stonehearth/original/3X/0/7/076215a643bcfd1698c8e39380208eb6ee34ae95.png)

**6.** After hitting enter the console outputs the decompiled content (marked red in my image):  
 ![](https://us1.discourse-cdn.com/flex022/uploads/stonehearth/original/3X/4/7/470993aa3051abe2b9f4c77f591e22d49e421842.png)

**7.** Just copy the output to your favorite texteditor (mine is notped++) and save it as `orginal_filename.luac`

**8.** Exchange your created `.luac` with the original in the `stonehearth.smod`

Hope this helps someone. When i have forgotten something just reply to this post 😉

**Happy Modding everyone!** 😁

---

<div class="post-metadata">

**Author:** ![SteveAdamo](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/steveadamo/32/13955_2.png) [@SteveAdamo](https://discourse.stonehearth.net/u/SteveAdamo)\
**Post date:** [November 20, 2013, 10:17pm UTC](https://discourse.stonehearth.net/t/modding-stonehearths-graphics-test-program/3540/118 "2013-11-20T22:17:21Z")

</div>

@Alesfatalis… I’m strongly considering changing your title to “Opener of Pandora’s Box”…

well done! 👍

---

<div class="post-metadata">

**Author:** ![voxel\_pirate](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/voxel_pirate/32/2309_2.png) [@voxel\_pirate](https://discourse.stonehearth.net/u/voxel_pirate)\
**Post date:** [November 20, 2013, 10:18pm UTC](https://discourse.stonehearth.net/t/modding-stonehearths-graphics-test-program/3540/119 "2013-11-20T22:18:38Z")

</div>

> [@Ramcat](#):
>
> So did you add that to the “idle effects”? Do you want to show us how you did that?

Actually I simply replaced the idle\_breathe-animation with a custom one and did not try your approach to add it yet.

For sure I will share how to do it. However, to follow the description you will need the Add-On I am working on for Blender - or a similar one for another tool. If you do not have it you would need to read all the information from your animation (rotation, location, etc.) and write it manually into a file. So as long as the Add-On is not in a better shape it might not make sense to go too much into details… [the progress can be followed here](http://discourse.stonehearth.net/t/blender-add-on-development-wall-of-text-inside/3561).

---

<div class="post-metadata">

**Author:** ![Alesfatalis](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/alesfatalis/32/3023_2.png) [@Alesfatalis](https://discourse.stonehearth.net/u/Alesfatalis)\
**Post date:** [November 20, 2013, 10:24pm UTC](https://discourse.stonehearth.net/t/modding-stonehearths-graphics-test-program/3540/120 "2013-11-20T22:24:43Z")

</div>

@SteveAdamo Thanks for your kind words!

> [@SteveAdamo](#):
>
> I’m strongly considering changing your title to “Opener of Pandora’s Box”…

That would be an awesome title 😁

---

<div class="post-metadata">

**Author:** ![Xavion](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.stonehearth.net/xavion/32/43501_2.png) [@Xavion](https://discourse.stonehearth.net/u/Xavion)\
**Post date:** [November 20, 2013, 10:40pm UTC](https://discourse.stonehearth.net/t/modding-stonehearths-graphics-test-program/3540/121 "2013-11-20T22:40:02Z")

</div>

First off I had a hunch that I confirmed, you can have the files with a .lua extension and it will still run stonehearth fine.

@Alesfatalis, There actually is a Y coordinate for them you just don’t use it for the place\_item function. Here’s the relevant function.

```
MicroWorld.place_item = function(l_6_0, l_6_1, l_6_2, l_6_3, l_6_4)
  local entity = radiant.entities.create_entity(l_6_1)
  if l_6_4 then
    entity:add_component("unit_info"):set_faction(l_6_4)
  end
  radiant.terrain.place_entity(entity, Point3(l_6_2, 1, l_6_3))
  return entity
end

```

As you can see it as far as I can tell just sets all their Y value’s to 1 which seems to imply it’s a vertical displacement from the ground then aligned with the sames coordinates used for the terrain.

Also the batch code I used for decompiling folders of luac. It assumes that you have luadec on your desktop and than it will use it to change all .luac files in the folder it is in and all subfolders and so on into decompiled .lua files while deleting the .luac files. Essentially just put it in the stonehearth folder and run it to convert .luac to .lua, note however that on the files it completely fails on a error box will pop up, just hit cancel and it will keep going.

```
FOR /R %%f IN (*.luac) DO (
	C:\Users\Xavion\Desktop\luadec %%f > %%f_lua
	del "%%f"
	rename "%%f_lua" *.lua
)

```

* * *

EDIT TO AVOID DOUBLE POST; Arrgh opinions over this.

From another thread.

> [@Different Breeds Of Animals](https://discourse.stonehearth.net/t/different-breeds-of-animals/3581/9):
>
> I wonder if some very brave and intrepid person might even be able to figure out how to use that concept to add different breeds of rabbits to the Stonehearth graphics test.

Done. I also played around with it a bit and discovered it’s not a template system like I first suspected, or it is just in the reverse of the normal order. So my current view is that it loads the json file for the entity or whatever and then it loads the file it extends from on top of that overwriting anything different with it’s version. That means that base\_human would take precedent over human which seems kind of dodgy and also makes the use of “extends” for the syntax kind of weird as it’s kind of the other way around.

[Previous page](https://discourse.stonehearth.net/t/modding-stonehearths-graphics-test-program/3540.md?page=5)

[Next page](https://discourse.stonehearth.net/t/modding-stonehearths-graphics-test-program/3540.md?page=7)
