T
adverse-sapphire
Can tModLoader be made to run natively on ARM Mac?
Hi! I have a question, is it possible to make tModLoader run natively on ARM Mac? https://github.com/Candygoblen123/TerrariaArmMac allows me to run vanilla Terraria natively on ARM M1 Silicon chips, meaning I have great FPS there, but in tModLoader I get really slow startups, very low framerates, and frequent crashes.
GitHub
GitHub - Candygoblen123/TerrariaArmMac: A set of files and instruct...
A set of files and instructions to make Terraria run natively on Apple Silicon - GitHub - Candygoblen123/TerrariaArmMac: A set of files and instructions to make Terraria run natively on Apple Silicon
178 Replies
There has been a bit of work, you can upvote this issue to show that you want it https://github.com/tModLoader/tModLoader/pull/2639
adverse-sapphireOP•3y ago
How would I go about upvoting an issue?
Click on the 👍 icon
adverse-sapphireOP•3y ago
Thanks.
Is there any more progress on porting tModLoader to ARM so far? Just curious.
No, all work currently in in getting 1.4.4 tmod updating and new modder functionality
adverse-sapphireOP•3y ago
Alright.
itchy-amethyst•3y ago
Hey, bumping this to ask the same thing!
adverse-sapphireOP•2y ago
Oh hey! 1.4.4's out, sick. Is progress on this likely to come?
Any progress thus far?
Not really, one of the dependencies of tModLoader doesn't support ARM yet, so we need to wait for that to happen
adverse-sapphireOP•2y ago
Unfortunate.
rare-sapphire•2y ago
Hello. I guess the same issue I have.
We try to play with friends so we have next configuration:
Remote server with good ping and 6gb RAM
User 1: Mac M1 Pro 32GB, Sonoma 14.2.1.
User 2: Mac M1 Pro 16GB, Sonoma 14.2.1.
User 3: Windows
Mods list: ["RecipeBrowser","AlchemistNPCLite","Autofish","BossChecklist","CalamityHunt","CalamityMod","CalamityModMusic","CalValEX","CatalystMod","Census","DialogueTweak","Fargowiltas","FargowiltasCrossmod","FargowiltasMusic","FargowiltasSouls","FargowiltasSoulsDLC","HelpfulNPCs","ImproveGame","MagicStorage","MaxStackExtra","NoxusBoss","SerousCommonLib","SubworldLibrary","UnCalamityModMusic","WMITF","CalamityRuTranslate","GravityDontFlipScreen","WingSlotExtra","SmarterCursor","ExpandedInventory","FasterUI","ShopExpander","OneStopNPCShop"]
Users with Mac have a big issues with fps, it's around 12 - 20. Of course we play with frame skip 😄
Maybe someone find some workarounds, @Frankie? Cuz I already tried a lot of different ways, but still unlucky.
cc: @jopojelly
adverse-sapphireOP•2y ago
Yeah! Frame skip does slightly mitigate the issue, but it's not fun playing on such terrible FPS. I'm also using an M1 Mac desktop with 32GB of ram, also on Sonoma 14.2.1.
@Frankie @LordKered I've given performance snapshot recording instructions here, let me know if you have questions in the process
https://github.com/tModLoader/tModLoader/issues/1582#issuecomment-1884022622
adverse-sapphireOP•2y ago
Thank you! Unfortunately, I'm having issues with the
chmod +x ./dotTrace.sh
part. I'm trying to change the ./
to the path it's located in (/Users/frankie/Downloads
) but that doesn't seem to work. Neither does Macintosh\ HD/Users/frankie/Downloads
. I'm probably doing something wrong; I apologize!What permission does the file have when you do
ls -lAh
listing?
..It's either a 3 digit number or something along the lines of rw.rw.rwx
on the left
You can try skipping that step, if ./dotTrace attach
doesn't error -- that was just a precautionadverse-sapphireOP•2y ago
It doesn't seem to appear in the list.

adverse-sapphireOP•2y ago
It's being ran with
cd
in downloads; I might have messed something up?adverse-sapphireOP•2y ago
Wait no, I found it!

adverse-sapphireOP•2y ago
I didn't realize it sorted alphabetically by capitals and then by lowercase.
That's a folder you navigate into, or rename it first with
rm JetBrains*.tar.gz && mv JetBrains* dotTrace && cd dotTrace
adverse-sapphireOP•2y ago
Ah, alright!
adverse-sapphireOP•2y ago

adverse-sapphireOP•2y ago
Oh wait, I forgot to do the chmod thing again.
Forgive my ineptitude.
Not
~/dotTrace
, ./dotTrace
.
is the current directory, while ~
points to your home dir.adverse-sapphireOP•2y ago
Ah, okay!
I recorded the
.dtt
or .dtp
, but I can't seem to find it in the dotTrace
folder.Did DT tell you where it put it?
You can append
--save-to=~/TML_Snapshot.dtt
to the second attach call to save it to your home.adverse-sapphireOP•2y ago
Hold on, let me try re-recording.
adverse-sapphireOP•2y ago

adverse-sapphireOP•2y ago
Uh oh.
It most definitely does.
adverse-sapphireOP•2y ago
It worked now without the save-to. However, these document sizes look off.

Uh, yea, that doesn't look right
Try removing them, and recording without
--timeout=30s
. To stop recording - select the console and press Ctrl+C
ONCE.
Maybe I misunderstood the timeout command, thought it's a timer.adverse-sapphireOP•2y ago
Same situation.

adverse-sapphireOP•2y ago
Wait a minute... Was I supposed to do the second one?

adverse-sapphireOP•2y ago
Was doing 64554, but both appear identical.
I'd expect only one to be present
are you running a client and a server?
adverse-sapphireOP•2y ago
No, I clicked singleplayer.
It also pauses when I enter settings, which confirms it, I think? I'll try 64495.
./dotTrace.sh attach 64495 --profiling-type=Timeline --timeout=30s
./dotTrace.sh attach 64495 --profiling-type=Timeline
Gonna try both of these.
adverse-sapphireOP•2y ago
With timeout and without timeout.


adverse-sapphireOP•2y ago
Sigh.
Try adding
--framework=NetCore
, and separately try removing the profile type argument.
This is the first time I'm working with the CLI tool too, so excuse me.adverse-sapphireOP•2y ago
No worries!
Usually everyone uses a GUI, but that's
1. windows-exclusive
2. proprietary and on a trial.
adverse-sapphireOP•2y ago
So
./dotTrace.sh attach 64495 --profiling-type=Timeline --timeout=30s --framework=NetCore
and ./dotTrace.sh attach 64495 --timeout=30s
?Drop timeout, you got the hang of manual.
adverse-sapphireOP•2y ago
Alright.
adverse-sapphireOP•2y ago

K, guess they detect that automatically
adverse-sapphireOP•2y ago
Without the timeline part, this is the result.

adverse-sapphireOP•2y ago
Only five of them.
Oh, that deprecation is no joke. Try without
.sh
.Why do they have the deprecated script on their documentation.

adverse-sapphireOP•2y ago
So I should try
./dotTrace attach 64495 --profiling-type=Timeline --framework=NetCore
?./dotTrace attach 64495 --profiling-type=Timeline
adverse-sapphireOP•2y ago
Alright.
adverse-sapphireOP•2y ago
Same story, but it's not deprecated this time.

If the output is the same again - I guess you'll just have to put all the created files into the archive. But I swear I've never seen them be split like this.
adverse-sapphireOP•2y ago

adverse-sapphireOP•2y ago
So just selecting all of them then compressing?
Yes
adverse-sapphireOP•2y ago
Alright.
That's.. the solution. Wtf, jetbrains.
adverse-sapphireOP•2y ago
Oh yeah, I forgot to ask—what's the goal of getting this data? Is it like, helping gather what could help fix the overall lag, or finding a specific fix for each user? Or something else entirely; I'm just kinda curious.
@Chicken Bones From the Mac M1 issue: I'm not sure whether to blame calamity or the emulation being too slow for its projectile spam here.

adverse-sapphireOP•2y ago
I have this issue without Calamity as well, if that helps.
I can do another quick recording though without it.
Create a recording without any mods then
adverse-sapphireOP•2y ago
Is it okay if I keep Cheat Sheet enabled to let me properly stress the game?
Yes
adverse-sapphireOP•2y ago
Alright! On it.
for a start, calling
SetDefaults
many times per frame is a bad idea, but Activator.CreateInstance
shouldn't be showing up like it is there.adverse-sapphireOP•2y ago
I think it's inlined NewProjectile
adverse-sapphireOP•2y ago
Here's the one with only Cheat Sheet.
We can absolutely replace
Activator.CreateInstance
with static Dictionary<Type, Func<object>> constructors
if we need toThis is cursed

On_Projectile.NewProjectile_IEntitySource_float_float_float_float_int_int_float_int_float_float_float += IncorporateMinionExplodingCountdown;
yes, as with the orig delegate
adverse-sapphireOP•2y ago

yeah, but it means whoever's spamming
NewProjectile
is possibly to blame, but still@Chicken Bones this is utterly cursed, take a look yourself
There's very random trees if I select different areas of the timeline
..But I just enabled system code and it may be this actually??

@Frankie In TML's config.json file, try setting all
Use*RGB
booleans from true
to false
.I'm updating dotTrace
Should be in
~/Library/Application support/Terraria/tModLoader/
adverse-sapphireOP•2y ago
Alright, I'll do that now.

adverse-sapphireOP•2y ago
They're all already false, it seems.
Huh? There's chroma in the tree, I think that's Razer's
& by default this is on..
adverse-sapphireOP•2y ago

Make sure you clicked tModLoader and not ModLoader
adverse-sapphireOP•2y ago

🤯
adverse-sapphireOP•2y ago
I know nothing about how to interpret this but can tell that something isn't right. God I hate M1.
OOPS, I've used the wrong view. This was actually insignificant compared to, say, rendering of cheatsheet's GUIs, and the minimap.
The very first thing you need to do is check only the main thread
I've done that prior, then switched to system-only on accident.
That gives me 97.3% user code

Yea, and that's cheatsheet GUIs and then drawing of the minimap being just as terrible for unknown reasons
What's FilterManager.EndCapture however I'm not sure about

adverse-sapphireOP•2y ago
I did notice significant performance drops when Cheat Sheet GUI was open, but didn't know if I should mention it. Is there an alternative?
Right, got it, it's only immediate draw-per-call rendering being hellish here.
@jopojelly How much of SpriteSortMode.Immediate does cheatsheet use?

If we look at back-traces here, we see the culprits
I believe whatever graphics backend is being selected probably has
supportsNoOverwrite: false
I'm not really sure. Are the mac performance issues only present with cheat sheet then?
No, there's some of that in vanilla calltrees too
Can you get them to try vulkan instead of OpenGL?
@Frankie Launch with
/gldevice:Vulkan
specified in steam game launch args
i.e. right click TML in library and go to propertiesadverse-sapphireOP•2y ago
Alright, will do.
Game crashes upon startup.
adverse-sapphireOP•2y ago

logs?
Also, why are you using TerrariaArmMac. I have an M1 and can run Terraria normally
Do you have an exceptionally old version of your OS?
adverse-sapphireOP•2y ago
No, I'm running Sonoma 14.2.1.
I'm using the ARM thing because I'm having similar FPS drops, except not quite as drastic on the base game.
@jopojelly Maaaaaan, all of these seem unnecessary. You can probably use Deferred here.
https://github.com/search?q=repo%3AJavidPack%2FCheatSheet+SpriteSortMode.Immediate&type=code
Immediate sortmode is a work of satan, as it's not a sortmode -- it makes a drawcall into the drivers with every call of sb.Draw, doing absolutely zero batching.
Only ever useful around custom shaders or RTs, but I don't remember an exact use-case.
adverse-sapphireOP•2y ago
Should I try removing the ARM version and redownloading Terraria to see if that mitigates part of the issue?
Post logs first, they're in TML's install directory nested in
tModLoader-Logs
.No, it won't help with tML, just a separate question.
adverse-sapphireOP•2y ago
Ah.
I can't find the
tModLoader-Logs
folder, be it in the install directory (/Applications
) or in Application Support.Immediate
is a workaround for when you can't be bothered restarting your batch every time you make shader changes.
Install directory, next to tModLoader.dll
adverse-sapphireOP•2y ago
I don't have a tModLoader.dll, but I have a tModLoader.app.

(hyelp dottrace popup stuck)
adverse-sapphireOP•2y ago
Found it. This the right one?
adverse-sapphireOP•2y ago
/Users/frankie/Library/Application Support/Steam/steamapps/common/tModLoader/tModLoader-Logs
Ohhhh!Try
/gldevice:Metal
instead, in case that makes it use MoltenVKadverse-sapphireOP•2y ago
Weird how it didn't seem to be letting me access steam's portion of Application Support, despite hidden files being enabled.
adverse-sapphireOP•2y ago
Still crashes on startup.
:eepy:
adverse-sapphireOP•2y ago
Same; I need to go to bed. I'll check back in the morning, but I'll be in school the whole day. Will probably be online again in about 17 hours, give or take one.
Are you able to reproduce any of the lag without cheatsheet? There's DragonLens that I doubt would have the same use of Immediate sortmode.
adverse-sapphireOP•2y ago
I don't think I can spawn mobs without some kind of cheat mod, meaning I can't really stress the game.
https://steamcommunity.com/sharedfiles/filedetails/?id=2939737748
Or, most lightweight and most awful:
https://steamcommunity.com/sharedfiles/filedetails/?id=2544086332
/summon Zombie 200
for the latteradverse-sapphireOP•2y ago
Alright.
adverse-sapphireOP•2y ago
So I have about 3 minutes before I need to hop off; I can't get the command to work anymore.

chmod +X ./dotTrace
adverse-sapphireOP•2y ago
Ah, right.
wait no
cd dotTrace
adverse-sapphireOP•2y ago
Okay, I've gotta go. I'll try to get results before I hop on tomorrow.
Kk, goodnight
Can confirm I also get my FPS crippled by CheatSheet on an M1, when opening the NPC browser
time to write injections that scream out loud when there's no uniform changes between immediate calls
I highly doubt that CS is the only mod that misused the sortmode
Khronos TModLoader Validation Layers™️
..Also if the output render target is used as an input, but that's even more rare.
rare-sapphire•2y ago
@Mirsario thanks will do and share feedback after work
@Chicken Bones u said u have m1. So are you also see the FPS drops when u testing with some mods? (Just try to understand for self is it stupid user issue or something wrong with the mods which we play or maybe need to wait when TML will be updated)
Note: I have server where I play with the friends. I can share with you ip in direct to check will u have the same low fps (if it's can help). At least when I spawn I have 18-24 fps: https://discord.com/channels/103110554649894912/1083127307381788762/1194257619532136458
And one more: CheatSheet, MagicStorage, RecipeBrowser - they all have fps drops - but it's not critical as for me. The main critical it's boss fight and events.
Vulkan on Mac OS not launching TML.
Yeah, it'll depend on the mod but I'll look into the graphics drivers
Not all mods test on Mac for performance
I wouldn't be surprised if there's some troubles resolving this file, I don't recall anyone ever testing moltenvk

When we last touched it FNA still had native Metal
adverse-sapphireOP•2y ago
Now I can't seem to get anything to work.

adverse-sapphireOP•2y ago
Huh.
Definitely still exists in the same directory as before, udner the same name.
You have the folder in downloads, not home
adverse-sapphireOP•2y ago
Right... Fuck. I keep forgetting.
adverse-sapphireOP•2y ago

adverse-sapphireOP•2y ago
Maybe I need to do that chmod thing again?
adverse-sapphireOP•2y ago
Nope.

I said the folder, not the executable
adverse-sapphireOP•2y ago
Should I put it in home? I wasn't having this issue with it yesterday (albeit today I forgot to do cd Downloads)
cd ~/Downloads/dotTrace
is all you have to doadverse-sapphireOP•2y ago
Ah, thanks!
adverse-sapphireOP•2y ago
Normal gameplay right here.
adverse-sapphireOP•2y ago
Same sort of lag happening, and even without any mods enabled (albeit, I can't stress test with that, so I don't think I can give accurate results with it, but the same 10-15fps situation applies)
Just a chance of being related to the 150 Moon lords /s
Should I opt to try and play with frame skip on (and without cheat sheet) for the time being?
You've recorded the terraria playtime tracker. Launch the game with the start-tModLoader.sh script to avoid that tracker starting
adverse-sapphireOP•2y ago
Oops.
Where would I find that script?
Install directory
adverse-sapphireOP•2y ago
Alright, thanks.
I can't find it in the install directory.
rare-sapphire•2y ago
In the terminal
cd Library/Application\ Support/Steam/steamapps/common/tModLoader/
then enter
./start-tModLoader.sh
Otherwise if u using steam, u can press right click on TML -> Manage -> Browse local files.
But anyway to start .sh u need to use terminal
@Mirsario hello. Sorry. Can you again please repeat what I can do for u with debugging of app?
1. Should I install dotTrace trial by toolbox or by cmd?
2. What exactly data u need and how many?
3. Do u need server ip address for internal testing or not?
4. What the scenarios/test cases we should check on Mac?
You can describe all cases, I will try them for you.
Note: FPS info from github already tried, nothing help. With vulkan and metal args I have the same issue like Frankie hadWe've figured so far that on top of of course the fact that x86 is being emulated for our natives, the main cause of the low performance is Vulkan (MoltenVK) not working on macs, and the running OpenGL driver happening to be very allergic to draw call spam. There's enough intel for now, aside for frankie going to create a snapshot with no mods involved (aside the awful GamerMod for just spawning enemies). The dottrace I linked in the github thread is a CLI snapshot creation application that has no need for a trial period, it's only applications that view generated snapshots that are trialed or sold.
adverse-sapphireOP•2y ago
I'll try to get that done later today, apologies for the wait.
adverse-sapphireOP•2y ago
@Mirsario Enabling GamerMod causes the game to crash on reload.
adverse-sapphireOP•16mo ago
Is there any progress on this? I'm still not able to play, sadly.
genetic-orange•14mo ago
ayo wassup wassup, not making a github issue for this. moltenvk implementation for apple arm silicon (launch with /gldevice:Vulkan argument) has been noted and does improve call speeds and overall performance over bound and gagged opengl, however i noticed the included build of moltenvk is pretty out of date, understandable as of the nine people using this software on apple silicon maybe only three have ever opened a terminal.
seeing pretty significant stability and performance improvements running all the epic and cool mods building a newer module for apple arm, with (so far) only a few minor visual bugs.
here's the build working best for me, don't remember the version for purposes of updating the json but it doesnt seem to affect anything, download and run at your own risk, if it works on my machine doesn't mean it works on yours, RETAIN THE ORIGINAL MODULE, etc., etc.
B}
genetic-orange•14mo ago
If the improvements are significant, I'm sure people would appreciate a github issue with info about where the file came from and other info. There are a lot more people who would see it there and if it's there we can make sure to test and release an update with the new file.
genetic-orange•14mo ago
maybe another time, that's a whole can of worms
just need to build MoltenVK from source (https://github.com/KhronosGroup/MoltenVK) with xcode and commit to ./patches/TerrariaNetCore/Terraria/Libraries/Native/OSX
GitHub
GitHub - KhronosGroup/MoltenVK: MoltenVK is a Vulkan Portability im...
MoltenVK is a Vulkan Portability implementation. It layers a subset of the high-performance, industry-standard Vulkan graphics and compute API over Apple's Metal graphics framework, enablin...
genetic-orange•14mo ago
@Mirsario (:
I see. Do the releases on that github not work directly?
sunny-green•13mo ago
Well this will be a good fix.
If the devs were to see this n myb set it ad default run way fir game it would help a lot
exotic-emerald•7mo ago
has there been any progress on this at all?
@Mirsario apologies for the ping since it has been a year since youve been bothering with this entire process
MonoMod ARM is in progress
exotic-emerald•7mo ago
tyyy 🙏 do you happen to know how far along it is?
adverse-sapphireOP•6mo ago
good to know!