frnsys / highrise

building social dynamics simulator
5 stars 2 forks source link

Should letters be object IDs or object types? #14

Open dantaeyoung opened 7 years ago

dantaeyoung commented 7 years ago

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

dantaeyoung commented 7 years ago
frnsys commented 7 years ago

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.