Protobound Day 6

Protobound Day 6

Today I will be trying to get the equipment system in on top of the stats system. Yesterday's after work project turned out to be a bit of a pain when the ESP8266 I chose bought the farm and the ESP32 I had as a backup has no pin identification and does not match any online pinout I could find so I spent a few hours reverse engineering it enough to get the pins I needed. In the end I just gave up on an OLED display and made it web-based. It's less convenient but there's less to go wrong as well.

I'm starting out kinda late today, had some trouble sleeping and trying to do this stuff while tired is just... not a good idea. Anyway I need to plan this out.

Every party member has 2 equip slots, armor and weapon. So I need to model the Inventory, Items and Equipment. Then I need to create a UI to change it and also show stats.

First Items which can be either nodes unto themselves(prefab scenes) or a script with a sprite. Each item will have a type (usable, weapon, armor, key) and in the case of equipment items a party member they can be equipped by. They need to have stat modifiers for equip and heal type (sp, hp) and amount for usable items. I'll have to have some methods like equip_item and consume_item.

The inventory can be a simple dict with the item as the key and the amount as the value along with some methods to manage it (use item, equip item, discard item, get item).

For the UI; I'll need a panel for party stats and equipment. I could use sprites to show the items equipped or just use a drop-down like mentioned above. I won't be paperdolling the items. Also gonna need a panel for usable items and I want to use it for in and out of battle mode. Rather not have to create two.

So I will start with the Item. Do I want to have each item be a prefabbed node? I guess I might have to if I want to have a certain level of flexibility in them. So I would need to create an item template scene and make a few equipment items for the equipment system today. This should be able to handle all potential use cases of an item. The next question is do I want to instantiate the items as children of the inventory? It would make it a little easier to work with items in the inventory but also require more memory. This would require the inventory to know how many of each item it has.

I also have to think ahead to the shops where you can buy and sell items. How will this tie into that? I think it should be fine, just need the right methods and a bool for is_equipped so you can't accidentally sell your currently equipped gear.

The player will hold the inventory node. The inventory node will hold the item nodes and keep track of the number of each item (rather than have multiple instances of each item, track amount and when that's 0 remove the corresponding child node.). The item will be responsible for knowing what it is and how it can be used. The inventory will have to have methods to hook into the UI and show the correct items based on context (All non-equipped, non-key items if selling to a shop, all usable items if trying to use an item, equip items for the equipment selection) which I will handle with some filter helper funcs I think.

Alright, I think I got the picture, gonna draw some mock-up UI on the whiteboard too just so I don't have to keep it in my head and get some lunch, take the dog out and get on it.

My mind is a little hazy today, having a bit of trouble focusing. I'm currently writing the Item node's script and it's all fuzzy despite being so clear just moments ago. Well, I only have 3 issues for this week because I suspected I might have trouble at some point. Anyway, I will try to shake it off and get it done.

I've scaffolded the item with some print statements now I am working on the Inventory. It has to add items, remove items, filter items and display items in the UI. First adding items. This requires looking in the Items folder for the corresponding item scene, instancing it and adding it as a child to itself, then adding an entry to the dict. Better make an item from the template.

Yoink.

That's the ability to get items done, now we need to add another one and see if that works as intended, then remove both and see that the child node is removed and the dict is cleared of the item reference as well.

Double yoink.
Must have a girlfriend.

Inventory add and remove working as intended. Now to take my 5 minute break, make something to drink, stretch my legs and then get the rest of the inventory functions working or at least what I can use right now to get the equipment system in. There will be more work for the shops system but that's not the focus of today.

I scaffolded how I intend the shop functions will work, just to save me time later.

Now I need to create the equipment system and the UI for it. The UI will have a panel with 4 sub panels, one for each potential party member. Stats and 2 dropdowns will be displayed, the dropdowns will be populated with items equipable by the character that panel represents.

On a side-note I noticed in IRC... programmer types use a lot of parens(huh...).

I've added an equipped_by field to items to facilitate the required filtering.

Now to build the stats and equip UI this is where I start breaking shit!

I wish the UI building had more features like... I don't know... setting font size in the inspector... as well as text justification. Oh well, it doesn't have to look great. It's a prototype.

That happened.

I don't like that the UI elements as I create them end up as size 0,0. I have no idea why it does that but I suspect it has to do with how I set up the parent.

Yeah, I create a child, set it's size and fill it in, it doesn't really line up properly and I am gonna abandon the grid container and hope this works out.

An attempt was made, there is a... UI of sorts. Anyway... I am having a hard time thinking of how the equipment will be handled right now so I need to work it out.

Shit.

First I need to populate the stats on the UI. I think that's a good place to start. So I need to get the information from the player from the player object, then I need to get the Party from the player and get the children of it in order to get the stats of the members. I could use signals from the party members and player to tell the UI it's time to update.

Hang onto your butts.

Now to wire it up to the actual UI.

Functioning, old school looking. (Maybe I should add a crt shader to it... make it look like green phosphor monitor like what my broke ass had as a kid.)

Anyway... now I have to do that for party members. Oh boy. I think I can emit the signal on joining the party as it will be emited every time the stats update anyway.

Problem is it's now 4:45pm and I need to cook dinner soon. Good thing I knew to only have 3 issues for this week, eh? I'm still on schedule.

So tomorrow I need to add the party hookups for the UI and then set up the equipment menu. Once I can get items to equip and unequip properly for all party members I will probably start working on the next issue: Shops. Oh boy, more UI. I also have to add input to open and close the stats menu that sets the state to menu or exploring accordingly.

Right now I am eyeing systems to cut if I need to take some extra time on certain other systems. I might cut the cutscenes system if the combat system goes on too long, for instance. The last week is mostly focused on adding music, sfx, atmosphere and polish. I'll also be (maybe) adding a lighting system. So I could probably cut some time on those if I have to. It's a prototype so the important things should be systems, not so much graphics, story or atmosphere.

Anywho... time for me to bugger off and make some food. Got some bug ranching to do tonight as well.

Cheers.