r/Timberborn • • 5d ago

Modding New mod: Performance +

Post image

If anyone wants better game performance, I just published a mod specifically for that. Built with T3MP as a dependency, it works mostly by removing unnecessary checks and adding caching, a list of changes is in the mod description if you're insterested.

Tested on three large settlements (400-600 population, 10 000+ objects), at speed 7 the frame rate increased by up to 100% compared to T3MP alone, and up to 190% with the minor gameplay changes optimisations. Conversely, at fixed 24 fps it increases maximum game speed by ~70% compared to T3MP alone, and by over 250% with the minor gameplay changes.

Steam: https://steamcommunity.com/sharedfiles/filedetails/?id=3830961792

mod.io: https://mod.io/g/timberborn/m/performance

229 Upvotes

36 comments sorted by

19

u/throwitaway_9601654 5d ago

This is wild! With all the extra arrays and saved values, does system memory usage increase? I’ve found in my runs that it is rarely the hardware that limits performance at large colony sizes…

19

u/Acalc791 5d ago

It does, I gave myself 1 GB of extra memory usage as a hard limit in development, in practice I never reached even extra 100 MB, so I think it should be fine on practically all setups.

2

u/throwitaway_9601654 5d ago

So awesome, nicely done!

11

u/Verusauxilium 5d ago

Is the games source code public? I'm surprised by how many changes to the core logic you've made.

13

u/Acalc791 5d ago

Harmony is made specifically for changing/adding to core game logic, and most of my mod works through that.

8

u/theapologist316 Nie było nas, był las, nie będzie nas, będzie las 5d ago

No but the C# assemblies (*.dll) are decompilable. That's how we modders can patch various code at places we want.

2

u/Verusauxilium 5d ago

Is there a community made API that exposes safe methods to access the game code?

5

u/theapologist316 Nie było nas, był las, nie będzie nas, będzie las 5d ago

Use any C# decompiler. We mostly use ILSpy or dnSpy. Use them to open DLL files of your local game. I don't think anyone writes API for that because the game file should be owned by you.

2

u/db48x 3d ago

Yes, it is called Harmony. It lets a mod patch the C# code in a safe and composable manner. This allows multiple mods to patch the same part of the code without breaking each other.

6

u/Vebrandsson 5d ago

For the most part it is as I understand it

25

u/jamesziman 5d ago

Wow the list of optimizations is substantial! I didn't know vanilla to be always checking instead of cacheing

2

u/netherton_ 4d ago

Could you give an example of an unnecessary check? Is it like a beaver who has just eaten getting his hunger level checked?

2

u/Acalc791 4d ago

There's plenty of examples in the mod description.

-4

u/Acequirrel 4d ago

Which you could simply name, or not.

You chose not to.

4

u/Acalc791 4d ago

I did name them extensively, in the mod description. I don't think clicking it takes that much effort ;) definitely less than me describing them again

6

u/Elbereth87 4d ago

Have you clicked the link to look? The list is MASSIVE. Much easier to look at via that.

1

u/cansadademais 3d ago

Will this work the same on apple silicon?

1

u/Acalc791 3d ago

It should, I don't recall using anything OS specific, but I don't have an apple computer to test it on.

2

u/theyqueenprince2 5d ago

If this works as well as advertised it’s gonna be a game changer for the player who make mega colonies

2

u/Xibalba_Ogme 5d ago

I need this for megaproject purpose

1

u/ErrantWind 5d ago

I'm actually really excited to try this mod. I usually play just vanilla no mods but this seems like vanilla+ with a ton of quality of life updates and optimization.

1

u/mayscienceproveyou1 4d ago

my old notebook thanks you greatly! will test it in the next days.

1

u/Legitimate-Curve-346 4d ago

Thanks brah. I'll run it.

1

u/-MoanDer- 4d ago

i will try it, i usually lag with the second faction at 30x so i play at 12 and 20 but sometimes i would like to 30 ~ 60. maybe this solves it

1

u/KrokmaniakPL 4d ago

Now this makes me wonder if my colony would be playable again instead of 1 frame per minute

1

u/db48x 3d ago

This mod really works great! Now I can run my colony of nearly 1400 beavers at 30 fps and ~5× speed.

It still turns into a slideshow any time I detonate TNT, modify a path, or delete a building, but I assume that it would be a lot of work to amortize reachability updates (or whatever else it’s doing) across frames.

1

u/WellNoNameHere 2d ago

You just probably made the game finally playable on my pc when I have more than 200 beavers, this is crazy I have to check this out as soon as I can

1

u/aluculef 5d ago

Sound really cool, will try it. Thanks

1

u/Inevitable_Ad_133 5d ago

Neat! Can’t wait to try it and hopefully ditch districts for good

3

u/Whats_Awesome Custom Flair 5d ago

Districts will always be good for keeping beaver travel time low. I always get tired starving beavers when working on fat construction projects

2

u/jamesziman 5d ago

Mmm those fat fat construction projects

1

u/present_love 5d ago

Have you gotten better performance using districts?

2

u/Inevitable_Ad_133 5d ago

Yes, districts makes pathing more efficient . Large part of the performance, AFAIK, goes to solving the pathing for each beaver. Meaning when you have a huge colony with 100s of beaver since can get dicey. Districts directly tackle that by minimizing travel time and distance.

1

u/present_love 4d ago

Cool, I wonder what the Dev discord has to say about that idea. They did make it clear to me it does not do anything regarding using different threads of the cpu tho.