Wednesday, 6 July 2011

Digging - object specials

It was premature to say that digging objects was going to be easy. Sure, most cases can be handled with Damage that simply causes blunt force damage to the object, but there are plenty of special cases that need plain old source code in each object type's Dig virtual function. Let's take an example: when digging a pit there can be a tree in that tile. You can't dig a pit there and you can't cut the tree. I've made a special case that tells the roots of the tree prevents digging. Other option would be cause damage to tree until it falls, possibly damaging the player if he gets hit by it.

There are surprisingly big number of special cases related to digging, so it's somewhat slow progress when programming that stuff in virtual functions. Nice thing is that I have those special cases in the old switch-case function for digging, so I can extract messages and such from them. But in many cases I have to re-write stuff, because game objects work different way than old terrain based object tiles.

No comments:

Post a Comment