timjen3 / ttrpg-engine Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
There should be a way to do checks on one line. "Is the Player dead?" or "Does the Player have any Potions left?"
In preparation for implementing "roles" we need to rename the existing Role class to Entity.
A sequence has some implicit conditions. For instance, if you want to quaff a potion you have to HAVE a potion. Sequences should have a list of conditions that determine if the sequence can be ran at all.
Add a CanProcess() method to sequences that have the same inputs as Process() but returns a bool whether process can be called with the given inputs.
This can't be done until after #103 is complete โ
Some details about Roles:
Entities should be supplemented with data from roles like:
Cases where it would be useful to resolve 1 sequence item:
Currently all sequences are built from scratch every time they are invoked inside of the EquationResolver class.
This is very inefficient according to the mxParser documentation:
https://mathparser.org/mxparser-tutorial/expression-pre-compilation/
Since the equations don't change after the application starts, they should be built once. Only the arguments should change each time they are invoked.
Move the command parsers from the demo into the Engine.
Currently InventoryCommandParser
returns messages from GetExampleCommands that are specific to the demo:
return new string[]
{
"Equip [miner] {itemName:stone pickaxe,equipAs:pick}",
"Unequip [miner] {itemName:pick}",
"Drop [miner] {itemName:stone pickaxe}",
"Pickup [miner] {itemName:pebble}"
};
The default should be more generic.
Additionally you should be able to pass settings to override the defaults with settings.
{
EquipExampleCommand = "",
UnequipExampleCommand = "",
DropExampleCommand = "",
PickupExampleCommand = ""
}
Scenario:
It would be great if there was a way to optionally suppress triggered sequences from occurring. It should be optional, because in some cases you might want to go ahead and pass time with a message like "You tried but it was too hard!". But in other cases you might not want to pass the time like "[Before trying to harvest] You looked at the crops but they just aren't ready yet.
mxParser is great, but just to keep licensing simple I need to switch to something with an MIT license.
Probably going with this: https://github.com/pieterderycke/Jace
A common use case that is currently cumbersome is writing out a message when the user can't do something.
For example:
You are too tired to do <action>!
To accomplish this you need to carefully configure the conditions on several sets of sequence items:
Tags can be a simple way to drive actions from sequence items. A sequence item can have multiple user defined tags.
An example tag is "UpdateAttributes". The consuming application can listen for sequence items with an "UpdateAttributes" tag and knows what to do with it.
Examples:
Here is another example. This one is trickier, because it relies on having some kind of life cycle. How is a turn composed? What triggers the start/end of a turn?
Currently if you observe the demo you will see many usages of the CloneAs
Role method. This is done in code to map roles into sequences.
In order to move beyond the need for this manual in-code mapping, roles need to have categories, and possibly sub-categories.
For instance:
Player[Category = Entity]
Bandit[Category = Entity]
Sword[Category = Equipment]
After a short reflection, we actually need an array of categories.
Player[Categories = (Entity, Hero)]
Bandit[Categories = (Entity)]
Sword[Categories = (Equipment, Weapon, OneHander, Sharp)]
Management of these categories will likely need to be done outside of the library layer, but categories will allow for it.
Move logic out of classes and into a service layer.
Refactor methods for Sequence Items, Mappings, and Conditions to be on multiple items instead of 1 at a time.
For example: When taking damage check if HP < 1/2 HP. If so, check if critical wound is received.
When the sequence has a role category filter assigned to it, the sequence will be resolved for all roles passed that have that category.
There are various result items:
These are all half baked because they were added before the TTRPGEngine itself. Now that there is the beginning of a framework for doing something with sequence results it's time to rethink these various "results".
Q: How are results currently used?
A: Updating attributes. Publishing a formatted message.
Q: Any other uses not currently implemented?
A: See #106.
It makes sense for the engine to update attributes. That needs to be done in a cleaner way. It makes sense to publish events for both of these cases. Then apps using this library can tie into those events however they need.
The engine needs a new layer to perform higher level functions:
Later:
Inventory is represented by Roles just like entities. Inventory would be given different categories than entities to help the developer differentiate them.
Entities have inventory.
Knight (Entity Name)
=> List of Inventory ("Inventory" is the Role Category)
1. Steel Sword (Entity Name)
2. Steel Shield (Entity Name)
Inventory items affect sequences.
Currently there are a fixed number of animals in the area and once they are hunted they disappear.
Enhancement:
Currently it is complex to parse through sequence results. It should be simple.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.