[Cross-Platform] Prism modding API for 1.3

Discussion in 'Released' started by PoroCYon, Aug 30, 2015.

  1. PoroCYon

    PoroCYon Terrarian


    NOTICE: Prism is not under active development anymore. It can, however, be continued by anyone who feels like it, and the code can be used in any of your projects, too (see "License").

    It gained some activity, but everyone's still allowed to use the code in other projects.

    • This is an unofficial tool, it is not licensed to Re-Logic, Re-Logic is not at fault for any damage caused by using this program.
    • There is (are) already a (multiple) tool(s) used to create mods for 1.3, but Prism is in no way related to it (them).


    Prism is a cross-platform, open-source modding API for Terraria >=1.3. It allows the creation and management of multiple mods at once. It can be seen as the successor to tAPI and tConfig.

    Prism, unlike tAPI and tConfig, uses code injection to achieve this, instead of using the decompiled source code. Because of this, no Re-Logic code is included in the code repository, and can be (and is) made open-source. Everyone can contribute if they spot a bug or want to add a feature. The link to the GitHub repository is put under the 'Download' section.

    Another effect of the usage of code injection is that it is easier to update to a newer version of Terraria. The code does not have to be decompiled and the changes do not have to be added by hand over and over again. It does break when certain code is rewritten, but it is fast and relatively easy to trace.
    Any Terraria.exe file can be 'fed' to the patcher (required for GOG/Steam and platform differences, see the installation instructions), but it will break when given a Terraria <1.3 executable (including mods). It might (but is not guaranteed to) work with certain tools that use and/or create their own Terraria.exe file, but the Prism patcher executable must be used as the final step because it outputs a Prism.Terraria.dll file, which is loaded by Prism.exe.

    It runs on Windows, Linux and OS X, is compatible with Steam, GOG and the Game Launcher. The mono runtime must be installed to use Prism on Linux and OS X.
    NOTE: it is x64-only on Linux platforms (unless you want to build it yourself after messing with the build settings).

    The current team consists of these people (and a few others who wish to remain unknown by setting their visibility to 'Private' in that list).

    Prism uses a separate folder for player and world saves, "My Games\Terraria\Prism\..." (or its equivalent on Linux/OS X). Separate .prism files are created for mod data, so one can copy the .plr and .wld files to/from the Prism folders.

    If you want to submit a bug of feature request, please use the GitHub issue tracker rather than replying to the thread, so we can keep track of it more easily. Some/most members of the team are usually present on the PrismAPI IRC channel (irc.esper.net:6667#PrismAPI). For general Terraria modding help, go to the tAPI channel (irc.esper.net:6667#tapi).

    Prism may seem harder to use than other modding tools, but it can reward good programmers (à la C++ or Haskell).​

    A (non-exhausive, incomplete) list of features:
    • Custom items, monsters, NPCs, projectiles and mounts, as well as custom behaviours
    • Player, world, game, ... hooks, to manage the state of the game, or to execute code at a specific point
    • Custom sound effects and background music
    • Tiles and walls are not supported yet. Tiles are notoriously hard to mess with (without letting the game crash), and there is not much space left for extra wall IDs, due to technical limitations (the ID is a `byte`, and about 210 walls exist already).
    • Multiplayer is not supported yet. The usage of multiplayer is not prevented, but it is almost guaranteed to break.
    • Prism is in the prerelease stage. A to-do list of features is available here.

    There is currently no documentation available because we are/have been busy creating Prism itself, but some kind of example mod exists, but it is mainly used to test Prism.

    There is some documentation available, but it's not a step-by-step tutorial for total noobs.

    If you want to build Prism yourself, see the README.md file on the repo. It also contains a small section on how to create a mod.​


    See the GitHub release page. Installation instructions are provided there and should be read, especially for Linux and OS X users. Note that the LICENSE file is not up-to-date anymore, see the "License" title on this thread instead.

    The source code can be viewed, cloned and forked on the GitHub repository.
    Note that there are two major branches, "master" and "develop". "master" contains the code of the current release, "develop" is the most recent, in-developement (and probably unstable) code. It might be a better idea to use the "develop" branch instead of "master" when the latter is a bit out-of-date.

    The code for Terraria v1.3.0.* can be found on the "v1-3-0" branch​


    See LICENSE on the GitHub repository (WTFPL 2.0, with no-warranty clause)

    This license agreement is a legal agreement between you and the Prism team.
    By installing Prism, you agree to be bound by this agreement. If you do not agree to the terms of this Agreement, you may not install or use Prism.

    Furthermore, you may not violate the rules presented in the Player-Created Game Enhancements: Rules & Guidelines thread, if you are using it for Terraria modding purposes (instead of e.g. using it in your own, unrelated project(s)).

    Note that Prism is provided 'as is', it is never, in any event, the fault of the Prism team nor any of its members if damage in any kind occurs by the use of Prism or its consequences (e.g. using a mod).​

    • Everyone at Re-Logic for creating Terraria
    • All contributors and several others for assisting in the Prism developement process, be it either code or help with porting it to Linux and/or OS X.
    • Surfpup and the tAPI team for creating the programs that lead to Prism.
    • Bullseye55 for a lot of testing.
    Last edited: Jun 6, 2016
  2. MiraiMai

    MiraiMai Terrarian

    Hah, I'm set to private? Will have to fix that.

    But ya, feel free to play with it, and test things out. Ask away, but honestly, the API is 100% C#. If you don't know how to program, don't bother, go learn before starting. 90% of the "documentation" is in the actual code, so you need to know how to read the code to be able to learn quickly. Of course we don't document the vanilla stuff, but most of it is relatively obvious.

    We currently still hang out in the #tapi channel on esper.net, so if you want to talk live to people for help, go there.
  3. Hax4Ever

    Hax4Ever Terrarian

    Still waiting on a texture pack manager for 1.3 :V
  4. It's a me!

    It's a me! Pixel Pirate

    It's out! Even though it's a pre-release. Can't wait to finally start modding.
    Nopezal and Bullseye55 like this.
  5. Azu

    Azu Retinazer

    Does this use the .json format, or just .cs?
  6. PoroCYon

    PoroCYon Terrarian

    It's entirely C# (although there is an incomplete function for item JSON files, but you still need C#).
  7. Exeton

    Exeton Terrarian

    Yay, it's finally out.
    Nopezal and Bullseye55 like this.
  8. PapyroKinesis

    PapyroKinesis Steampunker

    Definitely looking forward to this. I'm glad there'll be multiple modding options available out there!

    Thanks for helping out the community as always, team.
    Last edited: Nov 17, 2015
    Nopezal likes this.
  9. Nopezal

    Nopezal Skeletron Prime

    Been watching this since it's name was decided. Great job, Prism team!
    Eli10293, PoroCYon and Bullseye55 like this.
  10. MageKing17

    MageKing17 Official Terrarian

    Congratulations on finally having a release, everyone.
    Bullseye55 and Nopezal like this.
  11. ~[Icarus]~

    ~[Icarus]~ Steampunker

    So here it begins the two sides war, good luck in the project
  12. MiraiMai

    MiraiMai Terrarian

    Technically, there's 3 API's now including TerrariaPatcher. :dryadtongue:

    And honestly, not really a war. As said in the opening thread, theoretically, Prism either already is, or can easily be made, compatible with other APIs, so long as it's installed last. Can't say that all mods will interact properly without some bugs, but people can use what they want for their own projects and their playthroughs.

    Besides, @bluemagic123 frequents the #tapi chatroom and chats with us as well, it's not like we hate each other (though we like laughing at the hilarious comments all the API threads get, hehe :dryadwink: )
    Nopezal, Eli10293, PoroCYon and 2 others like this.
  13. ~[Icarus]~

    ~[Icarus]~ Steampunker

    Well as long they stay compatible it will be nice for everyone, usually games with more than 1 modloader usually aren't compatible with each other but if this is it might be a good thing i would say

    Well does it even matter replying it's not me who is going get everyone's likes anymore, it will be just over me now and this will probably be ignored and i'll be taken as the stupid person and you get the hero kudos
    Last edited: Aug 31, 2015
  14. sysrq

    sysrq Terrarian

    So, out of curiosity since I'd be interested in messing around and trying to add features (I started off in C# writing mods for Terraria back in the day), would UI stuff be particularly hard to get working?
    I looked into the Prism.Injector.Patcher classes, but since I'm not intimately familiar with Cecil stuff, I don't know where to start.

    Mostly I'm interested in making a sort of in-game item/builder mod that has a search-based UI (like inventory mods have been), but also instead of just giving you 999 (or what-have-you) items, it'd magically make them infinite so you'd only have one in a slot. The item stuff I looked at mostly seemed to be adding/modifying items, but I imagine that's possible?

    Keep us posted!
  15. MiraiMai

    MiraiMai Terrarian

    There's no graphics hooks ATM as far as I'm aware, those need to be added, they will work similar to tAPI or any other API though, you just draw your UI and check for button presses / clicks.

    The injector stuff isn't designed for mods to use, that is what is used to install Prism, so don't worry about understanding it if you just want to work on a mod :dryadtongue:
    Bullseye55 likes this.
  16. WavingCookie

    WavingCookie Steampunker

    Poro, you and your goddamn team are true genius.
  17. sysrq

    sysrq Terrarian

    I meant understanding it if I wanted to add extra hooks -- e.g. graphics, however item quantities are figured out, stuff like that.
  18. kageboushiKun

    kageboushiKun Terrarian

    Seeing as there's a ton of Mac and Linux Terraria players now, I'd say there's a very big chance of Prism becoming the primary mod API for 1.3.
    Bravo :3
  19. king40606

    king40606 Terrarian

    Can't wait for mods to update with this. Keep up the good work team! I can sense your passion :p
  20. Fruckert

    Fruckert Terrarian

    Is there a way to chat with custom NPCs currently? I can't seem to figure out how to do so.