Switching strategies

On the Ludology podcast this week, they said that game balance depends in one respect on how easy it is to switch strategies mid-game. If it is too hard to switch strategies, the endgame becomes meaningless, because there is no point in playing further once a strategy becomes dominant. But if it is too easy to switch strategies, the beginning of the game is meaningless, because you can switch at the end to win without regard for the rest of the game. So the key to making the whole game meaningful is to balance how easy or hard it is to switch strategies.


Entity-Component-System architecture

Recently I have been learning about the Entity-Component-System architecture for video game programming. I think it will help out with my “World’s Tiniest RTS” game. I learned about it here, in Robert Nystrom’s Game Programming Patterns. I also heard on the Exploding Rabbit podcast how Jay Pavlina (of Super Mario Bros. Crossover fame) uses the pattern. Here is my Clojure code for it, currently:

(defn create-game []
  {:entities {}})

(defn create-entity []

(defn add-entity [game entity]
  (update-in game [:entities] conj entity))

(defn add-component [game entity com data]
  (assoc-in game [:entities (first entity) com] data))

(let [e1 (create-entity)]
    (add-entity e1)
    (add-component e1 :position [3 4])
    (add-component e1 :name "ball")))