For example, say that our game will consist of two different kinds of fruits: magical and non-magical. If two entities are identical except for a few differing properties then it would be simpler to create a generic entity and add the properties manually instead of defining a new build-predicate. Of course, it wouldn’t be practical to demand that all entities are created in this manner. Since entities consist of properties, it would be possible to only build generic entities and manually add all the interesting properties in question, but we make the job easier for the game designer if he/she can assume that some primitive objects are already available. This suggests that we’ll need a builder-object that’s capable of constructing some default entities. allows us to create printable entities, where the string is the description. Where should be read as: build an entity of type and name it. The first part might look something like (as always, I’m just making stuff up on the fly, it’s quite possible that there are simpler/better ways to accomplish this!):īuild(room, room1, "A rather unremarkable room.\n").īuild(key, key, "A slightly bent key.\n"). For instance, if we first create a door with the default lock we’ll probably want to change this later on.Īll these steps should be expressible within a single file.