It's time to get down the business. As I progress, I'll talk more about technical stuff. I'm not going to teach any actual coding here, but I'll gloss over some technical concepts as I tackle them myself. I will link to any material I use to learn, so you can too!
The birth of a world
Well, ya, that title is a bit bombastic for what I'm doing, after all I'm simply going to generate a bunch of connected rooms. Still, it's the world in which the player character is going to live, so it is very important.
During the incubation period of this game, I already had some ideas about how the world would look. I know the world will be split into rooms. I know that more that one entity can be in a room at any given point. I immediately thought about a grid, and then naturally concluded some rooms may be bigger than 1x1. Furthermore, I thought it would be interesting if some rooms could connect through shortcuts rather than doors, allowing the player extra maneuverability.
Here is a sketch of what a world might look like:
As I start thinking about generating a map like that, I immediately realize this is too much for such an early stage in the project. This requires procedural generation, and storing all this information. I decide to make something much simpler, and develop it further at a later stage.
I opt to have a fully connected grid, which only the outer wall completely blocked off. Since I already need to make up a few tiles, top-left corner, top, rop right corner, etc. I decided I might as well get a full tile and pick the tile using bitmasking. Bitmasking is a neat way to store a tile atlas, and you can find countless tutorials on the subject, here is the one I happened to stumble upon.
I generate my tile atlas, based on the article, which is much faster than figuring it out on my own, and then store the grid in an array, simply checking if for edges and marking them as such, storing the tilemap value in each spot in the array. Not the prettiest code, but we want quick and dirty at this stage.
After that, it is simply a matter of adding a player sprite, and running the script. Since I used my roguelike core as the basis, it works out of the box.
World - Done.
Player - Done.
Controls - Done.
Next on the list, add enemies, so we'll have something to do!
If you missed the previous posts:
Gamedev blog 1: Brewing an idea
Gamedev blog 2: Birthing pains
Gamedev blog 3: It’s checklist time