Starbound

Starbound

54 vurderinger
Starbound Inventory Editing
Af Just Play
This guide looks through the possibilities of player inventory editing in Starbound. It is aimed at modders who would like to expand their knowledge and players who do not have enough free time to get the resources they need for their larger ingame projects. I have looked through the game's player files and share my current knowledge of them. With this guide, you will be able to add, remove and modify the amount of items in your invetory. Structure of player files may change in future as well as my understanding of them and I will try to keep this guide up to date when possible.
   
Pris
Føj til foretrukne
Gjort til foretrukken
Fjern som foretrukken
Introduction
Hello and welcome to my first guide. Right of the bat, if you don't know how to edit binary files or what hexadecimal is, I'm sorry but this guide is probably not for you and I'm just saying to save your time.

I will share my current knowledge of Starbounds player file and how to modify it. I do not have full knowledge of player file, but what I know at the moment will be enough to add and remove items in your inventory or modify their quantity if they are in stack (iron ore for example). What you are about to read is what I *think* about player file.

It is very likely that player file structure may change in future, as well as my understanding of it and I will try to keep this guide updated.

I do not claim I'm correct about anything you are going to read in this guide, I do not posses omnipotent knowledge of the file that is called The Starbound Player File, these are just my thoughts and representation of the data at hand. Use this guide only at your own peril.

Works on:
Beta v Irritated Koala
Beta v Annoyed Koala
Prerequisites
WARNING THERE BE DRAGONS
Editing player file will very likely result in it's corruption (you loose your saves, your house, your gold, whatever progress you made in game and even your dog!), so back up dat file(tm) before you try anything funky.

Player file in Starbound is stored in binary format. What this means for us is that we will need an editor for binary files (ye olde notepad won't cut it this time guys). I use file editor in linux, but there are very good editors for windows users to use (for example Frhed, it's free). Another thing you will need is calculator (or brain) to convert hexadecimal numbers to decimal (windows calc in programmer mode is fine).
Understanding Player File Structure
Before I make you stare at lots of numbers let me tell you some general things about the player file. From what I understand it is divided into multiple sections that keep information about player character, like it's name, what hair type they have, and lots of other things I didn't have time to decypher yet (probably position on map etc..), but most importantly contents of players inventory.

There is also another kind of information not related to the player in game, but very important for us anyway. Some parts of the player file keep information about length (size) of various sections of file (this makes it easier for game to read the file, but makes it harder for us to keep the file valid after we change something). If we edit our file to add an item to our inventory, for example diamond, it will make our file larger by 7 because diamond has 7 letters, and we do not change the parts where size of file is stored, our file will become corrupted and that means bye bye to our diamond dreams. I have not found all the places that need to be changed yet, but there is a way around this issue.

Let' have a look at some basic player file. (not posting the whole thing, only first part we will be dealing with). Hold your hats it's gonna be a long read.

00000000 53 42 50 46 56 31 00 00 01 a2 97 31 01 50 45 db |SBPFV1.....1.PE.| 00000010 89 f9 0f e4 83 4c 4b 96 a2 f9 58 e0 05 06 57 69 |.....LK...X...Wi| 00000020 6c 61 6c 64 05 68 75 6d 61 6e 01 04 68 61 69 72 |lald.human..hair| 00000030 05 66 65 6d 35 30 32 3f 72 65 70 6c 61 63 65 3b |.fem502?replace;| 00000040 64 39 63 31 38 39 3d 34 32 35 38 37 39 3b 61 33 |d9c189=425879;a3| 00000050 38 64 35 39 3d 33 34 33 39 36 35 3b 37 33 35 65 |8d59=343965;735e| 00000060 33 61 3d 32 34 32 32 34 37 72 3f 72 65 70 6c 61 |3a=242247r?repla| 00000070 63 65 3b 66 66 65 32 63 35 3d 63 39 62 31 38 31 |ce;ffe2c5=c9b181| 00000080 3b 66 66 63 31 38 31 3d 61 63 38 33 34 38 3b 64 |;ffc181=ac8348;d| 00000090 33 39 63 36 63 3d 38 37 36 33 33 66 3b 63 37 38 |39c6c=87633f;c78| 000000a0 31 35 62 3d 36 39 34 63 33 31 3f 72 65 70 6c 61 |15b=694c31?repla| 000000b0 63 65 3b 64 63 31 66 30 30 3d 35 33 35 33 35 33 |ce;dc1f00=535353| 000000c0 3b 62 65 31 62 30 30 3d 33 36 33 36 33 36 3b 39 |;be1b00=363636;9| 000000d0 35 31 35 30 30 3d 31 31 31 31 31 31 00 00 00 00 |51500=111111....| 000000e0 00 00 06 69 64 6c 65 2e 33 06 69 64 6c 65 2e 33 |...idle.3.idle.3| 000000f0 bf 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000100 33 75 ed ff 00 40 a0 00 00 47 c3 4f 80 41 c8 00 |3u...@...G.O.A..| 00000110 00 42 c8 00 00 3a da 74 0f 44 7a 00 00 40 00 00 |.B...:.t.Dz..@..| 00000120 00 42 c8 00 00 42 c8 00 00 41 20 00 00 42 c8 00 |.B...B...A ..B..| 00000130 00 3d 2e 14 7b 42 c8 00 00 41 a0 00 00 40 00 00 |.=..{B...A...@..| 00000140 00 41 20 00 00 07 6f 72 67 61 6e 69 63 25 2f 64 |.A ...organic%/d| 00000150 61 6d 61 67 65 2f 64 61 6d 61 67 65 72 65 73 70 |amage/damageresp| 00000160 6f 6e 73 65 2f 64 65 66 61 75 6c 74 2e 63 6f 6e |onse/default.con| 00000170 66 69 67 42 c8 00 00 42 c8 00 00 42 c8 00 00 42 |figB...B...B...B| 00000180 c8 00 00 00 00 00 00 42 c8 00 00 42 1e 1f 70 42 |.......B...B..pB| 00000190 c8 00 00 42 c8 00 00 42 c8 00 00 00 00 00 00 00 |...B...B........| 000001a0 00 00 00 00 00 00 00 00 02 0e 63 6f 6c 64 70 72 |..........coldpr| 000001b0 6f 74 65 63 74 69 6f 6e 0a 70 72 6f 74 65 63 74 |otection.protect| 000001c0 69 6f 6e 00 32 54 68 69 73 20 67 75 79 20 73 65 |ion.2This guy se| 000001d0 65 6d 73 20 74 6f 20 68 61 76 65 20 6e 6f 74 68 |ems to have noth| 000001e0 69 6e 67 20 74 6f 20 73 61 79 20 66 6f 72 20 68 |ing to say for h| 000001f0 69 6d 73 65 6c 66 2e 40 96 31 99 ad 05 00 00 85 |imself.@.1......| 00000200 09 00 00 00 00 00 00 00 00 28 05 74 6f 72 63 68 |.........(.torch| 00000210 02 07 00 05 74 6f 72 63 68 81 02 07 00 05 74 6f |....torch.....to| 00000220 72 63 68 82 00 07 00 05 74 6f 72 63 68 83 00 07 |rch.....torch...| ... (it goes on and on and on) ...

So, how to read this mess. It's Matrix guys I tell you, follow the white rabbit. Let's take a look at first line. It consists of three parts I will describe separately.
00000000 53 42 50 46 56 31 00 00 01 a2 97 31 01 50 45 db |SBPFV1.....1.PE.|
First part is number 00000000, is not very important to us, it represents the position in file where our data displayed on right side starts (you can think of it as a line number, but it is not a line number, well.. ok, let's move along).

Second part is section with 16 hexadecimal numbers, each hex number represents one byte:
53 42 50 46 56 31 00 00 01 a2 97 31 01 50 45 db
They are the content of our player file. Some of these numbers can be translated to normal readable text, and others can't. You can ask why would anyone make a file like this, well it saves memory and makes the file somewhat trickier to modify by hand. Btw hexadecimal number is just like ordinary number but not only we have 0, 1, 2..9 we can also use A=10, B=11, C=12, D=13, E=14 and F = 15. When I write about hexadecimal number I will write for example 1F hex.

And finaly the third part is conversion of middle part to readable text. So it is the same thing as middle just not in numbers.
SBPFV1.....1.PE.
We can see this first line doesn't tell us much but if you scroll back and look through the whole thing I posted (watch the text on right side), you can find some interesting things about my character, for example name Wilald (2nd and 3rd line) and some reference to torches (these are the items in my inventory).
Modifying Quantity of Pixels
Now that we understand how to read the output of our player file, let us look at the file sections we will be editing.
000001c0 69 6f 6e 00 32 54 68 69 73 20 67 75 79 20 73 65 |ion.2This guy se| 000001d0 65 6d 73 20 74 6f 20 68 61 76 65 20 6e 6f 74 68 |ems to have noth| 000001e0 69 6e 67 20 74 6f 20 73 61 79 20 66 6f 72 20 68 |ing to say for h| 000001f0 69 6d 73 65 6c 66 2e 40 96 31 99 ad 05 00 00 85 |imself.@.1......| 00000200 09 00 00 00 00 00 00 00 00 28 05 74 6f 72 63 68 |.........(.torch|
These lines keep a short description of our character. When you are in game, press 'n' and click on your character, this is the message you will see. I do not recommend editing this description as it could corrupt your player file. Reason why I am showing this part of file is that section with information on pixel count and items of our inventory starts at a place where description of our character ends.

To be exact this section starts with number 40 hex. You can always find this place by looking for the first 40 hex number that follows after the player description text.
000001f0 69 6d 73 65 6c 66 2e 40 96 31 99 ad 05 00 00 85 |imself.@.1......| 00000200 09 00 00 00 00 00 00 00 00 28 05 74 6f 72 63 68 |.........(.torch|
After 40 hex, there are nine hexadecimal numbers 96 31 99 ad 05 00 00 85 09 (in my case, yours will be different) editing them will corrupt your player file. I have yet to find their meaning, what I know is that game changes them as you play even when you are not moving or doing anything at all. Now comes the interesting part with next 8 hexadecimal numbers 00 00 00 00 00 00 00 00. The first 4 doesnt seem to do anything, last 4 represent the amount of pixels you have. Let's say you want to set the amount of your pixels to 1000. Use calculator to convert desired amount of pixels to hexadecimal number, in this case 1000 dec = 3e8 hex and edit your file.

This is how inventory with 1000 pixels will look like.
00000200 09 00 00 00 00 00 00 03 e8 28 05 74 6f 72 63 68 |.........(.torch|
As you can see I edited the line starting from right side near the 28 hex number, this number represents the beginning of section that contains items we have in our inventory but more on that in next chapter of this guide.
Modifying Quantity of Items in Inventory
Let us have a look at a part of player file representing items we have.
00000200 09 00 00 00 00 00 00 00 00 28 05 74 6f 72 63 68 |.........(.torch| 00000210 02 07 00 05 74 6f 72 63 68 81 02 07 00 05 74 6f |....torch.....to| 00000220 72 63 68 82 00 07 00 05 74 6f 72 63 68 83 00 07 |rch.....torch...|
First line and number 28 hex, this is where our inventory starts (28 hex = 40 dec, there are 40 spaces on one page of inventory).

What follows is information about our items. I will take the numbers from first line and combine them with numbers from second line to represent one item entry, this is first item in our inventory.
05 74 6f 72 63 68 02 07 00
05 hex = 5 dec, this number represents number of letters in name of our item (torch). Following sequence of numbers 74 6f 72 63 68 means torch. 74 hex = t, 6f hex = o, etc... Google 'ASCII table' and you can see for yourself. Now comes the amount of torches we have 02 hex = 2 dec, we subtract that by 1, that means we have one torch on that space in our inventory. Last two numbers are 07 00, this pattern repeats itself in player file many times, I think it is used as a separator of entries in file.

Okay, this was our first torch let's have a look at next one. We begin where we left off after the separator 07 00 in second line.
05 74 6f 72 63 68 81 02 07 00
Again, 05 = 5 letters, then torch written in ascii and now... wait a minute, there are actually two numbers 81 02 before the separator 07 00, not one like in previous example . Why is that?

As you know in Starbound you can have up to 1000 items in one inventory slot. But, if you use one two digit hexadecimal number, the maximum you can have is FF hex = 255 dec, so how do we fit 1000 into 255. Well, we can't and thats why we have to use two hex numbers instead. First number 81 hex is a code to tell the game to add 127 dec to following number 02 hex, 02 hex = 2 dec, so we add 127+2, in this case we do not subtract 1 like in previous example, and result is I have 129 torches in this slot in my inventory. Following number 07 00 is the separator.

There are more codes that are used this way, 81 hex is add 127, 82 hex is add 255, there is also 83 hex, 84 hex i believe.
Adding New Item to Inventory
In previous parts of this guide I talked about sections of file that keep track of its length. So far we changed only the amount of items in one slot of our inventory. Change number of item in slot from 11 to 12, still the length of file is same (not only length of file is a problem, there may be other mechanisms in place that check validity of file, but i only had problems when changing item names or adding new items). Now situation is different. When we add an item to inventory, we increase the length of file (item has a name that has certain length).

One solution to this problem is, rename item by keeping the length of new item name same, for example rename item "ironore" to "coalore". This should be valid because length of our file now stays same.

Of course there are multiple ways to go on about this, delete two items with length of five letters and add new item with length of ten letters etc...

However there is another way you can make the game do your bidding. If you have an item in inventory called "torch" and you change the name of this item to "tarch" (tarch is not valid game item, but has the same amount of letters so file does not get corrupted) the game will replace this invalid item with "generic" item. What we can do now is split ten torches to two stacks in our inventory (in game, not by editing). That makes our inventory section of player file have size of 10. Now we open our editor and change one torch to "coalore", thats 7 letters, that means we have to shorten our second torch entry to 3 letters to compensate and not get our player file corrupted. We can change that second "torch" to "xyz" it does not matter what name we choose as long as we keep the length of file same that it was before editing. Well then "coalore" + "xyz" is same length as two "torch". Let's try this example in next section, with some screenshots.
Giff Coal - Example
Ok, now it's time for some real life example. We will be modifying torches to coal. Wow you can't do this in real life, not even in a game, it just doesn't work like this now does it? Well with the power of hex editing indeed it does. Always exit your game (close completely) before editing your player file, if you keep game running your file won't get updated.

Step 1
As you can see I split my stack of torches to make the game set inventory section of player file to 10 characters (2x torch).

Step 2
I opened my player file to show you how my section of inventory looks in editor.

Step 3
Then I changed the size of first item to 7 and its name to "coalore". Second item has to have size of 3 to keep the size of 10 as the inventory section had before editing. It's name isnt important it just has to have 3 letters.

Step 4
I profit from my spoils of hexediting. As you can see the game edited the second item called "xyz" to generic item, because "xyz" is not a valid item name. You can throw this green item away at this point it doesn't matter.

Of course you can do this with diamondore or other items if you know their name. Just keep the overall length of item names same as it was before editing and don't forget to write the item name length into player file and you should be fine.
Do's and Don'ts
Keep in mind that when adding or removing items from your inventory, the length of player file changes. There are places in player file where this length is stored, if you make any modifications by adding or removing items, and you do not change all the relevant places storing information of file length, your player file will become corrupted.

Do
  • change amount of pixels
  • change amount of items in a single stack
  • change name of an item to item that has same name length ('coalore' changed to 'ironore', keeping the same name length of 7 letters)
  • change name of an item to item with different name length only if you make sure to create a dummy items to compensate for different name lengths ('coalore' changed to 'torch', and adding dummy item 'xy' of name length 7 - 5 = 2 letters)

Don't
  • do not change any parts of player file not descibed in this guide (it will most likely result in corrupted player file)
  • do not add, remove or change names of items without making sure that sum of all item name lengths before editing will be equal to the sum of all item name lengths after editing
Conclusion
To be honest this guide got a lot longer then I expected, but there is a lot of ground to cover. After reading this guide you should be able to change your player file and modify contents of your inventory without destroying your saves and blaming me in the proces. I hope at least someone will find this guide helpful. Also let me know about your successes or mishaps when editing player file. Good luck and happy hexediting!
40 kommentarer
xchg 25. sep. 2021 kl. 9:37 
Sick
Just Play  [ophavsmand] 8. feb. 2021 kl. 11:42 
ty for comments guys, please note this guide is 7 years old :D
J'ee 6. feb. 2021 kl. 2:21 
LOL the previous posters. This is still a good post, yes.
𝐇𝐮𝐠𝐨𝐨 7. jan. 2021 kl. 22:25 
good post
Pink Cloak Pilot - TF|2 8. okt. 2016 kl. 21:13 
theres a much simpler way to do this
/admin
/spawnitem money 10000000
/admin
This is for pixels, for more items check...
starbounder.org
or
https://starbounditems.herokuapp.com/
Just Play  [ophavsmand] 18. sep. 2016 kl. 5:00 
ty for comments, please note this guide is 4 years old ;)
The Daily Herp 23. aug. 2016 kl. 11:30 
/admin
look up starbound herokuapp first link probably
look up what you want
/spawnitem itemid itemcount
/admin
LiamVogl 1. aug. 2016 kl. 12:22 
nope im outta here
:ccknight:
SucrilhosKallog's 15. maj 2016 kl. 11:24 
:steamsad:
SucrilhosKallog's 15. maj 2016 kl. 11:24 
COMO FEZ ISSO?