State Of The Union

Man, what a month. I put so much effort into this website that I missed out on about 8-9 days of development time. However, once I got back to it, I was able to keep up the same frantic pace of work I had back in December. And I needed it, because this month was certainly the most programming centric one, which found me building from scratch many core systems for the game. Luckily, I was able to finish the month off with a little UI work.

As I stated above, just getting this site up and running was a long and time consuming process. It involved many late nights, and when I was done, I needed some time to recuperate.

Attributes & Items

Once I had rested, I began working on the first of many systems for the month, Attributes. Not that I should have to, but for clarification, when I say Attributes, I’m thinking of things like HP’s, EXP, STR, DEX, SPEED, etc. As it would turn out, Attributes are the key ingredient to many other systems in the game, as it was created generically enough to make that possible.

After Attributes, I turned my attention to Items and Inventories. Which is, again, a pretty important system that every RPG needs to have. And it’s good that I did my work on Attributes first, because it played into my work with Items very well (the idea that Items are composed of Attributes, like a Sword of Galladoran that has a STR attribute of 26).

One of the side effects of work like this, however, is that most of it is just straight programming, with little to no UI. So it was hard to blog about it, since I have a lack of screenshots. I tried posting code in one post, but the particular plugin I was using for it had some weird quirks to it, quirks making me not want to use it anymore. I’ll worry about switching plugins later.

But regardless, it was very important work, really setting the foundation on how to do things on the data side of things.

Inventory UI

Finally, finally, FINALLY I was able to make a UI representation of all of that data I had been creating for weeks. Turns out, that work wasn’t too terrible to implement.

Unity has had a new UI system since the fall of 2014 I believe. With the old way, it was all scripting based. With this new solution, you can create various UI objects from within the editor and make them look exactly as you want them to. This of course comes with its own issues, but overall, from the little but of time I got to experience with the old system vs. the new system, it’s like night and day.

For the inventory, most of my work was centered around creating a panel that was comprised of a variable number of slots (panels themselves), set to the certain resolution. It’s these slots where icons mapped to the item would sit. As for how it got populated, I basically hard coded a bunch of items to be created and tossed into an Inventory object, and then iterated over said object to fill in the UI itself.

Next up was some work on getting tool tips when highlighting an item. That was pretty simple, as every image in each active slot will have a reference to the corresponding Item and have all the data it needs to display information about it.

After I had that working, I put in a little logic to be able to dynamically change the size of the UI. The thinking was that it could be used in other places (perhaps a hot bar). There’s just 3 fields I have to deal with, which are Rows, Columns, and SlotResolution.

Being able to set the values of fields from within the editor is great.

Exposing this to the editor was very easy, and helped out a lot when testing various sizes and whatnot, not having to open up scripts and having to modify values in them.

The last thing I did was start putting in the logic for drag and drop functionality. You can see a GIF of that at the top of this post.

Moving Forward

There are few things I’d like to work on before wrapping up this prototype work:

  • Fix a bug where the item, when being dragged & dropped, displays behind some parts of the UI
  • Creating some sort of mapping between items in the Inventory and the UI. What I mean by that is, it’s just a list of Item objects in the Inventory, but if they’re moved around in the UI, those new slots need to be saved somehow. At the moment, I’m thinking about some dictionary that maps an Item index in the Inventory to the index of where it should be in the UI. Just making shit up, really, I’ll figure out something better once I’m actually working on it.
  • Add a larger character sheet to the left of the UI, where it displays the things like the portrait, name, HP’s, EXP, various combat attributes such as STR, DEX, and SPD. Most important bit will be some equipment slots. These slots should be able to receive items from the Inventory UI, and vice versa. Again, the UI will look like shit, but I’ll try to do as much as possible, so when someone else comes in to help, they’ll be on the same page as me.

From here, I’m not 100% sure of where I’ll go. I have a lengthy list of items from my last State of the Union post, so it’s not like there’s a lack of things to work on. In fact, now that I have taken a peek back at the list while getting the URL to link back to it, I’m pretty happy with what I’ve been able to finish. I’ve done a lot more than I’ve thought.

If I you put a gun to my head and asked, I’d say the next thing I’ll start working on is an Ability system.

Till tomorrow…

I’d be remiss if didn’t briefly acknowledge Roger Federer and the his great (perhaps greatest?) accomplishment of defeating Rafael Nadal in the 2017 Australian Open final. I’m a huge tennis fan, and fondly remember getting up at 4am so I could get into the office around 6:30am, so I could stream Federer matches on during the 2008 European clay court season (they’re 6 hours ahead of where I live, hence the early trips into work). Tennis is not a joke to me. I take it very seriously. Every loss that Nadal inflicted upon Federer since 2008 has left me in ruins. For him to finally get a huge win over him, first in like 10 years, was amazing. I’ve been watching highlights of it over and over again, which a huge grin on my face.

It’s also very inspiring, and even though tennis and game development are clearly very different beasts, I’m motivated by what he has done, when everyone (including myself, to a degree) thought he was done.

Tips hat to Mr. Federer, the greatest tennis player of all time.