Mar 16, 2011

Hard-Coded Creatures, Items, and Maps

After the failed 7DRL attempt, I returned to URLP with great enthusiasm. As I pointed it out in this post, I would need to do something about the game's data files in the future, as plain text files are way too easily edited. I chose hard-coding.

For the past week, I've been working just on that, and today I can finally announce I've been successful; creatures, items, and maps are now hard-coded into the game, which of course requires the source to be edited if I want to change something, but I'm totally okay with that. I can still use URLPeditor to draw the maps and then copy the map arrays into URLP's source.

In the past seven days, I've fixed old bugs, made a bunch of new ones, and then fixed those. My knowledge of C++ has grown as I've learned more about pointers, passing arrays to functions (as pointers), and memory allocation and releasing -- there were a few places causing memory leaks. For instance, when created, creatures were added (or .set in C++) into a list of creatures, but never removed from it (nor the objects deleted). I am *very* pleased with the overall amount of improvements I made in the code.

Before I did any of this, though, I had to implement hue and luminance variation into random dungeons to make the dark gray walls bit more interesting. These screenshots are from the 7drl attempt where I prototyped the feature.


The color interpolation isn't as obvious when you can only see your FoV, the rest being grayed out, but I think it adds a nice touch. Noise is such a great tool for games. (And libtcod such a great tool for providing easy access to noise generation.)

While adding the creatures and items into the source, I figured out a proper random generation system for both of them. And it is great! Although, I do have forgotten how exactly I was planning to do magic items; the stuff looks pretty complicated in the dev files. I believe it was a good perfectly system, however. It must be. I need to re-read my notes...

Also, I took an A3-size paper and drew a mind map of URLP's maps/dungeons. There seems to be a need for 63 premade maps and maybe around 300 randomly generated levels. One would need more than ten playthroughs to see them all, though. Most of the branching is in the early levels where most of new characters will probably die, and thus one doesn't need to go the same path with every attempt. There is definitely more variation than in Adom.

So, I'm slowly starting to have a quite clear picture about the whole game now. I think it might actually finish it some day!

The next major thing I'm going to look at is creature AI. And I already have a vague idea. These are exciting times.

No comments:

Post a Comment