Tuesday, 8 March 2011

The player

I'm in process of rewriting some stuff in Teemu's data-driven engine. The big question is how Creature and Player classes are organized. This far I've made "quick hack" solutions and wrote some checks inside the Creature class for the player. It makes some routines player only and it's bad from data-driven point of view. So I'm trying to rewrite those routines. Let's get an example. When someone throws something at enemy there is no way to determine who threw the item so it's always the player. There is a also a chain of routines leading to Level class without any way to determine the thrower.

The strict way to do shit is make Creature class routines generic enough so they can be used by the player and other creatures without any kind of special checks. Then use virtual routines to override Creature routines when the player needs something special. This is what I need to do now to prepare creatures for more sophisticated AI routines.

No comments: