Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.98a is out! (03/27/25)

Pages: [1] 2

Author Topic: You Merely Adopted Rules.csv, I Was Born Into It  (Read 9571 times)

David

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1131
    • View Profile
You Merely Adopted Rules.csv, I Was Born Into It
« on: November 13, 2023, 12:36:35 PM »

(Yeah, I guess I got excited about writing blog posts. So here's another.)

Blog post here.
Logged

Grievous69

  • Admiral
  • *****
  • Posts: 3126
    • View Profile
Re: You Merely Adopted Rules.csv, I Was Born Into It
« Reply #1 on: November 13, 2023, 01:03:05 PM »

Ok this is waay too much for my casual brain, I read maybe 5% of the blog post and figured it's not for me. But I still want to express how great this is for ambitious modders. From what I shortly skimmed over, it seems like a very informative resource. And we all know how more and better quality mods results in a more active community. (Although when I saw "blog post" I thought this would be about the reworked Hostile activity mechanics, but as you said, Alex is a very patient man.)
Logged
Please don't take me too seriously.

Wyvern

  • Admiral
  • *****
  • Posts: 4089
    • View Profile
Re: You Merely Adopted Rules.csv, I Was Born Into It
« Reply #2 on: November 13, 2023, 01:23:47 PM »

Wow. Useful stuff!

...That I don't have the time to fully read through right now, because that's a lot.

Still, thank you very much; I'm sure I'll be referencing this extensively in the future.
Logged
Wyvern is 100% correct about the math.

SirHartley

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1017
    • View Profile
Re: You Merely Adopted Rules.csv, I Was Born Into It
« Reply #3 on: November 13, 2023, 01:47:24 PM »

This is super awesome. There's been multiple requests for a proper tutorial on rules.csv, and for all the bad rep it gets (see: the funny meme about Eve Online difficulty curve) it really is a convenient way to do things if you do not need specialized applications or checks.

This is gonna help a lot of new modders get familiar with things, and I hope, will cause more dialogue to appear in mods - it's sorely needed.
Thank you for taking the time!
Logged

Ruddygreat

  • Admiral
  • *****
  • Posts: 584
  • Seals :^)
    • View Profile
Re: You Merely Adopted Rules.csv, I Was Born Into It
« Reply #4 on: November 13, 2023, 02:01:03 PM »

oh wow, a rules explainer!
that proper explanation of what each column does a really good job of demystifying it all, I was always confused by the differences between that one, "conditions" & "script" from just reading rules.

...though I'll still be chipping away at my personal code-only mess, doing code-adjacent things outside of my IDE feels dirty

WMGreywind

  • Lieutenant
  • **
  • Posts: 74
  • The circuit is one. And one is the machine.
    • View Profile
Re: You Merely Adopted Rules.csv, I Was Born Into It
« Reply #5 on: November 13, 2023, 02:03:03 PM »

I will live and die with rules.csv as long as I keep adding more and more titles for Phillip Andrada. Soon, his titles will be uncountable!
Logged

nathan67003

  • Captain
  • ****
  • Posts: 256
  • Excellent imagination, mediocre implementation.
    • View Profile
Re: You Merely Adopted Rules.csv, I Was Born Into It
« Reply #6 on: November 13, 2023, 02:22:43 PM »

Love me some hardcore tutorials (I will surely use this in my mod, one day(tm)) and love me silly post tags (my favourite is "common player scams and how to spot them).

You honestly did a pretty banger job, will definitely reference this in the future.
Logged
I have some ideas but can't sprite worth a damn and the ideas imply really involved stuff which I've no clue how to even tackle.

Tranquility

  • Captain
  • ****
  • Posts: 280
    • View Profile
Re: You Merely Adopted Rules.csv, I Was Born Into It
« Reply #7 on: November 13, 2023, 02:38:17 PM »

Very cool blog post! I would've loved to have had this as a reference when I was working with rules.csv for the first time, as it took a while before I learned how it works and adjusted to its structure. I do hope this proves to be a helpful resource for future modders out there!

(Also, the referenced GDC talk is incredibly enlightening; I would not have guessed that this dialog system was originally made and implemented for Valve's own games. It certainly makes a lot of sense why a similar system, with its overall flexibility and ease of use on the writer's end, would be adopted here!)
« Last Edit: November 13, 2023, 09:20:07 PM by Tranquility »
Logged

Wispborne

  • Admiral
  • *****
  • Posts: 564
  • Discord: wispborne
    • View Profile
Re: You Merely Adopted Rules.csv, I Was Born Into It
« Reply #8 on: November 13, 2023, 02:47:29 PM »

Amazing. This is exactly what the modiverse needed.

My journey with rules.csv:

1. Wow, a massive spreadsheet with tons of magic strings and no auto-complete, all just to do a subset of what you can already do with code. This is just awful. The worst part is that it's both called from and by regular code, making following logic flows difficult.
2. Externalizing strings is good, and doing minimal logic outside of code is fine. I'm going to make my own system, but using yaml so it's easier to edit text. Maybe rules.csv isn't as bad as I thought.
3. Hm, I might just be inventing rules.csv lite.
On second thought, rules.csv is fine, it just has a learning wall because there are no good tutorials I've found, and in order to figure out what all the "magic commands" are, you have to find the right class in the Starsector API.

Took me a while to figure out that you and Alex really did know what you were doing  :-[  and I was responsible for some of bad press. Inventor Raccoon and WMGreywind were two people in particular that showed what the system can do.

imo the one (?) thing that the tutorial could use is a list of the baked-in commands and variables, or the way to find them for a given game version. One could pore over the vanilla rules.csv to learn them, but it's nice to have a spellbook.

edit: Are you sure that rules.csv is hot reloaded, though? Even for non-vanilla rules?
« Last Edit: November 13, 2023, 02:53:08 PM by Wispborne »
Logged
Mod Managers: TriOS & SMOL | Mod: Persean Chronicles | Tool: VRAM Estimator | Tool: Forum+Discord Mod Database | If I'm inactive for 3 months, anyone can use any of my work for anything (except selling it or its derivatives), but continuations must be renamed to avoid confusion.

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 25837
    • View Profile
Re: You Merely Adopted Rules.csv, I Was Born Into It
« Reply #9 on: November 13, 2023, 03:19:38 PM »

(I feel like every developer has been through the "why is it like this, I hate it - I can make this better - oh" process more than a few times :D Not that it *can't* be made better, of course.)

imo the one (?) thing that the tutorial could use is a list of the baked-in commands and variables, or the way to find them for a given game version. One could pore over the vanilla rules.csv to learn them, but it's nice to have a spellbook.

There's a section in settings.json - "ruleCommandPackages" - that lists all of the java packages where the rule commands are found.

edit: Are you sure that rules.csv is hot reloaded, though? Even for non-vanilla rules?

Sort of - yes, but it only checks the timestamp on the vanilla rules.csv, so you'd also have to touch it. But the reload would pick up any modded rules, too.
Logged

Inventor Raccoon

  • Captain
  • ****
  • Posts: 494
  • Digging through trash for a hydroflux catalyst
    • View Profile
Re: You Merely Adopted Rules.csv, I Was Born Into It
« Reply #10 on: November 13, 2023, 03:36:28 PM »

rules.csv has honestly really grown on me as a concept - enough that I've taken inspiration from it for a recent project. Being able to dynamically adjust responses to a player's choices based on their circumstances, or to create lists of options depending on what's come up in conversation or what the player knows/has done, it all feels very intuitive and versatile once you get past the teething issues of having to work in spreadsheet format (and that, well, there's not been much in the way of tutorials before now - Alex's doc is helpful enough but it has grown a lot since then)

Overall - consider me part of the rules.csv/rules-scripting fanclub!
Logged

SafariJohn

  • Admiral
  • *****
  • Posts: 3132
    • View Profile
Re: You Merely Adopted Rules.csv, I Was Born Into It
« Reply #11 on: November 13, 2023, 05:14:45 PM »

I think many of the old rules.csv entries have conceptual issues with jumping to code and back that make them very hard to follow and/or modify. Newer stuff has avoided that and is much easier to see what is going on.


Obligatory Rules Tool plug: https://fractalsoftworks.com/forum/index.php?topic=13976.0
Logged

Histidine

  • Admiral
  • *****
  • Posts: 5106
    • View Profile
    • GitHub profile
Re: You Merely Adopted Rules.csv, I Was Born Into It
« Reply #12 on: November 14, 2023, 04:53:58 AM »

Nice post! Also interesting with other modders chiming in; I thought myself and Timid (of Iron Shell et al.) were the only modders who didn't hate rules.csv lol.

Extended commentary
I think the professional programmer types dislike it because it is much cleaner and faster to do things in our programming control structures. (While rules repeats a lot of quasi-boilerplate for each row, you have to worry about getting potentially multiple conditions right, and and doing anything that requires nested if structures gets miserable very quickly. Also if you ever need an OR logic gate in the condition and don't have it, that's annoying.)

Similarly I've found that making long linear dialog chains ("continue" -> "continue" -> "continue") gets pretty bloated; here's an (atypically long, to be sure) example from one of my quests:



while doing this kind of thing in a script for the visual novel engine RenPy, you'd just write each text block in turn (example from The Confines of the Crown):

    nvnr "I took a roundabout route back to our assigned quarters, scouting my environment while never straying far enough out of bounds to attract attention. I wasn't looking for anything in particular; it's simply a habit. Learn your way around when you don't need to, so that the knowledge is there when it becomes useful. \n\nIt's only a coincidence that it allows me to put off reading the letter, right?\n\nI can almost make myself believe that."

    nvl clear

    nvnr "Oscar told me not to worry, which in itself probably means that I should. If he can say such a thing, he must know what the letter is. \n\nNot my family summoning me home. If he knew something like that, he would have wanted to talk about it earlier, I'm sure. He wouldn't keep that hidden. \n\nPerhaps it's not from my family, but from his?\n\nA secret assignment to be performed in Gwellinor?"

    nvl clear

    nvnr "Ah, well. Quickest begun is soonest done.\n\nI open the valise and carefully lift out folded items of clothing until I discover the cylinder of red leather. It has a more solid heft than I expected. Either the leather is very thick indeed, or there is something more than a letter inside.\n\nI unbuckle the cap and shake out an unsealed roll of parchment and a little blue velvet box.\n\nWhat is this?"

    nvl clear

    nvnr "{image=cgs/necklace.png}\n\nI open the box to find another piece of jewelry, though a far cry from the sparkling fantasy offered to Princess Cassidy.\n\nIt's a pendant, a polished stone wrapped in wire, its color a warm honey-gold speckled with light. But why is it here?\n\nI suppose I ought to read the letter."


One thing I do like about rules is that you can often inject alternative texts and options into other people's dialogs, thanks to how fire-by-trigger works.

Anyway if you're taking ideas Alex, here are a few:
  • OR || for conditions (but I vaguely recall that I mentioned this a long time ago and it wasn't deemed worth doing?)
  • The way option redirection (like when multiple dialog options all give the same result) works right now is ugly. $option = myOption 0; FireBest DialogOptionSelected
    Could be a single rulecmd, like RedirectOption myOption or such. Ideally it should be possible to do this in the options column itself, but that would probably require completely redoing how option IDs work? Or maybe the InteractionDialogAPI could be given a map of option 'redirects'.
  • Maybe a custom syntax that allows highlights to be specified directly in the text instead of needing the Highlight cmd? IIRC MagicLib's bounty json uses double square brackets (EDIT:) double equals, like ==highlight==. Easier and cleaner than making sure Highlight's params match the actual text exactly if the latter is lengthy and/or ever gets changed.
[close]
« Last Edit: November 14, 2023, 06:57:53 AM by Histidine »
Logged

HiddenPorpoise

  • Ensign
  • *
  • Posts: 37
    • View Profile
Re: You Merely Adopted Rules.csv, I Was Born Into It
« Reply #13 on: November 15, 2023, 03:47:52 PM »

What does $entity.abyssalDepth refer to? It's not in any of my current dumps.
Logged

David

  • Global Moderator
  • Admiral
  • *****
  • Posts: 1131
    • View Profile
Re: You Merely Adopted Rules.csv, I Was Born Into It
« Reply #14 on: November 15, 2023, 03:59:01 PM »

What does $entity.abyssalDepth refer to? It's not in any of my current dumps.

Oh, the [REDACTED]? Nothing to worry about; COMSEC will take it from here.

Move along, citizen.
Logged
Pages: [1] 2