var world = {}

var entities = {}

world.add_entity = function(entity_proto, data) {
  var entity = meme(entity_proto, data)
  if (is_function(entity.init))
    entity.init()
  entities[entity] = true
  return entity
}

world.destroy_entity = function(entity) {
  if (is_function(entity.on_destroy))
    entity.on_destroy()
  delete entities[entity]
}

return world
