Trade UI Hooked-Up (Mostly)

Hey Folks! I managed to get most of the trade UI hooked-up and running today. Still a few bits missing, but what you see in the image today is actual inventory data from two crew members.

There were a few bumps on the road getting it all working. Some missed data here and there, null pointers, selection glitches. I still can't figure out why AIs sometimes walk away while the other AI waits for their reply.

But I now see rows for each item type, complete with a "price" (currently same as mass), name, image, and amounts for each party involved. I can adjust the amount being traded, and each line item updates subtotal, which changes the overall total. Cancel bails out. Accept does too, for now. And Reset does nothing.

I also haven't hooked-up the barter zone, as that's a bit trickier. The player's barter zone would be easy, since I could just assume it's any barter zone on the game's "ship" property. There's only one, after all.

NPCs, on the other hand, are trickier. In theory, there are going to be stations where multiple NPCs live, and they won't share barter zones. A food supplier might have one of their own, while the clothing store next door has a different one.

I'm going to need some way to tie a given AI to one or more barter zones.

And as I think about that, this might tie into how NPCs are spawned. A storekeeper will need to spawn in a fairly specific place on a station, and be linked to a given barter zone and loot list. So stations are going to need spawn zones set, and some rules as to who spawns where.

The plot system overlaps this a bit, too. When we speak with a bartender and they offer a mission to find a bartender off-station, that bartender should probably use these spawn rules so they appear in a reasonable place.

Zone info is already part of a ship save file, so that much is covered. There isn't any more to it besides which tile has which flags, so we'll probably need some data that says "spawn NPC template X at spawn zone Y on station Z, and link X to Y after doing so." Where does that link info live?

ConditionOwners (CO) and/or PersonSpec (PS)classes seem like one approach. When an NPC exists in the game, it has at least a PS, and potentially a CO if it gets fleshed-out and walks around. So the PS could list which zones it owns.

However, there might be a case for making each zone (and each item, for that matter) list its owner(s). If the player steals from a shop, we'll need to know who owned that item to initiate a consequence/response.

Could be this needs to be two-way. But this is something I'll need to think about. And unfortunately, that means starting Monday at the bottom of a big, unknown task. It's always tough to start from that.

Alas, I don't have a better idea right now, so weekend break it is! Have a good one, all!

Comments

ra1's picture
ra1

Why have barter zones on stations at all?
- I would think bartenders and similar would always spawn in the same exact spot.
- "Wandering" traders could spawn anywhere on the station, and it is up to the player to find them. To restrict a bit, you could have a "no spawn" flag in some areas.

dcfedor's picture
dcfedor

I was thinking that station vendors would each have distinct wares, and the game would need to know which items to show when bartering with a given vendor. The barter zone just draws a box around the items that are eligible for sale. And is somehow linked to the person owning it.

So if you visited a clothing vendor in a shop next door to a liquor vendor, the game would only show the clothing in the barter zone associated with the clothing vendor. And would ignore the liquor vendor's items, and items coincidentally in the area like furniture, doors, plants, and the vendor's vac suit.

I guess an alternative might be to just lump the vendor's entire inventory into their magic pockets, give them unlimited burden capacity, and write some filtering code to avoid selling their sidearm and clothes.

But I kinda like having PCs and NPCs play by the same rules. Keeps things feeling internally consistent.

Dan Fedor - Founder, Blue Bottle Games