Saturday, 30 July 2011

Shops

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.

Sunday, 26 June 2011

Digging into digging

Digging routine is probably the most complicated of actions. There are actions for variety of floor and wall types, but also for all game objects. However it's now quite easy to handle game objects, because Damage can be used to generate simple "pick-axe" damage to objects, much like kicking does. Floors and walls (terrain) can produce different results, because there isn't just one floor type (like in Nethack for example). You can do all sorts of special stuff like digging on ice and fall through in icy water.

With terrain tiles I had to create a test function that generates all terrain tiles and then just went on checking what happens when you dig each tile. That way I could clear the confusion caused by rather complicated data-driven approach... but I guess that's the best way to do things anyway: test everything you possibly can figure out.

Friday, 24 June 2011

LOC chart 2

When you start to add content it shows in LOC. Although the chart can look deceiving since there is only about 500 lines of code added. It could be more, because I'm in the process of moving old kicking and digging functionality into new data-driven code and then removing old commented out code. Both kicking and especially digging are full of content, because a lot of things can happen in those actions. The functionality shift from old code to new isn't easy, but I've managed to create a good flow with the current engine. The new code is already much better, because it's data-driven and if something is missing it's quite easy to fix later.

Wednesday, 22 June 2011

Damage challenge

It looks pretty good with Damage and Kick, which is using Damage. The only exception will be combat, because it has to be handled with higher detail. Kicking objects makes them break! Although there is some minor adjusting left in the amount of damage, because you can break anything with one kick. The amount of damage is too much, which in return brings a question about the HP or condition value of a object. What should I do with that? Maybe linking that value to the size of the object is a good choice, because it's obvious that bigger objects can take more damage before breaking. But how about monsters?