Friday 28 March 2014

Clarity

When I went through Monster class I suddenly realized it's a mess. Somehow you look at the source code and it's just not good. It's slightly depressing and also quite odd, because how didn't I see that earlier?

I'm going to re-order class functions and try to create a better arrangement from small functions to the high level functions for AI and actions. I guess it's not a surprise that Monster class is difficult, because it's a part of the player class, too. The way how inheritance (from Monster to Player) is done in this case is not the best, but when I was programming it I couldn't think of any better solution either and I still can't. I guess you should isolate the basic functions for both creatures and the player, without any reference or difference to the player.

I seem to run out of hours per day which is annoying. There is so much more to do each day. They say that when you get older it feels like time is running faster. I think they are right.

2 comments:

  1. Why not using a common Creature class that both Player and NPC inherit from? An alternative could be a composition system, so that you can work with components instead of long, abstract hierarchy structures.

    ReplyDelete
  2. There are some component parts in the Creature class, but the idea of changing the class hierarchy itself doesn't sound good. It's not really needed and would require another turn of refactoring which I don't want to do anymore.

    ReplyDelete