Hacking Terraria: Did You Know?

Rydian

Resident Furvert™
OP
Member
Joined
Feb 4, 2010
Messages
27,880
Trophies
0
Age
36
Location
Cave Entrance, Watching Cyan Write Letters
Website
rydian.net
XP
9,111
Country
United States
So I put this on the Terraria forums, but it seems nobody cares. Figured some people here are more into peeking into games, so here you are.

Note: All my hacking has been OFFLINE, on my single-player worlds.

So I've been using Terraria for hacking practice for a while now, and while messing with it I've discovered all sorts of fun little tidbits of info that I figure people here might like to know... so here's a "did you know?" thread!

Important clarification...
Terraria runs according to the screen's vsync, NOT a proper timer. This means that if the game starts visually lagging it'll start logically lagging as well. For example if invincibility is supposed to be 2/3rds of a second, it'll be longer when you're lagging. This is important to keep in mind when reading the following information, since I mention frames/timings for some things.

This also means that it's easy for a lagging player to get out of sync with the host. This is a common cause of monsters "teleporting" in multi-player wheh they don't in single-player. What's happening is when your game lags, the monsters move slower (and their AI reacts differently because of the different positioning) on your game, so you'll see monsters in a different place than they're supposed to be. When they "teleport", that's the monsters catching up to what's supposed to happen, they're teleporting to where they SHOULD be (since your game lagged and moved them out of sync/place).

  1. It's possible to have over 400 max HP. The hearts don't make another row, they just continue off the screen... The max value doesn't seem to have a technical cap, as it's possible to have over a million max HP.
    i599p2.jpg


  2. Health restore rate depends on your max health. This can be seen somewhat when comparing 100 max health to 400 max health, but it's mostly noticeable when your max HP is really high (where the game can restore 50HP a second to you).

  3. MP, on the other hand, seems to have a hardcoded limit of 400 max. Anything higher only counts as 400... even values obtained legitly-in game (according to the wiki, you could reach 480 max MP if it wasn't capped at 400).

  4. Maximum air is variable! The base value is 200. When in water, you lose one point of breath every 7 frames (without modifiers like the diving helmet, meaning it takes ~25 seconds to lose all 200 points of air). When out of water it regains at a rate of 3 points per frame. Unfortunately there's no items still existing that edit your max air, and the player data does not save or restore this value, so if there were any items or plans to make change your max air, they were scrapped a while ago.
    2eapdlx.jpg


  5. Hate lava? Apparantly the devs do as well! Obsidian Skin is the first buff/debuff ID, which points to it being the first one either designed, or completed. On the other hand, buffs like Fairy are at the end of the list, since they came last.

  6. Non-stackable items in inventory apparantly have IDs. If you directly clone non-stackable items (tools, armor, etc.) in-game and then shift-click one of them, ALL of them will join together into one entry in your trash can, condensing them all back into one. However if you save and then load the game, the cloned items become stable (gaining their own IDs).

  7. Fire and poison damage use the same damage function, so logically one started as a copy-paste of the other (and they do the same amount of damage per second).

  8. The default invincibility time is 40 frames. Assuming a refresh rate of 60 fps (which is what Terraria erroneously needs to run properly), this is 2/3rds of a second.

  9. Rocket boots start with an internal meter value of 7 (not frames!). This is an integer so it can only be reduced by whole numbers at a time. This is why you can only fire off a lone pair of rocket boots up to 7 times before needing to rest. You can fire off the seven spurts individually, or chained into one boost, it doesn't seem that one way is more efficient than the other.

  10. Wings, on the other hand, start with an internal value of 90 frames (one and a half seconds when not lagging), and can be reduced by as little as 1. While it's still an integer, this gives much more freedom in how you want to spend the "charges" during a run/jump. This means that wings are a lot more maneuverable than rocket boots.

  11. Wings don't start subtracting from their charges until the peak of your jump. Even though the animation starts immediately, that's just for show.

  12. One block is about 36x36 game units. Your positioning (x and Y coordinates) are kept as floats, and they're stored to a precision of five decimal places. So the game really keeps careful track of your positioning! Even if you move so little left or right that your sprite doesn't move, the game still keeps track of your movement. Too bad the physics in the game don't take this precision into account...
    35d9en4.jpg


  13. Double jumps are coded in such a way that only one is possible before landing. If the team intended to add items to let you jump more than once before landing, they'd have to edit the existing code to do it.

That's all I've discovered for now.

Thoughts?

EDIT: The first number in the coordinates picture should be 33884, not 33384...
 

Celice

Well-Known Member
Member
Joined
Jan 1, 2008
Messages
1,920
Trophies
1
XP
628
Country
United States
Thanks for the little insights... but I can see why there isn't much interest. The finds don't seem to indicate something bigger than how a few things work. The developmental intuitions about IDs are the most interesting.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    SylverReZ @ SylverReZ: