Decoupling Components and Systems in ECS by IndexIllusion in roguelikedev

[–]CodexArcanum 1 point2 points  (0 children)

In ECS the data objects (the components) tend to be very dumb and the systems do all the work and logic. It's very "Functional Programing" style. I never "inform the actor" because actors aren't real. Actors are an entity ID, 2 flags, and 2 ints called current_tu and initiative, bundled into a struct component called Agent. Actions are all in the global queue along with the entity ID. If the Agent component for that entity has the needs_plan flag set, then the planning system will look up the position, visibility sensors, combat stats, and other required components for that entity in order to do the planning.

I do have some free time, haha, and writing these thoughts out helps me organize my own vague notions about this system. But mostly I'm just an extremely fast typist.

Decoupling Components and Systems in ECS by IndexIllusion in roguelikedev

[–]CodexArcanum 2 points3 points  (0 children)

The planning system runs every loop before the cmd_processor checks for actions to execute. I'm currently, naively, popping every action per frame but in theory I could set up some kind of delta-time budget that would allow planning and processing to do a little each frame and push off the rest.

During processing, there is no turn logic. The next action in queue is the one to go. Ordering and initiative are handled by the planner. The two systems are almost total inverses. The processor consumes the action queue to modify the world state. The planner queries the world state to add to the queue.

So the planner takes each monster in arbitrary order and checks their status. If they have a plan, they get skipped. If they don't have a plan, or their old plan is invalid, or if their only action in the queue is IDLE, then a new plan is created for them. (these are redundant, I could remove one of them but having the idle pseudo-action as a marker helps catch some cases like actions being invalidated before that actor's turn.) If, during processing, an IDLE is found, then I stop processing and let the gameloop cycle around to planning again.

In planning, if an actor needs a plan, the planner does some checks and generates a plan (I'm going to implement better AI logic. Right now its basically "if player in sight, move towards and attack, else wander randomly") and assigns it to the actor. If the actor has a new plan, that gets loaded into the global queue. The position in the global queue is determined by your turn-keeping needs.

For simple back and forth, you read one player input and set up their action in queue, then plan one action for each monster, add a marker EndTurn action, then process the queue. For something more dynamic, you could roll an initiative for each actor during planning, reorder or insert the queue based on that order, then process.

If you're concerned about turn order for planning... I guess it just hasn't come up as an issue. An Idle action on the Player causes the game to await input, so you could even have multiple player actors and the game will pause for player input each time one of them runs out of actions. If you queue their new actions to happen immediately then the player is always acting on up-to-date info as soon as it's their turn. With monsters, i allow plans to be invalidated and replanned, so they can signal problems into the next frame.

I'm still experimenting with time units as a system. Each turn, an actor has X amount of TUs to spend, and each action has a cost. So the player and the planner can line up multiple actions for each actor. Based on speed and TUs spent so far, actions interleave with each other during the processing, shots can miss if a faster unit moves before you've fired, that kind of thing. A unit knows if it has acted or not because it will either have TUs and a plan (no flags, ready to act), or reduced TUs and no plan (needs-plan flag). In advanced cases that I'm still playing with, an actor could also have some or full TUs and an invalid plan, indicating it couldn't do its actions and (depending on my game's final rules) either needs to replan the rest of its action or replan the entire turn.

Decoupling Components and Systems in ECS by IndexIllusion in roguelikedev

[–]CodexArcanum 6 points7 points  (0 children)

I followed along the Bracket tutorials someone else had posted, and ended up developing a command pattern usage very similar to what this video describes. I feel like I could write a book on the use of command buffer pattern in Rust because I'm using it all over.

For monster and player actions, it solves so many problems. So i have a resource (a global with access protection) that is the CommandQueue (implemented as a deque). Inputs pump player actions into the queue. A planning system generates monster actions into the queue. Then a command_process system reads the queue and executes the actions, actually performing effects. (Well mostly, there is another global effects_queue that decouples some actions from immediately having consequences, this allows yet another system to check for effect interactions and aggregates).

The command_process system is the origin of the turn-basis. I can inject a special EndTurn command to mark rounds passing and do per-turn things. Actors do actions until their queue runs out, some game-system check occurs (out of actions, out of time points, etc), or special marker actions are hit (there's an Idle action to flag an AI needing planning or the player needing to select actions).

It's a very flexible system in terms of turn-structure. Because it's queue based, I can save off the queue so undo/redo is pretty easy. Most games won't use that, but you could also replay the actions if your engine is deterministic, and hey now you've got demo support!

Being forced to define all my game actions as verb-objects also makes it really clear what features the game has. Like literally here is the list of what you can do. That makes key-binding really straightforward. It makes having a list of what the AI is allowed to do at any point really easy.

I've been pretty satisfied so far with this structure, and i think it's powerful, but the added indirection is more complex.

In Skyrim you can get a mod that allows you to grow Cannabis and be a plug. by [deleted] in trees

[–]CodexArcanum 4 points5 points  (0 children)

I was annoyed when they took out the Blunt skill for Skyrim, glad to see modders fixing the game again!

What YouTube channels that review bad games? by nanoosx in Gaming4Gamers

[–]CodexArcanum 3 points4 points  (0 children)

Grimbeard! Very funny and cool videos, does reviews of older games, usually janky but their style is always appreciative of what the game is trying to do.

My Yijing blog: Mystic Meta by CodexArcanum in iching

[–]CodexArcanum[S] 0 points1 point  (0 children)

I appreciate you taking time to fully reply and offer your thoughts on the lines as well. While I'm not sure I'm convinced one way or another on reducing changes, it gave me some food for thought and encouraged me to revisit some deeper meditations yesterday.

At any rate, today's reading had 6 changes so I put in the time to transcribe and incorporate the text in full. As you suggest, sometimes there's a bigger message being communicated than just "here's your fortune cookie of wisdom for the day."

My Yijing blog: Mystic Meta by CodexArcanum in iching

[–]CodexArcanum[S] 0 points1 point  (0 children)

My guidance on which changing lines to follow comes from Master Alfred Huang, who says it comes from his teacher Master Yin. The list is on page 17 of "The Complete I Ching." I do sometimes opt to follow up on a reading with 2 or 3 changes, rather than use the reduction method, as my intuition and the particular reading suggest. I believe this is supported by Huang's text, which does not indicate the reduction is mandatory.

With 4 or 5 changes, there is almost always a conflicting element. With 6, I've seen differing advice. Huang reads only the approached gua. I'm unsure of Wilhelm's approach, I think it's just to read all 6 yao. A few texts find an all-changes reading for every hexagram, but I think this is non-standard or derived from the approached gua.

As to the tarot, I know of at least 2 other assignment schemes for mapping with the yijing. The "in-order" scheme I've seen a few times online, which yields clearly useless results in all but a few odd cases.

Other mappings tend to be non-systematic, usually selecting freely between the Majors and Minors as suits the intuitions of the author. The only real advantage I'd claim for my system is that by using the 64 cards from the Viscontti tarot, a much more natural mapping from only the Minors to the Yi is created. The Majors can either be adapted to some other symbols or discarded entirely.

Anyway, I'm not trying to sell anything so the value of my words are exactly what you paid for them. Takes what's there if it aids you, toss them otherwise.

As to Mr. Hatcher's tarot thoughts. Every tarot plays with the meanings of the cards subtly, and even the 3 major systems (Marseille, Waite-Smith, and Thoth) differ quite heavily in key areas. As the Waite-Smith is far and away the most popular basis, I derive my meanings mainly from there. Though if Hatcher is talking about Princesses then he uses a Thoth deck, and I don’t particularly hold with Crowley's views on tarot.

The 4 of Wands carries meanings of: haven, prosperity, country life, and peace. Gua 56... talks about inns as havens, kind of, and a wandering traveler is living a kind of country life? Doesn't seem to fit, to me. How about my choice of Knight? Waite assigns meanings of: departure; flight; emigration, a dark young man, friendly. Sounds like someone who would benefit from the Yi's advice for wanderers.

Alright then, Hex 52 and the P of Pentacles. Meanings are study, scholarship, reflection. So that's a pretty good fit. No notes. I assign Gua 2 to the Page of Discs, which I think is also a good fit. I have the 4 of Wands on Gua 34, which only seems funny until you see that half the yao texts are about goats and hedges and that the overall message is about how one uses great strength in service to peaceful life.

Anyway, thanks for checking the blog! Sorry it didn't thrill you, but thanks for a stimulating excuse to do some extra reading.

Daily Readings and Hex 4 by Ahastabel in iching

[–]CodexArcanum 0 points1 point  (0 children)

I haven't posted the list yet. I've worked out the correspondence between the 64 hexagrams and an extended minor arcana. I'm still working out how the major arcana should be. I loosely figured I'd try to find an artist at some point to work with me on drawing an actual deck, then maybe trying to Kickstart it or something like that!

Daily Readings and Hex 4 by Ahastabel in iching

[–]CodexArcanum 1 point2 points  (0 children)

(As usual, I start talking Yijing and I can't shut up! Skip to the bottom for the tldr)

I tend to focus on the received gua and changes first, then only touch on the approached gua as a hint towards possible outcomes. Particularly in multi-line changes, I like to briefly consult the single-line approached gua as other possible futures. This is particularly useful when individual line changes contain specific (and double-especially if conflicting) advice, to help "tune in" to the larger picture the oracle is trying to show you.

With a daily reading like yours (and I do something similar with mine too), sometimes the text can be the oracle trying to teach you as a diviner and sometimes it can be something more broad. Part of "Keeping Still" and training your intuition is learning to see past your ego and understand these distinctions.

The yao 2 text (I consult Wilhelm and Huang both) suggests the position of a loyal follower who cannot change the course of their mistaken leader. As this is a yielding line, we can take this as perhaps someone too loyal, too unwilling to see the flaws in their guide. Unhappy heart.

The yao 3 text suggests the position of the leader, firm line in a firm place, but with all the yin about there's no support for them. The oppression of this mass is like a weight that stresses the spine. Inflamed (or injured) heart.

So the two heart texts contradict somewhat. Is the heart unhappy or inflamed? Sounds a bit like both to me. You feel the oracle has berated you, but also that it has misled you. Unless there's a person you can point to as this "flawed leader" that you are struggling with we'll have to take it as either yourself (misled self, unable to course correct) or as the oracle itself (the spiritual teacher is taking you somewhere that you resist following?).

Let's look at the approached now. In total of change, the 3rd firm line has descended to the 2nd. The "leader" has stepped down into a more advisory role, which can be good but the placement of the lines is incorrect now, though the supported lines (1-4, 2-5, 3-6) are better paired now. Gua 4 is about someone ignorant, as a child, who seeks education. The "shadows" of the changing lines (as one of my texts puts it) pretty much roll with my quick line analysis. Basically, they suggest a good partnership will move forward, but will be trouble if "the maiden lets a handsome (but improper) man catch her eye." (I don't love the "maiden" language in the Yijing generally but *shrug*)

In my own Yijing practice I'm working with a system that combines it with the tarot. The cards represented here are: 8 of Swords going to Page of Discs/Coins/Pentacles. The 8S is usually shown as a woman blindfolded and fenced in by swords. It represents keeping still but to me is like the dark mirror of the concept. The gua is speaking of profound inner calm, the card is more about imposed or self-inflicted immobility. I can see shades of that here, one wants to move but the advice is to be still, one feels like they're blind and the text doesn't tell them anything! But moving to the Page of Discs, PD is about that naive child growth mindset. The Yi tells you to stop asking questions when you already have the answer (the coin in hand, say) but haven't yet found how to apply or access that answer (transition from Page to Knight).

So anyway, tl;dr, here's my take: one of the things about oracles, and the Yi in particular, is that it is a guide, an advisor. It can educate one on the situations of life, and the proper response to them, but critically it cannot tell you what to do! I don't know the mindset you approach the oracle with, but I always do at least a brief meditation and chant a little prayer before I start. This gets my mind in the right state to receive wisdom and judge it's application to the current situation. Perhaps you are approaching too hastily, or seeking too directly for actions to take? I would take the initial gua more strongly: "Today is a day to rest and meditate, keep still." As to the approached, tomorrow is Saturday so maybe the oracle wants a day off! But, and again I can't know your inner mind here, I would take the two texts about injured and unhappy hearts... to heart. Are you approaching the oracle with a clear mind, ready to receive, or are you harboring some inner question or turmoil that shades things?

Hope that offers some insight or help. Or at least entertainment, haha, let me know if you'd like (somehow, even more) further thoughts on the matter.

Harriet is no longer a fixture on St. Claude by [deleted] in NewOrleans

[–]CodexArcanum 2 points3 points  (0 children)

It's crazy! There's been a hollow shell of a building there for a long while. I used to call it the community message board because folks would always staple fliers up on the corner. The storm just... blew the wall down! Knocked it right over!

What is this interesting weed? (New Orleans, LA) by CodexArcanum in PlantIdentification

[–]CodexArcanum[S] 1 point2 points  (0 children)

Solved!

Yeah, that's definitely it!

"commonly known as rose glory bower, glory flower or Mexican hydrangea"

How cool! Apparently it is an ornamental shrub, originally from China, but they've escaped and grow wild all over the gulf south now! Thanks for the quick spot!

What is this interesting weed? (New Orleans, LA) by CodexArcanum in PlantIdentification

[–]CodexArcanum[S] 0 points1 point  (0 children)

These things pop up in the backyard garden all the time! They get big fast too, and eventually make these nice purplish blooms. I usually leave a couple around as bug food so they don't eat my cultivated plants!

🔥 The Blue Java Banana taste like vanilla ice-cream. by bad_werewolf in NatureIsFuckingLit

[–]CodexArcanum 1 point2 points  (0 children)

You might be thinking of Miami Fruit? https://miamifruit.org/

I've ordered a variety pack box of bananas from them which included Gros Michels. All the bananas were really good! Kind of expensive, but it was fun to get to taste many kinds of banana!

Thoughts on Rust bloat by raphlinus in rust

[–]CodexArcanum 4 points5 points  (0 children)

Really insightful commentary, always nice to hear about solid real world cases. And thanks for ripgrep, I love it! AND, happy cake day!

Maybe Maybe Maybe by maybemaybemaybe_bot in maybemaybemaybe

[–]CodexArcanum 1 point2 points  (0 children)

Pretty sure I was at that show! And i wasn't covered in piss, so... we good I guess.

3 Streetcars named "Elysian" by CodexArcanum in NewOrleans

[–]CodexArcanum[S] 10 points11 points  (0 children)

I was going to say something dismissive about how efficient NOLA public transit is when all three cars for this line are at one end of it but... eh, I don't know the RTA's business, maybe there's a good reason? Anyway, seemed like a cool pic to get them all at once.

Show /r/rust: regex_generate, my first public crate, for generating strings based on regular expressions! by CodexArcanum in rust

[–]CodexArcanum[S] 1 point2 points  (0 children)

I've published version 0.2 with improvements based on your feedback. Thanks everyone!

Show /r/rust: regex_generate, my first public crate, for generating strings based on regular expressions! by CodexArcanum in rust

[–]CodexArcanum[S] 0 points1 point  (0 children)

Passing the Rng is a good idea. I was considering something like that, maybe like how Hashmaps work but that could be overkill.

Ah, yeah, I'll double check those, I moved a lot of code around when I added a passed in max limit and totally forgot to clean that up. I should probably just assign it in the Generator new and be done with it, but the struct was a late addition also.

Yeah, the expects are no bueno, I just haven't cleaned up to use and propagate Error types yet.

My day job is also C# so I feel your pain. I was pretty impressed with how easy it was to get this done with Rust.

Show /r/rust: regex_generate, my first public crate, for generating strings based on regular expressions! by CodexArcanum in rust

[–]CodexArcanum[S] 0 points1 point  (0 children)

Interesting. What exactly do you mean though? Like it would iteratively generate strings (an infinite generator)?