More Item Placement, and Editing
I finished working on the item placement UI helper today, and here's a shot of how it looks:
As mentioned yesterday, this helper UI is basically a red or blue square for each grid cell the item requires underneath. All items have a 1-cell padding around all sides to let me specify that one side must be a wall or open floor, as in the case of this bed. (So AI can approach it from one side, and bed attaches to wall on the other.)
Blue squares means this grid cell fits okay. Red means there's a conflict. In this situation, the bed mostly fits in the open floor, but there are two red cells at the top where it wants a wall, one on the left where the bed's foot intersects a wall, and one on the bottom left where it requires open floor.
I also placed a bed across the room, oriented 180 degrees so it attaches to the other wall. This allowed me to take a snapshot of it's interaction point, the little green dot to its left.
Interaction points are where an AI must stand when doing an interaction with the item. This interaction point is the default, but I setup the code to allow multiple points per item. This way, we can have the "use" interaction point be in one place, while things like "clean" can be elsewhere, since not all interactions are performed from the same place.
You can also see a small smush of white and yellow pixels further to the left of that bed. That's a placeholder food packet item, which I plan to use for item inventories. I want to setup the item system to allow for "free" items (which can drop on the floor, be picked up, carried around, and stored inside other items) and "fixed" items (which are things like furniture, lights, etc.).
I already have a "fixed" fridge item that dispenses food when an AI interacts with it. Now I want to make the fridge give a food item to the AI when it's requested, and the AI can later eat it. This'll require rewiring the interaction data for food, eating, and the conditions associated with them.
However, the test data is already becoming cumbersome to edit. As any modder can tell you, hundreds of XML elements can become unwieldy. And tracing from one XML to another and back again gets tedious.
Therefore, I'm going to see if I can setup some sort of in-game editor for these data types. This editor will show a UI per data item that can be edited, as well as arrows pointing to other data it references. This visual arrangement should make it easier to understand how all the data works and interacts, sort of like my Encounter Editor from NEO Scavenger.
And this time, I'll see if I can include the editor as part of the game. NEO Scavenger's editor required a database be setup on the local machine for editing data, and most users couldn't use that. But with separate data files from the start, this shouldn't be a problem.
In theory :)
That's all for today. Have a good night!