I'm making a first person dungeon crawler like Eye of the Beholder.

During execution, I have a Map object. It contains Cell objects. Anc each Cell contains, at most, four Wall objects.

The Wall object has data for it's texture, and special elements like a door, a switch, etc. But most walls will end up being empty, boring walls.

My idea is to make this "boring wall" a single instance, that is referenced by all the cells that need it. Is there any design pattern or recipe in how to work with this? Or do you have any ideas?

I would like the entity's usability to be the same as the remaining entities (although I realise the default instance must be immutable).

I don't know if it helps, but I'm working with Lua.

Thanks in advance.


1 Answer 1



is the pattern name if I'm reading your question correctly.

  • \$\begingroup\$ It's not quite what I want, but I can start from here. Thanks. \$\endgroup\$ May 13, 2015 at 16:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .