Saturday, December 2, 2023

Inventory, Loot and User Interface

So, I've been basically doing another side-quest with the code over the past few evenings and Saturday, writing up all the code for the most banal user-interaction that it's boggling how much code went into it - views and stacking items.

As the server needs to be aware, and is the source of truth for all the data in the app, picking up loot (or buying items from a vendor) needs to check if you already have the item, create a new one if you don't, or stack it on top of what you've got if it is stackable. That needs to happen in the app first, then fire off a bit of info to the server, wait till that's processed, get the reply confirmation, then finalize the process in the app with the new ID keys for the items, and the update the views in the app to show what's happened.

While I was doing that, I also wrote up some code and created a user-interface that lets you do stuff with items in your inventory - like combining all items of one type into a single stack, or splitting a stack up into two. Again, such a simple action, but one that requires more server calls, items to be deleted or created with new keys, quantities updated and again, finally all confirmed back in the app and the views updated to show what's happened.

Anyhow, that's all working nicely enough right now, so I guess the next bit to focus on is "using" items such as potions, and the code to support items that have permanent effects (like teaching a spell for example). As I make those amendments to the items tables and editor interfaces, I should also fix up a few gaps that I have to fix on the back-burner for items.

Sometimes it seems never-ending, but with each section, the app starts to feel more and more like a fully fledged game - and that's a pretty stunning feeling.

Thursday, November 23, 2023

Loot (and also Item Stacking), but mainly Loot!

A good bunch of code has been written since the last update, most of it seeming to be much more behind-the-scenes in terms of what it felt like, but.... but... the game now creates proper loot drops, that can be picked up and put into inventories nicely. I've also (partially) implemented item stacking, so items that should be stacked can be stacked on one another. Very amusingly, there was more code written and changed to accomplish that than there was for a lot of other things - and I know that's not complete yet. So, I need to keep tweaking that, to be able to split stacked items apart, trade portions of a stack to another character, or even to sell a partial stack.

But. We can loot stuff, and the game handles loot tables nicely. And that's another step in the right direction. So yeah, it's all moving along.

Wednesday, November 15, 2023

Loot, Loot, Loot, Loot, Lootely-Loot

The last few evenings have been thoroughly brain-juice-draining which is a polite way to say, I've been writing editor interfaces for some reasonably complex database structures, which in turn is a polite way of saying stuff that's not overly fun or exciting. But..... but.... but. It's (mainly) done. I will certianly go back in and tweak the UI to make it neater and better, but the general bits are working.

I can create a list of items as a possible lootdrop, all with weightings and settings around how many things drop, whether they need specific events to drop and so on, and then combine THOSE into another list that I can then give additional weightings to, connect to events and so on - and connect that to a creature as a loot drop. 

It is probably a bit more complex than I'd originally thought I'd do - I mean, why not just a loot table per creature, right? But this lets me re-use certain lists nicely. A Giant Spider, and a Monstrous Spider might all have a chance of dropping some random spidery-gobble-di-goops - and I can make a list of those, and connect it nicely to each spider, but then add in a different set for the harder creature, or connect to a particular meat or venom type for individual spider types. All about re-using. It's also a great way I think, of creating some rather large loot drop lists, for humanoids, and not have to recreate them for every type of pirate, brigand, scumbag and bully who walks the world.

Tomorrow, it will be time to start pulling all that into the app nicely and then starting work on the screens to let the player pick through what loot they want and add it to their inventories (as well as writing the server code for all that).

Good progress, even if it's mind-numbing to write all this editor stuff.

Sunday, November 12, 2023

Editor Interface for Loot Drops

Quick update, I've been hammering out the editor interface code to let me create drops and managed to get halfway through what I need I think. There's two interfaces that I need to complete to make it work in the way that I want, and I managed to get one of them done.

So currently, using the items I've got made up, I can create a loot table and set up item weightings within it. All the usual, updates, deletes and so on work nicely now. So, with some luck, tomorrow, I'll get to the next bit that ties them together, as I've made them hopefully in a way to let me re-use certain lists. If I make a "Goblin Junk" list for example, I want to be able to attach that to all types of goblins, but also make a list called "Goblin Treasure" and additionally attach that to higher level goblins, and so on. I've implemented some other code in a similar way already, and it's working a charm - so yes, more please tomorrow.

Saturday, November 11, 2023

Major Combat Fixes

I had a great code Saturday today, putting a lot of code into place-holders I had before, or things that I'd left unfinished. So, currently, I finally have encounters using a proper threat range outside of the combat system, I also tweaked that to show the encounter in a colour that will show how easy/hard it probably will be. 

But I've also fixed up a bunch of other code that had bugs in it, monsters will now TRULY not spawn on top of one another when a fight starts up, and I fixed up some of the early initiative settings again. While I did improve the way the game handles the device changing from portrait to landscape orientation, there's still a few layouts to tweak to get quite right (one of the Monster Info panels opens up on the wrong side as is visible in the quick capture for example).

I've noticed a bit of lag however in the UI with some of the recent HUD changes I made, so I might have to investigate that at some point to see what's going on there. It's only sometimes noticeable, so that's going to be a delight to track down.


Wednesday, November 8, 2023

Combat Cycle

I managed to get some quality code put together this evening. It's one of those "expect it to work, but need to code it parts" which I've ignored till now, but needed to fix at some point - which became now.

The combat cycle was separate from the normal game time cycle. I needed to at least sort of, combine the two together - though at different scales. I already had the combat happening in ticks or sorts, where actions would put a delay on the characters until they were ready to activate again and with some recycling of code and making use of hooks that were already there, I managed to connect it together. That also means that buffs and effects that were active prior to combat, or ones picked up while in combat have a reference point on which to increment now.

The long and short, is that while I'm sure there's bugs to fix in what I wrote tonight, the real-time normal mode and the turn based combat mode are now connected, and that means that effects have something to reference and go off with - and that's good progress for a night! Tomorrow, I'll try to connect those effects ticking over to something that the game will show up between activations, so that you can see when someone gets hurt/healed by a damage/heal-over-time or when something else generally happens along those lines.

Tuesday, November 7, 2023

Combat Abilities and Animation Effects

I've been very flat out with work, so time has been limited, but I've certainly been able to fix up a few small bugs, as well as throw in some extra functionality around combat and abilities.

I've also been using the animation editor code to rustle up some more sequences for various abilities to use as I test things out, so it's great to start seeing some random animations popping up.

Got another busy day with work tomorrow already, but with some luck, I'll get some coding time in late tomorrow evening to keep at this - I noticed a few bugs as I was testing today which I should fix easily enough, and there's still a whole bunch of code to plug in around how abilities are used, though I think a bunch of it is getting easier and easier to do.

Inventory, Loot and User Interface

So, I've been basically doing another side-quest with the code over the past few evenings and Saturday, writing up all the code for the ...