Update #67 - Crafting, Chatting & AI

Hey, how’ve you been? As I surge ahead with Merchantry, it’s getting so much better.

  • Merchantry: Fixed the ObjectAnimation states' Initialize action not being called.

  • Merchantry: Changed WorldObject's UseObject() method to LeftClick() and RightClick().

  • Merchantry: Added a basic character class, which all characters (PCs and NPCs) will derive from.

  • Merchantry: AI now makes use of priority checking (as a float). The highest priority goal is the current goal.


I’ve got the foundation for crafting in place! It’s very functional, just need to do a little bit of polishing. While I hoped to use Aeta UI for this interface, I ended up coding some new classes just for game world UIs (Element, ButtonElement, ImageElement, ItemSlot). All world UIs derive from UIObject, which then derives from WorldObject. Let me walk you through how crafting in Merchantry works.


Pictured above is the crafting table, as viewed from the perspective of the player (ignore the doggos). Clicking on the crafting table will zoom up really close, allowing you to use it properly.


The UI is intentionally positioned on the right-side of the screen to make room for the inventory, which opens up on the left. Currently, the crafting table has similarities to how Minecraft handles it. Drag your items onto the grid, and if the item placement matches a recipe, the red “X” changes to a hammer. Clicking the button will create the item(s), placing it into the output slots below.


Now you can grab the items and put it into your inventory. Nice job! One important distinction is that the UIObject contains its data, so walking away (exiting) from the UI won’t force the items out like in Minecraft. I’ve placed items in it, exited out, and starting pushing the table around. I really enjoy how connected this UI feels to its world.

Even though its used for crafting, I can easily create different UIs. An anvil for reinforcing/repairing tools and armor, a furnace for smelting ores and baking food, etc. All I need is the object’s texture, position the elements, and set up recipes to match the slots.



Nothing too fancy or much to say about it, but it gets the job done. Each object has it’s own ObjectChat class. This is where all of the important chat data comes from. While you can send a string directly, the best way is to add a a string with a key. The key is called, and a random message is sent. Fairly helpful!


In Merchantry, AI is goal-oriented, making use of a float for priority. The highest priority goal is focused on first.

In this example, the dog has two goals: Follow, and Rejoice. Follow’s priority is calculated by the distance from the player, and Rejoice’s priority is at a fixed value. If the player moves too far from the doggo, he’ll move towards the player. When he reaches the player, he celebrates by jumping and barking.

I may need to make some tweaks in the future, but it works well.

Final Words

Current Goals: Polish existing features, various world textures, object selection code, character code, pathfinding code.
Future Goals: Pause UI (simple overlay), escape key UI, message UI, dialogue UI, professions.

If you have any support, ideas, constructive criticism, or just want to tell me how much you dislike my creations, you can:

  1. Send me an email.

  2. Tweet to @Soestae.

  3. Gab to @Soestae.

  4. Toot to @Soestae.

  5. Comment below.

Do you want to support my projects? Here's what you can do:

  1. Become a Patron here!

  2. Tell your friends and family about my projects!

  3. Retweetrepost, retoot, and share!

Thank you for reading!
Soestae, Emberium