Saturday, 25 December 2010

Searching

In order to search you need to have something hidden. Traps and doors are obvious... wait, doors aren't obvious. I have problems trying to figure out how to hide the door. Will it look like a wall? How is this wall tile handled, is it a normal terrain map wall? What happens if X happens to that wall (which isn't a door). Stuff like that.

Then there is an issue with hidden items. At first they were in a special list in the level, but I realized that handling hidden items will be more logical when they are inside the object which is hiding them. So, in order to get hidden items feature I have to write (possibly) a virtual mechanism for them, adding another type of container for hidden items. It could be easy now when container ability is ready, but you never know.

I'm also planning a data type for the search routine. It will continue the style I've been using in data-driven types. I have developed a certain kind of routine in programming for them so the data type will be quite easy to do, but it's always a matter of how it will be used in the rest of the source code. Programming data types for stuff like that may sound strange, but I'm always trying to reduce switch-case programming, because modular data types are so much easier to extend when you need to add something new, and they are also modular, meaning that when you get that module ready you can pretty much forget it and focus on other parts of the source code.

Friday, 3 December 2010

Rooms again

I left plants for a while and returned to room problems. Back in January 2009 I was writing about connecting the interior and room structure in the same class. Well, it was something like a mistake. Now I realized that it could be easier to start with basic shape of the room, then add wall and floor data (room data in general) and then create the interior when everything else is done. Without that there would have been room types for all shapes and interior types for no particular reason, creating a long list of data for all possible combinations.

I also have had problems to create and connect the rooms, but I think I have a plan for that finally. I will let rooms be created in any place possible other than overlapping the room floors with another room. Then work out connections either by creating holes on walls or using corridors. I have already planned how corridors would always work perfectly without ruining the room structure, but at the moment it's only a theory.

I have found room placement so hard to do that I actually made the dungeon levels work entirely without rooms, using natural caves as the base of dungeon generation. Rooms are actually something extra carved to natural caves and it even feels realistic.

Let's hope everything will work this time. I don't want to look back in 2012 and say I was wrong (still refactoring the room and corridor generation).