Skip to content

Alpha Release: Break Speed and Initial Perks Implementation

Caltinor edited this page Jan 23, 2022 · 2 revisions

This is the second alpha release. Again, there is a lot of backend and very little seen ingame, however this update should expand on some configuration settings rather substantially.

Here is what's new in this release:

  1. Perk API is implemented and functional.
  2. BreakSpeed Event Implemented
  3. Client Caching and Logic
  4. Initial Skills List Implementation
  5. MsLoggy Tweaks

1. Perk API is Implemented and Functional.

Perks ended up being the perfect way to handle breakspeed, which I will go into detail in the next section, and were subsequently implemented in this release. Perks were summarily modified to use EventTypes instead of their own PerkTriggers because there was identical overlap between them. Therefore the redundancy was removed. It is likely that a perk will exist for each event in the future. The difference between perks and eventTriggers is that perks cannot cancel an event and have termination logic.

With that said, currently the three events of BLOCK_BREAK, DISABLE_PERK (note name change), and BREAK_SPEED are functional, and all perks from the current release (jump_boost, speed, reach, etc) can technically be triggered by these events.

2. BreakSpeed Event Implemented

Break speed triggers while a block is being broken but before the break event. it is at this stage that tool requirements are checked. A block check is also performed to allow cancellation of the dig action on blocks that cannot be broken.

The key technical element to this event is that it works through the Perks system. a new perk "pmmo:break_speed" was created to handle this here are all of the settings for this perk

{  
  "perk":"pmmo:break_speed",
  "modifier": 1000,
  "pickaxe_dig": 1,
  "shovel_dig": 1,
  "axe_dig": 1,
  "shears_dig": 1,
  "sword_dig": 1,
  "hoe_dig": 1
} 

note, that like most perks, all settings after the "perk" are optional, however, failing to include at least one "*_dig" key will mean it does nothing. "dig" is the term Forge uses in it's ToolActions class to define breaking behavior with a tool. for each setting you define, you will be giving a speed multiplier to the tool for that key for the skill you have defined. for example, the following setup would give you one extra speed per level in mining to pickaxe usage, and an extra 10% speed per level to shovels.

"mining": [{"perk":"pmmo:break_speed",
    "pickaxe_dig": 1,
    "shovel_dig": 0.1}]

and if you had another entry for "excavation" you could have your mining skill and your excavation skill add up to give more speed making dig speed a composite attribute that you can define. "modifier" replaces the old config for "blocksToUnbreakableY". this is defaulted to 1000 and likely shouldn't be modified, but is left in because people may still use it. note that if you set it too low, you can make digging above the Y level of this modifier impossible. the higher the number the less effect it has on break speed.

Lastly, because breakspeed is a perk, it is possible to have the speed-determining behavior overridden by an addon. If you determine that how PMMO handles breakspeed doesn't suit your needs, you can have a custom perk made and use that in the config instead. In the APIUtils class of the API, there are variables that you will need to use BREAK_SPEED_INPUT_VALUE is provided in the NBT given to the perk and tells you what the speed is going in. BREAK_SPEED_OUTPUT_VALUE is the value you need to pass back out to set the new speed. Note that if you configure your world to use multiple perks for break_speed, this will be added between all perks.

Client Caching and Logic

In order to be more performant, some data is sent to the client and processed there. This is mostly for display purposes, so it should not be possible for clients to modify their pmmo version to cheat. This is a technical feature, so not something that will be obvious to the player. However, because it relates to player stats, the /mystats command was left in so that you can use that to query the server about your stats (the real stats used in events) versus what is displayed on your screen.

Initial Skills List Implementation

I got tired of using the command, so I implemented a very basic version of the skills list. Note that this version does not display bonuses yet, even though that feature is implemented. as noted in the previous section, this uses client-cached data to generate so any indication that there is desync should be reported. There are two new features that this implementation brought out though: client config settings, and an update to skills.json

Client config

Any setting that affects the client is now in the pmmo-client config. This means that your gui settings are now the same no matter where you play! no server overrides. Also, if you use a mod like Configured, you can change your client settings this way and they will update instantly on your game. Client settings have an auto-update element to them, so even if you edit the config in a text editor, forge will recognize this, and PMMO will pickup on the changes and apply them.

new Skills.json

well not really, all I did was unhardcode the colors. As of right now, there are no hardcoded skills. zero. nill. nada. If you don't want a skill called mining, then you don't have to have it. PMMO will still ship with defaults, but you can override them. What this means is that if you do not specify a color in skills.json for a skill, it will be white. note that in this version I implemented it with integer colors, but want to replace it with hex in a later version. In skills.json every skill that you want to not be white should have an entry like

"skillname":{
  "color": 1337420
}

the skillname would be your skill's untranslated name, and the color number is whatever you desire.

Note that I will likely use this format for skills.json to add in some more configuration to skills themselves. This config was already designed to let you bypass the afk penalty, so I plan to expand on that level of control.

MsLoggy Tweaks

In the common config, there are now more settings for which logging types you want to see. That's it. just more control. enjoy.

Testing Notes

  1. Please verify your stats in /mystats are accurately reflected in your skills list. This will be the first indication that either the client is calculating wrong, or the data isn't syncing properly.
  2. Please play around with multiple skills giving variable bonuses to certain tool speeds. btw, ridiculously high speeds are kind of fun.
Clone this wiki locally