Summer Project: Week 2 and 3
|
I was going to write a post last week, but a) ended up forgetting about it, and b) felt that I didn’t really have enough to write about. The previous week was a quite unproductive week, due to visiting my parents. Anyway, the task scheduled for these weeks was generating and connecting rooms to each other. I had some idea of the rules I wanted to handle this, but no real idea of how to actually implement it. I ended up looking through the articles on RogueBasin, and found an article on basic BSP-generated levels. In short, it splits the world into smaller leaves, and then splits those leaves, and so on, until the desired number of splits has been done. Each of these leaves then had to contain a room (at this point, basically just a black square). Then I had to connect these rooms together. Since I’m not keeping track of which leaf got split from which, I can’t connect the rooms that way, like suggested in the article. Instead, I had to come up with another solution. What I ended up doing was:
A video of some tests can be found here. This actually caused less of a performance hit than I was expecting. However, it came with some other drawbacks:
So why did I do it this way? Well, I was getting frustrated trying to figure out a “better” way of doing it, and remembered raycasts in 3D graphics, so I wanted to try to emulate something like that. It ended up (mostly) working the way I wanted it, with just those two quirks. What’s up next then? Well, after fixing the quirks, it’s time to add some gameplay. Probably something simple, like a special room to “go down a floor” and randomize the floor again, and after that, stats and loot, and last, fights. After that, I’m mostly done with the original project, and free to add whatever I feel like I want to add. The code for this can be found on Git, more specifically in the FloorManager, Leaf and Room-classes.
|