Saturday, 30 July 2011


After returning to Kaduria I was fixing some stuff and noticed there was no support for shops in rooms so I started to refactor that. The source code was there already, I just had to add a sub type in Room class for shops. Everything seemed to went well, because the shop creation code was also ready. But then... to my surprise it didn't work at all. Everything went wrong: there was only one table in the shop, the shopkeeper was in wrong place and all shop items were null items (this happens when the item creation fails and it's a safe way to detect problems, because null items actually work, they are just not real items).

I guess it should be easy to fix those problems, because the code to create shop and items is really just about 20-30 lines of code.

Thursday, 21 July 2011

Environment actions

I think the objects need to have a memory of where they were before. I think it's the only way to do stuff like pushing things into water. If the object doesn't remember where it was you would get multiple messages of the object falling in water when it's pushed to the next water tile. The funny thing is that I previously had that kind of data, but for some reason I removed it. I need to look at action data again, because creatures do have current task they are doing, like swimming. But I think that can't be used with other type of objects, because things like barrels don't go swimming, they just fall into water and float in there.

I'm thinking of breaking the big poop into micro actions. Like "fall into water", "float in water", "get out of water" etc. Well maybe I don't need the previous action to determine things, just current action.

I've also tried to clean up some of the mess in Message class. It's scary, that's all I can say about that.

Monday, 18 July 2011

An idea about stairs

Playing JADE gave me an idea about stairs. I noticed it's super annoying trying to find stairs to the next level in those quite large levels (especially maze types). So, why not make it easier and place the stairs somewhere near the entry stairs? It would make navigating much nicer when you have explored that level and just want to pass through it. Someone would argue that it makes too easy to advance, but that's not correct. The level difficulty should be determining that. In other words you can't just rush into places without getting killed by powerful monsters.

JADE is a nice game, because it shows how not to do things. It's constantly reminding what is bad game design.

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.