A quick #tutorial of sorts!
Even if you hate perspective, you should try to draw more than just the fronts of objects, especially ones made mostly of straight lines.
It looks way more natural and dynamic if the objects you draw have their tops (or bottoms) and one of the sides visible, even if you just guess at the perspective.
A while back, I wrote an Observer/Subject system in my engine, but didn't use it and didn't even test it. Well, here's a particle emitter that listens for physics collision events and emits a burst of particle every time something hits the ground above a certain speed :D Apparently my Observer code works!
Didn't have much time today, so I decided to code something simple: boxes with rounded corners, for dialogue boxes and menus. The parameters are the size, corner radius, and number of vertices per corner (=how round they are).
I used SFML's ConvexShape class for these, which allows me to give them outlines and set their colours easily.
Remembered I could use the colour parameters on these just like I can for pixel particles 8]
...Okay, it's really time for bed.
For those curious how it works (5/5) Show more
Whenever we've in a cave, if we reach the bottom of the cliff or if we roll to stop the cave, the "inCave" flag is unset, and we place a "steepSlope" tile to transition back to the actual face of the cliff.
That's all that "caves" are, but they make the shapes so much better.
Also, whenever a cliff or flat tile is placed, if it happens to be the solid dark tile, there's a chance to place a detail "tileTop" or "tileSide" tile with it. Helps hide the grid :]
For those curious how it works (2/?) Show more
Once it's got a height map, it passes it to a function that matches it to tiles. It determines the slope between each adjacent pair of x-coordinates, which in turn determines the tiles to be used.
For example, if the slope is 0, it'll place a random "flat" tile at the given height. If the slope is 0.5, it also looks at the height to determine which tile to use (half-slopes are made of two tiles). Then, it fills everything below with "filled" tiles.
For those curious how it works (1/?) Show more
It first generates a height at each tile boundary, one height for each x coordinate, stored as a simple 1D array. The first image is a representation of this height map, drawn onto the tile grid.
The possible height changes are pre-defined based on the available tiles. In this case, that's 0 (flat), 0.5 (half-slopes), and 1 (cliffs). It chooses randomly, influenced by the user-given parameters. If it chooses 1 (cliff), it generates a random cliff height.
I'll not stop making procedural generators for my game until I run out of things to generate.
This one makes background terrain to go with the trees from before. It currently has a weird bias towards gentle slopes while rising (towards the right) but steep slopes while falling ¯\_(ツ)_/¯
I make the webcomic Black Dram! When I'm not doing that, I'm probably making pixelarty games. They/them.
Mastodon.ART — Follow friends and discover new ones. Publish anything you want & not just art of all types: links, pictures, text, video. All on a platform that is community-owned and ad-free.