Making a Pirate Game #3 - UI Skeleton

Another status update from the game I am making in Defold and the Lua programming language. There is a video as usual, this time with my voice in it, and the technical bit below.

What libraries did I add?

  • Monarch - A library for managing screens with transitions, made by Defold’s creator. At first I thought I would not need it, but once I dug into the examples, I gave it a chance. It handles popups very nicely and greatly simplifies the engine’s native solutions.
  • Druid - Adds a pile of UI components and a friendly API. In the video you can see hover effects on buttons, and that is thanks to this library.

How does it look in my game?

There was basically nothing difficult enough in the implementation to be worth discussing. One of the more interesting things was a small change in inputs_manager, which, as the name suggests, handled clicks and keys. I stripped away part of its job. The Druid library lets you assign keys to specific buttons, so actions like attacking or going to the pause menu are now assigned to buttons or handled by a script attached to the .gui file.

As for the action buttons, at first I thought one button would be enough for those two functions, changing its state depending on the situation. Unfortunately, practice proved that this does not work, because we can attack one ship and select another one at the same time. In that case, the attack button should be active so we can attack the second ship. At the same time, we still need the option to stop attacking the first ship. Two buttons solved the problem neatly.

Summary

I worked on the UI skeleton now because thinking about pathfinding was not going too well. I did the so-called research for it, and it turned out that the best approach will be implementing the HPA algorithm, meaning hierarchical *A. There are no ready-made libraries for this in LUA, so I will have to write it from scratch. During the summer I did not have the head for it, time passed, and I did nothing on the game. In the end I tackled this unfortunate UI just to get some progress going. Now I plan to work on saving and loading the game state.

Talk soon!