Rule Simulator v0.9.11.9.3
Blah blah blah I just want to jump in: here if UI installed
Sample deployments:
What it does
This loads in card text at parses it at startup to determine effects. Custom or brand-new cards can work as long
as the parsing is effective.
Advantages
- Doesn't need cards individually implemented
- No proprietary cards embedded in source
- Browser-based so useable from mobile
- Can possibly understand new cards it's never seen before, if the syntax is clear. This means both brand new
cards and your custom cards.
- Just needs new verbs implemented. "Verbs" doesn't mean "Keywords" -- the reminder text on Keywords is often good enough by itself to understand and if so no work at all is needed. But verbs like "xros" or "put under" need written.
- Open source so you can take this and run it yourself. You can deploy to azure in a few minutes.
- Source here
Shortcomings
- There's still lots of parsing and verbs left to implement
- Some cards conflict on how they get parsed ("By X, Y. If A didn't happen, B." Do we check for "A" in X, Y, or both?)
How functional is it?
Parsing and verb implementation are sufficient to get through recent starter decks
Medium-turn design goal is educational
- Precise scenarios can be created on board. Wonder what a set of cards can do? In theory this lets you run
through them all
- The ability to create situations lets one create challenges to give to others
- It's very easy to switch to the other player. Great for testing but also means competitive PvP isn't there
yet. (This isn't a fundamental design flaw; it just needs better session management.)
- The API is easy to control, so if you want to try training an AI you have an interface for that.
- There's a creative mode if you're comfortable with text
Not present
- Laddering, matchmaking, fancy UI
- No mulligan yet, sorry. This obviously fixed for any competitive environment. For the time being, it
lets us test weirder edge cases as you have to play more unusual combinations of cards.
- A lot of parsing has yet to be imeplemented.
- Several verbs are left to do
- The game may sometimes prompt you to pay a cost that you can't. It shouldn't ask at all, and you can't pay
partial costs. These are being chased down.
Technical Details Below
API
The game state is sent with JSON that looks mostly like you would expect, each player having a region and each
region having the entitites within it listed.
A player nominally doesn't see private information intended for the other player only.
At all times the game will be expecting input from exactly one person (not necessarily the turn player). That
player will have their choices enumerated in a JSON object.
There are a few ways of interacting:
- A synchronous POST to an endpoint with the next statement. Game logic will be executed and the next game
state returned. This method is less friendly but very batchable, essentiall for automated test cases.
- A websocket. Messages are similar except that asynchronous updates of game state and log messages will be
received as they are processed.
- Arbitrary game boards can be created and game actions scripted as one big POST. Essential for automated
testing.
Known bugs
- "For each X" may not fire.
- Search is flaky, and depends on the player being honest.
- When you "switch targets", when you have to switch you could choose to keep it the same
- Report bugs here
How to write a test case
An example test case is in tests/once-per-turn-2.in.
Indicate what card DB you're including. Writing custom cards for test cases is fine, and in many cases makes
testing easier if you can isolate weird effects.
Your test case and custom cards can be included.
Card database
The game will read cards in a few different formats, with more being added.
- Wiki text2html output. Samples are in the db/ directory.
- like the JSON format that DigimonCard.app uses. Pretty straightforward to understand.
- like the JSON format that digimoncard.dev uses. This isn't as clear a format since it relies on a lot of magical constants so multi-colored cards will have issues, and getting data errors fixed is harder, but you can still get surprisingly far with it.
Contributing / Technical Details
Card effects are parsed from text into a SolidEffect object. This object is then processed by the game
engine.
Adding new effects will mostly just be getting the parsing to work, using already existing verbs. In some cases new
verbs
may be needed but the verbs are very low-level so this really won't be needed very much.
Other high-value contributions are:
- user interfaces. There's one UI project already but the API is clean enough that totally different UIs
can
be dropped in
- custom cards
- understanding Azure, like why does it sometimes take 4 minutes to serve a static file
- writing fun scenarios
- writing test cases
- manual testing for things automated test cases might not find
- improved card parser to read text
- implementing verbs
Other stuff
Design decisions you may or may not notice
- The game gives away if your opponent could choose to blast evolve.
- There is a similar issue for any effect that might utilize a card from hand. The game log for the other
person should not real
- If an effect has 0 or 1 targets, the game will autochoose and continue. This was a design choice and
it
might be wrong if people want to notice what's going on.
- Something that chooses a target when there's only one acts the same as something that has a forced
target (think Matt suspending itself). This is probably confusing and should be remdeiated.
- Retaliation might activate on mutual battle death. It won't do anything, you won't notice unless you
watch closely. But it shouldn't activate at all, per rulings
- 'Choose up to' for devolve will act weird when choosing 2-or-more on 2-or-more targets
- If you have 2 separate <Security A +1> effects, it will show as <Security A +2> although
the
rules dictate it's not SA+2, it's specifically two SA+1's.
- If you're on phone the logs are probably not visible because they're on the right. Landscape will
show
them
but you'll end up scrolling a lot.
What's next?
We need feedback on what should be worked on. Like, do you want..
- bugs fixed in current cards?
- more cards implemented?
- text showing which explicit effect is being activated (not just the mon doing it)?
make sure cards that can't trigger aren't even put into the trigger list? Maybe everything that
triggers should trigger, if we need cleanup it takes place later.
- fewer extraneous popup messages?
- more descriptive text during game play?
- auto-skipping non-activatable effects?
- make logging on mobile be better
- YOLO and dump in all the cards in the game to see what happens?
- better creative mode without needing to write text?
- write your own cards?