Nesting Objects

creakinator
22 Nov 2016, 03:31

I came across this system yesterday and started to experiment with it. I started to build a 'farm' starting with the farmhouse and, of course, it would have the other items on a farm - barn, fields, etc.

In creating the house, how should I 'nest' the objects, ie, the large items (Building) and the rooms in them. Since I'm going to have different objects with different rooms, should I do it like this under Objects (-> means and indent):
Farmhouse
-> kitchen
-> living room
-> bedroom
Fields
-> corn
-> wheat
Barn

or
living room
bedroom
kitchen
barn
corn field
wheat field

I understand that items in a room (kitchen would contain a table, refrigerator, stove) and these items would be contained in that room. Would it make sense that a house would contain the different rooms inside it? I don't know enough about this game to know if this nesting would cause me issues later and have a 'flat' (like in my second example) would be better for the house example.

Thanks for your help.


XanMag
22 Nov 2016, 04:26

I would not try and put rooms inside of rooms or rooms inside 'buildings'. Doing so would cause my head to explode trying to track and map exits and such. Each room should be a separate entity with exits to other rooms.. The objects for each room should be in that room parent. If I understand you correctly the nesting should be like this:

Farmhouse
Kitchen (children = stove, fridge, cabinet, etc)
Living Room (children = sofa, table, tv, rug, etc)
etc, etc, etc.


hegemonkhan
22 Nov 2016, 06:30

aside of how the map/grid works, there's only two things that I know of that effects game play (impacts the person playing the game):

  1. containment: 'movement' is actually determined by the 'parent' Object Attribute and/or using Exits (which may underneath also use the 'parent' Object Attribute or not --- no idea how Exits work)

  2. displayment (the default UI shows nested/sub/child Objects)

thus, how you organize/nest Objects (in-code / GUI~Editor) is entirely for your own organization as game maker, aside from how the grid/map works and with dealing with displayment (I'm sure you can control what gets displayed), as movement is done by Exits and/or the 'parent' Object Attribute, which are completely independant of how your organize/nest your Objects.

A parent/root/super Object can either be visitable by the person playing the game, or not (it simply being for your internal organization as game maker).

Using your example, your 'farmhouse/field/barn' Objects can either be visitable room objects by the person playing the game or not (it just acts as an organizational group/category/section placeholder for its member/sub/child room objects -- these which are actually visited by the person playing the game, but not the parent/root Object as organizational placeholder for them)


I would personally have your Objects be organized for your own sanity (as well as having a good naming/labeling system/convention too), you can decide on whether these Objects are actually visited by the person playing the game or not, depending on how you want to go about designing this aspect of your game.