Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Component Authoring Guide
Component Authoring Guide
Contained within will be some tips and tricks as well as solutions for common "gotchas" that might afflict the inexperienced Artisan.
Your First Component
- Under the Hero Placeholder, go to programming.Programmable and add the method name under programmableProperties
- Go to the Components Tab
- Under the inventory.Item component (in the list) add the name of the method to the plannableMethods array
- Under the programming.Plans component (also in the list,) add the name of the method to the plannableMethods array, too
- Select any component. Select the arrow of the smaller box and choose 'Create New Component'
- Assign it to a system and give it a name.
- Go back to the Thangs Tab and add this component to the Hero Placeholder
- Test run the level and try using the method! (The hero should attack themselves, as that is the default code)
Making it an action
- Go to the combat.Bashes component, copy paste everything, and put it in your new component commented out (surround it by ### ### which is like /* */ in JS)
- Observe the 'attach', and 'bash' methods.
The following is a broad overview of what occurs under the hood:
World Base Class
The world contains a set of Systems, Thangs and their Components.
System Base Class
Systems are a set of actions that are performed on applicable Thangs.
- The Collision System ensures collision objects don't overlap.
- The AI System controls the logic for the NPCs, such as Yaks or Ogres.
Thang Base Class
Thangs are individual entities which contain Components.
- An Arrow is a Thang.
- An Ogre is a Thang.
Component Base Class Components are parts which sum to make an entire Thang.
- A common Peasant is made up of the following:
Describe how to efficiently make a spell here.
Describe how to make an ability.
- Enemies consist of very rudimentary intelligence. Spell-based enemies (such as Shaman,) employ the component 'ai.AutoCasts' for their spell repertoire, which automatically cycles through all their available spells and attempts to cast them if they are off cooldown.
- Note that the actual logic (who they are casting on, when to cast,) is locked in the individual function defined inside the spell.
- If your Thang spawns another Thang (such as shooting or summoning,) you must include a "requiredThangTypes" in the config schema, as this preloads the assets required.
- If spawning in a location, be sure to check to see if the position to spawn is actually 'clear' of obstacles.
- When creating a programmable action (such as bash or summon,) it needs to be added to the programming.Plans PlannableMethods array.