Foundation is a grid-less, sprawling medieval city building simulation with a heavy focus on organic development and monument creation.

Learn more and find the game on Steam,, Facebook, Twitter, Youtube.

How to use in-game textures in your mod

This guide will go through the steps necessary to find, and use, in-game textures for your mods

Posted by on (updated ago)

Hello! If you are here, it means you would like to know how to find in-game textures. This can be a bit tricky, so I would suggest you have a moderate-advanced level of understanding of IT related things. Try and follow the guide as closely as you can and everything will be alright.

Note: If you choose to unpack the game files, you are not allowed to publicly release these files under copyright law. If you want to know more about it, please ask one of the bailiffs or dev team on discord (link to discord here). If you want to include the textures in your mod, please go to step 4.

Step 1.1: Downloading GCC

Pegasus is a software created by... Pegasus. Huh. Funny that. It is a program written in the C language that unpacks the game. I will not be going into detail about how C works and all the arguments you can give Pegasus, I will just be doing the bare minimum in showing you how to unpack the game files.

Because Pegasus is created in C, and the majority users playing Foundation run Windows, we need to download GCC. GCC is a compiler for the C language (what a compiler is is complicated, but I recommend you google it yourself). However, you cannot install GCC alone (that I am aware of), you must install it with a bunch of other packages collectively called MinGW. You can download MinGW here.

Once you have downloaded GCC, you must install it. Open the installer, and select "Install". Select a directory you want it located in (I would recommend the default: C:\MinGW as this will come in handy later). Press continue. You must now wait for the required files to be downloaded and installed. Once it is complete, press Continue. A new screen will pop up, with all the packages available. We want to download them all, so right-click the little check box to the left of the name of each package and click "Mark for installation" for each one. The final result should look like this:


Once all have been selected, click Installation -> Apply Changes -> Apply. Once again, wait for the packages to be downloaded and installed (this may take slightly longer than before). Once the changes have been applied successfully click Close. You can now close the MinGW Installation Manager.

Step 1.2: Changing the path

For those of you who are unaware, system path is a variable stored for the operating system that allows you to use applications in the command prompt easily. Don't worry if you don't understand, what is important is following these steps. Depending upon which OS you are using, these steps can change. The instructions I provide will be for Windows 10, but if you are using something else just google "[your OS] edit path variable" and follow the instructions.

For Windows 10: press the start button, and type in "env" and the first option that pops up should be "Edit the system environment variables". Beware: changing the wrong setting here can seriously stuff up your computer, so only do as I instruct.

system variables

Click "Environment Variables" under the "Advanced" tab in the bottom right.

environment variables

A window will open, with 2 large boxes: one in the top and one in the bottom. We want to change the system variable path, so select "Path" in the bottom box (note you may have to scroll down to see it). Then click "Edit", and in the new window select "New".

In the new path variable that you have created, place the directory that you installed MinGW plus "\bin" at the end so for the default installation it will now look like this: C:\MinGW\bin. Hit enter, then OK twice. Close the system properties window. You have now successfully installed GCC and setup the correct path.

add MinGW

Step 2: Installing Pegasus

The code for Pegasus can be found on GitHub here. If you haven't used GitHub before, it is quite simple: click "Clone or Download" (green button) on the right -> Download ZIP. Navigate to your downloads folder and extract the newly downloaded ZIP to wherever you please. I would recommend a safe place like your Desktop or Documents folders. Open up a command prompt and navigate to the location of your new folder. The first command that we will issue is:

gcc -std=c99 utils.c -c

This will create utils.o for us, a required file for the Pegasus application. To make sure it has run successfully, check your folder and you should see "utils.o"

Our next command will compile the C source code into an executable .exe file for windows.

gcc -std=c99 dismantle.c utils.o -o dismantle

Once again, check to see if the proper file has been created: dismantle.exe. We have now completed our installation of Pegasus ready for the unpacking of our game .package file.

Step 3: Unpacking the game

We need to copy the game.package file into our new Pegasus folder. The file that we are looking for contains all the textures and models of vanilla core-game buildings. The default location of this will change from PC to PC, but if you default installed the game it will be located inside your steam folder. Navigate to where you installed Steam -> steamapps -> common -> Foundation. Inside this directory, you will find a file called game.package. Copy this file into your working directory (the one we created in the last step). Open up your command prompt again and type:

dismantle game.package

This process may take a few minutes, so go grab a well-deserved coffee. Once finished you will have a new folder called "game". Inside here is all the contents of game.package unpacked. The textures are located in game/textures/Shared Textures/. I will now show you an example of how to use these textures in a custom model of yours.

Step 4: Using the textures

I personally use Blender to model everything, as it is free and amazing at what it does. If you ever have difficulty with Blender there are plenty of forums online to help you with that, as well as the Discord server. I will simply be using a basic cube as my example, and I will wrap a stone castle wall texture to it. First we want to create a new material and texture for our object, so on the right hand panel create a new Material, and then a new texture. Click "Open" to select a texture that we want, and navigate to game/textures/Shared Textures/ from the last step. The texture that I will be using is MonasteryWallBricksGrey.png. Unwrap your object, and UV map it to your liking (I will not be going into depth of how to do this, that's for another tutorial).

Before we export we need to create the proper hierarchy for the game to be able to read the file. Foundation requires each model to have 2 main empty nodes: Construction_Steps and a node that can be called whatever you want. For this example, I will be calling it "Cube" for simplicity. Set your cube as a child of the empty node "Cube". Export to .fbx format.

Export the .fbx file to a new folder that we shall call "Cube Mod". The location of this folder does not matter. Inside this folder we need to create a folder, "models". We want to export the .fbx file into the models directory the name not mattering. Now that we have our model with its texture, we must code the lua for it to work. I recommend using Notepad++ but you can use Windows' basic 'notepad' for this (but be sure to save in .lua format). We will create 3 new files, and you can copy from the code snippets below:


	"Name": "Cube Mod",
	"Author": "Your name here",
	"Description": "Adds a cube",
	"Version": "1.0.0",

	"AdditionalLanguageList": [
			"Name": "Klingon",
			"Code": "tlh"


local myMod = foundation.createMod()



local myMod = ...

myMod:registerAssetId("models/cube.fbx/Prefab/Cube", "PREFAB_CUBE")

-- register cube
	DataType = "BUILDING",
	Id = "CUBE",
	BuildingType = "DECORATION",
	BuildingPartList = { "CUBE_PART" }

	DataType = "BUILDING_PART",
	Id = "CUBE_PART",
	BuildingZone = { 1, 1 },
	ConstructorData = {
		CoreObjectPrefab = "PREFAB_CUBE"
	Cost = {
		RessourcesNeeded = {
			{ Resource = "WOOD", Quantity = 1 }

These 3 files will just be in the root directory of our new folder "Cubic Mod". Once the lua code has been setup, we can now use our mod in-game! But to do this we need to copy our mod folder into the required location. As in step 3, we need to navigate to the directory of our game's installation. This is usually located in Steam -> steamapps -> common -> Foundation -> mods. We will copy our new mod folder to here, and then boot up the game. Create a new savegame, making sure to select "Cube Mod" from the list of available mods and load in. When you are in-game, select the "Decorations" submenu in the build menu. Our building will be named "#BUILDINGS." because we failed to name our building, but this is not important for the purpose of this tutorial. You should now be able to place down our object, with the texture of core-game buildings!

Thanks for reading my tutorial, if you had any troubles or questions, please message me on Discord: Skkkitzo#3692


Join the community or sign in with your gaming account to join the conversation: