Friday, 9 April 2010

Small rooms

The problem with passages was that it had another bug that made the passage routine exit before it had reached the destination. Now it should work. Added more round rooms and small rooms. Now we're getting somewhere:
I think it's something I wanted, but it's going to have some stuff added before it's ready. The important thing now is fix the corridor routine between actual rooms. I have no clue how it works at the moment. It's supposed to connect closest rooms, but look at that long corridor made across the level. Not what was planned. Looks like the connecting logic is broken. Also looks like one of the room is left without connection.

The connection logic is more complicated than it appears, because you can't just connect all rooms from one to another. It will create a messy web of corridors. It's better try to connect closest rooms and then create additional connections which connect every room together in some way.

Thursday, 8 April 2010

Passages

The slowness of cavern creation was actually a bug in passage routine (a simple corridor). Also fixed small room bug that gave wrong locations for rooms, now they are created again. There is just one problem with passages:

A rogue passage not connected to main dungeon. You would think this kind of routine is easy to do, but it looks like you can fail in that. I mean how hard it is to draw corridors between caverns?

Then there is that issue with round rooms and corridors that can't find a proper wall. Guess I need that pathfinding for corridors after all.

Tuesday, 6 April 2010

Caverns revisited

I'm refactoring cavern class to create more natural looking caverns. I tried to use Teemu's source code for that, but caverns in Kaduria are much bigger and needed other type of strategy. Then I noticed that I could use Area class to create caverns itself. It almost worked right away. The neat idea in flood filling was that I'm sometimes using 2x2 seeds to make the shape more irregular. Damn it's slow, but look at this:


















The round things are actual rooms added after caverns. They don't have corridors yet. The passage routine between caverns is actually buggy, but I guess it could look ok after small rooms (to be added later), because small rooms attach themselves in free areas just like those loose corridor ends. I like the result, although those long straight corridors don't look that good. Maybe this theme needs more caverns after all.

Friday, 2 April 2010

Messages

The dungeon generator of Kaduria is such an entity that it's hard to keep it in condition. When something is changed the generator can go bananas. This is what I got today:

It's trying to create a room in bad location, but it can recover from that and doesn't crash. I've made the map routines check out of bounds internal so it can't fail that way, but there can be areas that are disconnected. There is still some serious stuff to do with corridors and how they are connected. Corridors are always the problem.

Monday, 22 March 2010

Actors

Solved the init problem with Actor class by using late initialization in derived classes. Actor is in a middle of class chain and has no information of derived objects until they are initialized. I don't know how bad that is, but I can't see any other solution for this. You have to know more than Actor knows to determine which object type is a container or opener. One other solution could be pass that information as constructor's parameter, but it's pretty much the same.

It's almost done now, the only thing missing is determine which monster types can carry items. It's already in monster data and for that I have to add one check to cover it.

Wednesday, 17 March 2010

Creatures

Lately been fixing artificial intelligence using data-driven building blocks. This is one of the areas that needs most work, because I had only basic moving for creatures in early versions. In fact I have disabled AI and creatures just sit there, waiting for the programmer to do something about them. I'm glad if I can fill all the missing information in about two weeks and then begin to write the executive AI routines that handle the vast archives of creature data.

Tuesday, 9 March 2010

Notes

I may have talked about this earlier, but I have special comments in the source code starting with word "note:". Those parts of source contain a problem I have left to solve later. There are now 74 notes. Most of them are hard to fix and today I pretty much fixed one of them, which involved adding stuff to Score class (which I was talking about in 2008 blog entry). Fixing "note:" problems is as important as anything else in the source code, but they have been difficult to handle, because of generic difficulty or that something is still missing, like serialization which I now can handle, thanks to important experience from Teemu's serialization.