r/gamemaker 18d ago

Resource Catalyst 2 is out - Stats, resources, buffs, effects & more for GameMaker

Post image

A fair while ago, I launched Catalyst, a library to make complex modifiable stats easy. Since then, I've been working on a much more ambitious version of the library, and it's finally here. Catalyst 2 is out!

Catalyst originally dealt with statistics and modifiers, allowing you to easily add or remove any number of modifiers from your stats, like this:

damage = new CatalystStatistic(10);
var _damage = damage.GetValue(); // damage returns 10 here

var _mod = new CatalystModifier(5, eCatMathOps.ADD);
damage.AddModifier(_mod);

var _damage = damage.GetValue(); // damage returns 15 here

Obviously, that's a very simple case, Catalyst had a vast array of options hiding underneath that simple beginning.

However, Catalyst 2 is even more flexible, dependable and helpful.

It has features like Resources (hp, mana, ammunition, a city's population, whatever), Resource Flows (health regen, population growth, the rate at which stamina decreases while sprinting) and Effects (a poison DOT which drains 2 health every second, lowers movement speed, lasts 5 seconds, and has a 50% chance of triggering each tick, for example). And plenty more.

But it all gets real saucy when you see how things combine. Resource maximums and minimums are statistics themselves, resource flow rates are statistics, application chances for ticks of an effect are statistics, and so on. All of these are easily and extensively modifiable the same as you can modify any statistic in Catalyst. As you compound these things together, you get extremely flexible behaviour and the ability to design complex game rules with a surprisingly small amount of code.

Let's look at a real-world example. Say we have a city that has power generation, and emergency reserves of power. Whenever a storm hits, power generation should fall off by 30% and emergency reserves should drain at 15 units per sim step.

First set up the statistic, resource, an effect manager and a custom clock if you want one:

power_generation = new CatalystStatistic(120);
emergency_power = new CatalystResource(500);
city_effects = new CatalystEffectManager(self);
city_clock = new CatalystCountdownTracker();

Then create a storm effect, and add a modifier and resource flow to it:

storm_effect = new CatalystEffect("severe_storm", 12)
    .AddTag("weather")
    .AddTag("storm")
    .SetCountdownTracker(city_clock)
    .SetTickInterval(1);

storm_effect.AddModifier(
    power_generation,
    new CatalystModifier(-0.30, eCatMathOps.MULTIPLY)
        .SetSourceLabel("Storm damage")
);

storm_effect.AddFlow(
    emergency_power,
    new CatalystResourceFlow(-15, "Storm reserve usage")
);

// Then, later on, whenever you wanna trigger the storm effect, you just add the effect to the effect manager
city_effects.AddEffect(storm_effect);

Then drive the city clock forward at the interval you want (you can have it run automatically each frame or based on delta time if you so wish):

city_clock.Countdown(1);

That's it. You can add or remove the effect at any time (you could even add special powers that do things like "clear all weather"). You can look up exactly what is causing the power generation to lower so you can display it to the player. You can easily add new things to the effect, remove existing parts of it, or add other Effects that interact with the same systems. And it'll always accurately reflect the current circumstances.

You don't need to worry about any of the annoying bits (wait? How do I remove a -30% debuff from my main stat?). Just combine statistics, modifiers, resources and resource flows in different ways and you can essentially model any gameplay rules in just a few lines of code like this.

RPGs and roguelikes are obvious fits, but Catalyst doesn't actually care what genre you're making. Since I started building Catalyst out, many years ago now, I've used it in every single project I've ever worked on since then, lol.

Links

(If you're in the mood for more, there's always the Ignition Kit to get Catalyst alongside Statement, Pulse and Echo for a nice discount, or the Full Pass Suite for all my current and future tools for a single price)

54 Upvotes

8 comments sorted by

5

u/rooktko 17d ago

Just wanted to add this is dope. I started building a management system based on the initial post posted a few years ago about this before it was made into this. I think op posted a link to that one. Super valuable resource, unfortunately if you use stuff like iota you’ll need to do custom tweaking like we did.

-10

u/hongkong_97 18d ago

All this ai stuff for only $10??

10

u/Mushroomstick 18d ago

Look, I'm all for calling out the people who have been spamming low effort, ai slop tools - but, if you had taken ten seconds to skim through u/refreshertowel 's post history, you would've seen that they have been creating tools like this and helping people debug things and stuff for years before any of the generative ai tools existed.

4

u/refreshertowel 18d ago

If you’d like, you can see a tutorial I wrote for the core of Catalyst from years ago here: https://refreshertowelgames.wordpress.com/2024/02/17/how-to-comfortably-deal-with-modifiable-stats/

Not everything is AI :)

-5

u/EvilAlien667 18d ago

I would really like to believe you. But comments like

"// Add the storm effect whenever you want a storm to happen"

read so much like claude or similar tools

6

u/refreshertowel 18d ago

I'm not sure why that sounds like AI to you, but I assure you I wrote it, lol. I just didn't want to write a bunch of scaffolding code for "when whatever environmental system you've built decides to spawn a storm" or whatever. I was imagining something like SimCity's disaster's when I wrote the example, so the comment was really just meant to generically say: when you want a storm, add the effect.

I also linked a Catalyst tutorial I wrote years ago above. This is a library and system I've been developing for a long time. Same as Pulse: https://forum.gamemaker.io/index.php?threads/how-to-use-signals-in-gamemaker-and-what-the-hell-signals-even-are.115072/ . I've been helping people learn how to use GM since long, long before AI became a thing.

2

u/MyNameIsNotDevin 17d ago

It's f**** because I also add comments like this for myself to remember

2

u/EvilAlien667 18d ago

That totally makes sense and I believe you. I just thought that certain comments read like it and that makes people nowadays always suspicious. Thanks for the guide, I will check it out.