Should letters be object IDs or object types?
Opened this issue · 2 comments
from World.parseObjects:
// parse objects in a floor (denoted by capital letters)
// into Objekts. The letter used to describe an object is
// considered its id; this returns a map of {id: objekt}.
Alternatively we could
- have each character stand for an unique object of the same type. E.g: if 'food' is
%
, then%%
= two different pieces of food. - Have cell sizes be two characters long, with a 'type' and 'identifier'. E.g: if 'food' is
%
, then%1%2
= two different pieces of food;%3%3
is one long chunk of food.
- or we could also have two layers: 'object layer' & 'obstacle/building layer'. On 'obstacle/building layer', objects can't overlap, have unique coords and ids, and on 'object layer' you can have multiple objects with the same coordinate.. would solve problems like 'at 4,4, there's a 20-unit-high pile of guac''
i like keeping the layout lining up consistently, but an object layer might be a nice way around that. is the goal to avoid defining a lot of similar objects redundantly? e.g. if i have A,B,C,D
which I want to all tag with food, I currently need to do:
// (in addFloor)
{
'A': {
'tags': ['food'],
'props': {
'tastiness': 10
}
}
},
'B': {
'tags': ['food'],
},
// etc im too lazy to do it here lol
}
if that's the case we could maybe do something like specify default tags/props for a set of object ids like:
{
'ABCD': {
'tags': ['food'],
'props': {
'tastiness': 10
}
}
}
}
we'd have to limit objects to single-character ids, but there are over 128000 unicode characters so i think that limit would be ok.
let me know if the concern was something else!
also, i hadn't thought of multiple objects at the same coordinate, that might be tricky...
for the 20 pile of guac, we could just have a height
property or something. but if they were different types of objects altogether, we'd have to do something like what you're suggesting.