xethya / framework Goto Github PK
View Code? Open in Web Editor NEWOfficial monorepo for Xethya, an RPG mechanics framework built in TypeScript.
License: MIT License
Official monorepo for Xethya, an RPG mechanics framework built in TypeScript.
License: MIT License
It's possible to override a range definition by altering either its lowerBound
or upperBound
. We should add a readOnly
option to prevent this behavior.
While attempting to use typescript-memoize, it turns out that if the score changes, the sum components don't refresh if they use the memoize
decorator, therefore the score never changes.
A list of modifiers can be extensive, so we need to figure out how to apply condition-driven memoization.
We should add a package @xethya/phaser-integration
to connect our framework with the Phaser SDK.
There's a template repo we can use here: https://github.com/photonstorm/phaser3-plugin-template.
As of 7b6ff97, a very early version of the plugin could offer:
CircleCI run: https://circleci.com/gh/xethya/framework/21
@xethya/definitions
is currently restricted to TypeScript users only. It shouldn't be like this.
Extending from #59, a WeightedStack structure can push items that occupy more than one slot in the capacity of the stack.
Apparently the package:create
utility never included rollup & friends.
According to the spec, every race increases one or more of a character's ability scores.
According to the Race specs from the SRD, a Race has the following properties:
Every race increases one or more of a character's ability scores.
The age entry notes the age when a member of the race is considered an adult, as well as the race's expected lifespan. This information can help you decide how old your character is at the start of the game. You can choose any age for your character, which could provide an explanation for some of your ability scores. For example, if you play a young or very old character, your age could explain a particularly low Strength or Constitution score, while advanced age could account for a high Intelligence or Wisdom.
Most races have tendencies toward certain alignments, described in this entry. These are not binding for player characters, but considering why your dwarf is chaotic, for example, in defiance of lawful dwarf society can help you better define your character.
Characters of most races are Medium, a size category including creatures that are roughly 4 to 8 feet tall. Members of a few races are Small (between 2 and 4 feet tall), which means that certain rules of the game affect them differently. The most important of these rules is that Small characters have trouble wielding heavy weapons, as explained in “Equipment.”
Your speed determines how far you can move when traveling (“Adventuring”) and fighting (“Combat”).
By virtue of your race, your character can speak, read, and write certain languages.
Some races have subraces. Members of a subrace have the traits of the parent race in addition to the traits specified for their subrace. Relationships among subraces vary significantly from race to race and world to world.
Alignment
enumSize
enumAs seen in 85b1b19, we can use transformIgnorePatterns
to exclude them so we run TypeScript code directly, since the tests are written in that language.
When a creature dies, it means it has no hit points left. It is determined by the size of the creature. If constitution
is part of the creature's definition, its modifier is factored in the calculation.
This makes the package unimportable.
Tests will usually check that some classes implement an identifier that matches a UUID format.
To avoid repeating the regex required for it all over the place, we'll add a function to check if a string matches this regex:
/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/
Could not find a declaration file for module '@xethya/bridge-phaser'. '/home/joel/Projects/xethya/demo-phaser/node_modules/@xethya/bridge-phaser/dist/xethya.bridge-phaser.js' implicitly has an 'any' type.
A simple data structure that can be used for fast data storage.
When using the WeightedStack
for the inventory, we noticed it's not enough to have a capacity, but we'll also need a mutable capacity.
Usually, in RPGs, the amount of weight a character can store in inventory is calculated using their strength or constitution, or some other basic calculation. While, initially, we might not want to be opinionated about how the capacity is calculated, we definitely want to support a way to update it.
We should extend WeightedStack
with a new class called DynamicWeightedStack
, that removes the readonly
constraint from WeightedStack
and adds a resize()
method.
Item
isn't exclusive to Inventory
, so it should be moved to a package of its own.
Once an initial version of #32 is implemented, Ability
should use Points to implement the scorekeeper and modifiers.
Useful for #39, it'll allow caching computed values not just on add, but also on removal.
Since these enums are implemented as bitwise operators, if we want to do an action based only on a part of the CreatureAlignment
, right now we need:
// Do something if the creature is Lawful.
if (
creature.alignment === CreatureAlignment.LawfulGood
|| creature.alignment === CreatureAlignment.LawfulNeutral
|| creature.alignment === CreatureAlignment.LawfulEvil
) {
// ...
}
While we could have a simpler, shorter form:
// Do something if the creature is Lawful.
if (creature.alignment & CreatureAttitude.Lawful) {
// ...
}
We would need to export the CreatureMorality
and CreatureAttitude
enumerables in the @xethya/definitions
package.
By default, it refers to any ground-based movement the creature can do. According to the type of creature, it can also burrow
, climb
, fly
or swim
. With enough movement, a Creature
can combine multiple movements if their speed is available.
While we now have the 💜 Sponsor button to allow for donations, since we're using non-default payment processors, it'd be nice to have a page on GitBook to better present this, while also adding it to the monorepo's readme.
Right now we're including the phaser
package as a devDependency
, when it should actually be a peer dependency.
This might require the usage of tools such as install-peerdeps
.
This prevents the usage of types like WeightedStack
.
Suppose we have a creature that is half-human, half-cat.
We want to create it using multiple races, as described in #28. So we define Human
and Feline
as races:
const HumanRace = new Race({
age: 90,
alignment: CreatureAlignment.Neutral,
size: CreatureSize.Medium
});
const CatRace = new Race({
age: 15,
alignment: CreatureAlignment.NeutralEvil,
size: CreatureSize.Small
});
Such hybrid creature could be expressed as:
const FelineHumanoid = new Creature({
races: [HumanRace, CatRace],
name: "Feline Humanoid"
});
How would the traits be defined for this instance?
A possible way would randomize between the ranges of possibilities defined by each race. So, for the age, any feline humanoid creature would have a maximum age between 15 and 90, they could be either Small or Medium in size and be aligned as Neutral or NeutralEvil.
We could cascade the values from race A to race B (which would make the races list order-sensitive).
We could drop "multi-racial" support in terms of defining hybrid races as specific races, such as:
const FelineHumanoid = new Race({ /* ... */ });
A Point can be increased or decreased by an arbitrary value, temporarily or permanently.
According to the Node.js LTS Schedule, the 12.x branch becomes LTS on October 21st. We should make sure Xethya works in 10.x and 12.x.
Points are cumulative units that can reflect different features of a creature.
Some examples would be hit points (how many hits a creature can take before dying or being destroyed), magic points (how much magical energy a creature is holding) or experience points (how much has a creature progressed in its life, raising its "level" and therefore other points).
Packages are being published with folders such as .rpt2_cache
or coverage
.
This issue tracks the possibility of moving away from CircleCI in favor of the new GitHub Actions workflow.
master
It'd be nice to start using projext to simplify the framework's bundling process.
@homer0, what'd be the best way to implement your bundler? This monorepo is entirely built with TypeScript, and currently using Rollup to bundle the packages. The idea is to output each package as an importable library or as an IIFE (see this file for reference).
An inventory represents a container of items. Such containers can be attached to other objects, like creatures or inanimate objects (i.e. chests).
Currently, on the test suite for the Phaser bridge, we have something like this:
type XethyaGameObjectFactory = XethyaDiceGameObjects & XethyaInventoryGameObjects;
type XethyaInventoryGameObjects = {
inventory(options?: InventoryOptions): InventoryGameObject;
};
type XethyaDiceGameObjects = {
die(faces?: number): DieGameObject;
coinFlip(): DieGameObject;
d4(): DieGameObject;
d6(): DieGameObject;
d8(): DieGameObject;
d10(): DieGameObject;
d12(): DieGameObject;
d20(): DieGameObject;
d100(): DieGameObject;
};
declare module "phaser" {
namespace GameObjects {
interface GameObjectFactory extends XethyaGameObjectFactory {}
}
}
This should be exportable as a type declaration as well.
Based on the SRD page for Creatures.
Creature
should be the base template of a Character
. It has a Size
, an Alignment
, and other attributes applicable from a Race
.Creature
has a name.Creature
has a unique identifier.Creature
can be multi-racial -- that is, it can have multiple races.Creature
has abilities (if using the 5E gamebook, it could be Strength, Dexterity, etc.)Creature
has hit points (#50).Creature
has a speed (#51).Creature
can talk/understand languages.Creature
has a challenge rating, a number that describes how much of a threat the creature is.Creature
can have skills, such as melee attack or ranged attacks.Creature
can have an inventory.Using a single key such as reason
might be insufficient, and more customization should be possible. Modifiers could have lore-related categories, the source of the modifier, or other information.
Deriving from Stack<T>
, there should be a structure that works like a stack but stops receiving elements if a given threshold is reached.
This package will be used to store enumerables and constants that are shared across the system.
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.