Wednesday, 28 September 2011

Level class refactoring

Last three days have been quite productive. I have searched through Level class which is 3500+ lines of code. Many routines need either fixing or test how they actually work in the gameplay. I think the worst example was a routine searching for free places (when game objects are spawned). It doesn't work like it should, but when I change it data-driven it should fix most of the problems. I've also learned that everything should be check only once, because you will have extra rules and if that another routine doesn't check them it fails. There must be something like that because sometimes there are plants created on walls. It's bit of a mess, but it's going to get better soon.

Saturday, 24 September 2011


Going through Level class and closing functions when they look like they're ready. I think this is pretty good way to proceed especially when you get lost in the jungle of source code. The basic idea is find problems and try to find a solution for them even faster. When you program longer you start to understand what are the things that slow down development. I think there are only two things: 1) you did not find a solution for a problem and left the function/class unfinished and 2) bugs.

If it only were easy to fix all problems when you see them. But usually they are related to something else that needs to be done before you can continue. This is the difficulty in roguelike programming. With regular games you pretty much know what you need to add to make the game work like it should. With roguelikes you run into huge problems like artificial intelligence and the myriad of ways to interact with the game world. I hope my new style of programming brings some quick solutions.

Tuesday, 6 September 2011

Fighting style

There are some things missing in the process of constructing/creating a monster. Artificial intelligence type or AI type was quite easy to add. It was determined from the monster family and/or type of the monster. It's later used to make decisions about how the creature will act in certain situations.

Skills and default items are still missing. Some skills can be determined from the profession, but default item set is a problem. You could determine them from the profession and type of the monster, but instead of that I was thinking to add a new AI module fighting style. That way let's say a human fighter could have several styles with weapons and armour selected for that particular style. Not only items, but you can then determine combat strategy and also some additional starting skills from the style. Besides you need less fighting styles than there are professions and monster types.

Fighting styles need random variation in weapons and armour to prevent static item sets. It's going to be a complex system which is only telling how even one small area of roguelike is incredibly difficult to program. There is no easy way to do this, you need to create a number of styles with proper items, but still maintain random variation.

Thursday, 1 September 2011

Monster review part two

After some research I found out that only 40 of 134 functions in Monster class are ok (possibly don't need refactoring). The rest is in less good condition. I have hidden ok functions with VC's gui so it's easier to get work done in unfinished functions. I can only guess that it's a difficult task, but this situation with unfinished code and gameplay content has been going on for too long. Something has to be done and I got a good start by fixing some functions. The following days will tell more about how fast or slow I'm able to fix things.