Thursday, 10 March 2016

7DRL day 5: Failure

I had no motivation to continue this project, even though the amount of work required was not that much. I'd rather put that energy to development of Kaduria.

Tuesday, 8 March 2016

7DRL days 3-4: Mass with class

I gave up and copied some of the gui classes from Kaduria to this project. Mainly classes for loading tiles and processing surface data, plus some other basic classes. So I now have a procedural code mixed up with a bunch of classes and I can display some tiles.

It's obvious that this wont be done in 7 days if ever. But I could at least use full 7 days to see how far I can get. I still have some left of today (is it day 4 or 5 already?) to add fonts which is the next step needed in gui.

Sunday, 6 March 2016

7DRL day 2: Tiles

I now have a program that runs, it has SDL 2 basics, but doesn't yet even have graphics routines. It seems I'm going to write this dev blog in advance to what I'm trying to do for each day. This day I should draw tiles and try to create a tile drawing routine.

I've already had trouble with procedural programming. I started to wonder how it's possible to store global data without classes, but of course it's possible to malloc memory and then point to it.. but how to use that memory without a class? I think C has structs, so they are kind of classes I guess. A class is such a fundamental building block in programming that I just gave up and created one to hold generic gui data, like keyboard commands and later graphics.

I think it was already a bad idea to try the procedural style. The source code will look quite strange if I'm ever going to finish this project. It's already a mix of functions, classes and even one datatype class I've been using a lot in my other projects. But who knows, maybe this is an opportunity to learn something.

Saturday, 5 March 2016

7DRL day 1: Procedural routine

I woke up early, depressed and not ready for the 7DRL challenge. In fact I've had so called "real life" issues lately. But I started the project anyway. The first thing I noticed how stupid procedural programming really is. In class programming you set up variables in the constructor and they can be then used by member functions. But in C you have to pass everything to the function and not only that the function returns some kind of value or object that has to be maintained somehow.

I can do the first part, but I'm just going to use C++ style containers for the objects and that's it. I think it's possible to decrease the painful amount of parameters by creating compound data structs you then pass as reference. It's possible that I also need to shift my thinking from small C++ style functions to larger, more generic functions.

This first day is going to be setting up basics in the source code and I could also draw quick placeholder type tiles and other graphics needed. Lot of the source code is coming from other projects, but it has to be "proceduralized" which is going to be fun I guess.

Friday, 4 March 2016

Evolution blob

One of the ideas for my 7DRL is what I call an evolution blob. In that let's say you start your level generation with ocean tile. What's next? It could be probably sand tile, then sand tile could become dirt etc. Each tile would have the next evolution stage or several ones which then could create a branch in the evolution. To avoid everything become the last stage of evolution there needs to be some kind of percentage value for creation and also possibly a proximity check for stuff like creating dirt next to sand, but not next to ocean (where it would erase the sand tiles).

Then "blobs" are created over each other to proceed the tiles in that place to next generation. I don't know how far you can go like that, but at least simple terrain generation should be quite easy. I guess you could create some kind of rooms by applying a room shaped "blob" with extra value to proceed the evolution from natural environment to artificial walls.

I was talking about planning everything to paper, but it didn't work, because I had the kind of ideas that needs to be implemented to see if they work. Beside that I'm trying to think hard what is the role of classes vs. procedural functions, because I want to stay away from classes as much as possible.