This week saw me tackle the hardest item (to date!) in Unity: formation maintenance. In Conquest! players have the ability to define groups (or ranks) for their troops. Troops in the front lines engage before those in the rear. Troops with range can strike first from any formation. This allows players to line up their "meat shields" to protect the (generally) more fragile ranged units.
The design in Unity called for a drag & drop interface, with groups dynamically added and removed. I found a few tutorials on the new UI system in unity, which allowed me to get the drag and drop functionality working relatively quickly. However, dynamically creating the group graphics and moving the icons took 2 days!
Most of this time was spent on Google, trying to wade through all the available documentation remotely related to my needs. In the end, the biggest block was detecting where the mouse was when the user let go of an icon. As easy as it seems now, this caused quite a bit of issues for me. Eventually, I created a new project and went with just one icon. Then I remembered that by default, Unity draws items from the middle, expanding both sides evenly. In order to detect the leftmost edge I had to divide the center position by 2 and likewise for the rightmost edge. I'm sure there are better ways of handling this but it worked!
The layouts of the group boxes are a little off but overall it is functioning! After I got it working I took the APK file to the Test Droid cloud and the layout was all wrong. Back to Unity. I adjusted all the anchors (I had largely left them at the default due to being in a hurry) to correct the formatting issues. Another test and this time my screens looked ok. I went back to the other screens and corrected the anchors there too.
The Army screen received a new background this week. The camp is now much more visible and really brings out the buttons. Thank you Krees!
I also spent some time correcting some other minor formatting and coding issues. One of the advantages of getting something working is now I get to go back and fix all the items I did while in development mode. The army screen is now mostly complete. We will move on to the Kingdom screens next which will provide additional challenges (I'm looking at you Fleet Maintenance!).
On the server side, there were just two new items: formation sends the troop numbers vs. the names (which made parsing the format much easier) and accepts a new command ("DEFAULT") to restore the game default. I anticipate making additional changes to the engine as it transforms from serving text based clients to mobile ones.
The Kickstarter campaign picked up a few new pledges but we are a ways off. Please consider supporting Conquest! with a pledge of any amount: http://kck.st/1LTthng
Follow the journey on Facebook or Twitter. Until next time, I hope to see you in the game.
James has been working on Conquest! since 1993.